[Dbix-class] Getting old column values when overriding update?

Jess Robinson castaway at desert-island.demon.co.uk
Sun Dec 10 02:18:15 GMT 2006



On Fri, 8 Dec 2006, John Napiorkowski wrote:

> Hi,
>
> I'm trying to move away from triggers for some things
> so that I can write code that has a chance of running
> on more than one database.  However one thing I'm
> having trouble emulating is how on most database with
> update triggers you can get the old values for the
> updating row.  Usually it's a syntax like OLD.name,
> etc.  However I don't see a simple way to do that when
> I override the update method in my DBIx::Class
> packages.  Does anyone know if this something I'll
> need to burn another query on, or am I just not
> reading the documentation correctly?

The old values aren't stored when you change them on your objects. Instead 
of using a query though, I suggest you override store_column and keep 
track of the previous values yourself.

Jess




More information about the Dbix-class mailing list