Re: force re-retrieve from database

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

From: Charles Bailey
Subject: Re: force re-retrieve from database
Date: 18:55 on 13 Jun 2005
--On June 13, 2005 4:35:20 PM +0200 Hartmaier Alexander=20
<Alexander.Hartmaier@xxxxxxxxx.xx> wrote:
>
> I change two field of an cdbi object, call ->update on the object and
> then display the data.
>
> In the oracle database I have several triggers that update datetime field
> when some other fields change.
>
> The problem is that those datetime fields get updated by the triggers but
> aren=E2=80=99t reloaded from the db (only the updated fields get =
reloaded).
>
> I=E2=80=99m looking for a way to re-retrieve a whole object from the =
db...
>
>
>
> I=E2=80=99m not sure if =
=E2=80=98$record->remove_from_object_index=E2=80=99 is the right
> thing cause if I understand the docs right this enables to have multiple
> versions of the same object in memory which I don=E2=80=99t want.
>
>
>
> Didn=E2=80=99t find anything else related to this in the docs or the =
wiki...

If you're trying to update the object in hand, you should be able to just=20
undef it and then retrieve it again.  If there are other copies in scope=20
elsewhere, you may need to disable the object index or explicitly remove=20
the object.

Alternately, you could write an after_set_foo trigger that explicitly=20
refresh the columns in question.  I'm a little surprised that this didn't=20
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

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