[Dbix-class] Detecting changes after ->update(\%) ?

Paul Makepeace paulm at paulm.com
Tue Aug 7 23:30:06 GMT 2007


I had a look in various places (cookbook, faq, ::resultset) and
couldn't find whether there's a way to see if any SQL would be
generated due to a call to update().

  my $rv = $obj->update(\%stuff);
  $messages->($rv->XXX ? "updated" : "unchanged");

The docs* contain an enigmatic reference to "storage_rv" (that doesn't
appear anywhere in the doc) and "true if the update succeeded or false
if no records were updated". Which is it, success or $storage_rv? :-)

Version 0.8002

Thanks -
Paul

* http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm

PS Errors installing 0.8004,

t/33storage_reconnect......................ok 1/5DBD::SQLite::db
prepare_cached warning: attempt to prepare on inactive database
handle(0) at dbdimp.c line 249 [for Statement "SELECT me.artistid,
me.name FROM artist me ORDER BY name DESC"] at
/var/tmp/cpan/build/DBIx-Class-0.08004/blib/lib/DBIx/Class/Storage/DBI.pm
line 1095.
DBD::SQLite::db prepare_cached warning: attempt to prepare on inactive
database handle(0) at dbdimp.c line 249 [for Statement "SELECT
me.artistid, me.name FROM artist me ORDER BY name DESC"] at
/var/tmp/cpan/build/DBIx-Class-0.08004/blib/lib/DBIx/Class/Storage/DBI.pm
line 1095.
t/33storage_reconnect......................NOK 4/5
#   Failed test 'The operation succedded'
#   in t/33storage_reconnect.t at line 57.
t/33storage_reconnect......................NOK 5/5
#   Failed test 'Three artists returned'
#   in t/33storage_reconnect.t at line 58.
#          got: 0
#     expected: 3
# Looks like you failed 2 tests of 5.
t/33storage_reconnect......................dubious
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 4-5
        Failed 2/5 tests, 60.00% okay
t/34exception_action.......................ok

If this isn't already known I can provide some more info. It's late now tho :)

P



More information about the DBIx-Class mailing list