Re: force re-retrieve from database
[prev]
[thread]
[next]
[Date index for 2005/06/14]
--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