[Dbix-class] Rows

Erik Colson eco at ecocode.net
Fri Jul 27 13:48:20 GMT 2012


Patrick Meidl <patrick at pantheon.at> writes:

> On Fri, Jul 27 2012, Erik Colson <eco at ecocode.net> wrote:
>
>> How can I check if the contents of 2 Row Objects are identical ?  I'm
>> used to create a function to check the individual fields, but maybe
>> DBIx::Class is smarter on this ?
>
> in ORM, identity is usually defined by having the same primary key. if
> you maniplulate your objects after fetching them from the database,
> though, you will have to do dirty checking (i.e. check if any columns
> were changed in the detached object). you can use e.g. $row->is_changed
> for this, see
>
> http://search.cpan.org/~frew/DBIx-Class-0.08198/lib/DBIx/Class/Row.pm#is_changed
>
> HTH
>
>     patrick

Hi Patrick,

That is one thing I want to check.. Thank you for the link !

I also ant to now if somenone else did change anything in the row as
saved in the database. I can achieve this by adding a serial field which
increases at every update, but hence, maybe DBIx::Class has something
for this too ;)

--
erik



More information about the DBIx-Class mailing list