Re: force re-retrieve from database

[prev] [thread] [next] [Date index for 2005/06/14]

From: Charles Bailey
Subject: Re: force re-retrieve from database
Date: 13:47 on 14 Jun 2005
--On June 14, 2005 10:44:33 AM +0200 Hartmaier Alexander 
<Alexander.Hartmaier@xxxxxxxxx.xx> wrote:

>> If you're trying to update the object in hand, you should be able to
>> just
>> undef it and then retrieve it again.  If there are other copies in scope
>> elsewhere, you may need to disable the object index or explicitly remove
>> the object.
>>
>> Alternately, you could write an after_set_foo trigger that explicitly
>> refresh the columns in question.  I'm a little surprised that this
>> didn't
>> happen automagically, since CDBI clears out columns after writing to the
>> DB
>> to account for this case.  Are the columns part of the object's primary
>> key?
>>
>> --
>> Regards,
>> Charles Bailey  < bailey _at_ newman _dot_ upenn _dot_ edu >
>> Newman Center at the University of Pennsylvania
>
> I don't update the datetime fields and therefore they don't get
> automagically dropped and fetched from the db. They get updated by oracle
> triggers.
> I would be ok for me to tell cdbi to drop those fields too.
> Maybe a '$obj->reretrieve(@fields)' method would be useful. If to
> fieldnames are given the whole object is fetched again from the db or
> only the fields given.

OK, I understand; I hadn't been thinking broadly enough.  I'd recomment an 
after_update trigger (perhaps in your base class), that deletes these 
attributes from the object.  In essence, your class knows about some 
behind-the-scenes activity in your database that vanilla CDBI doesn't, so 
it should give CDBI a behind-the-scenes hint that'll allow the user to see 
the correct values without any extra work.

--
Regards,
Charles Bailey  < bailey _at_ newman _dot_ upenn _dot_ edu >
Newman Center at the University of Pennsylvania

force re-retrieve from database
Hartmaier Alexander 14:35 on 13 Jun 2005

Re: force re-retrieve from database
Charles Bailey 18:55 on 13 Jun 2005

Re: force re-retrieve from database
Hartmaier Alexander 08:44 on 14 Jun 2005

Re: force re-retrieve from database
Charles Bailey 13:47 on 14 Jun 2005

Re: force re-retrieve from database
Hartmaier Alexander 14:48 on 14 Jun 2005

Re: force re-retrieve from database
Charles Bailey 15:03 on 14 Jun 2005

RE: force re-retrieve from database
Zhuang Li 17:28 on 14 Jun 2005

Re: force re-retrieve from database
Hartmaier Alexander 08:44 on 15 Jun 2005

Generated at 16:37 on 28 Jul 2005 by mariachi v0.52