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

Ronald J Kimball rkimball+dbixclass at pangeamedia.com
Wed Aug 8 16:14:47 GMT 2007


Paul Makepeace wrote:
> 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? :-)

"Return value will be true if the update succeeded or false if no
records were updated; exact type of success value is storage-dependent."

The exact type of success value is storage dependent, hence,
$storage_rv.  For example, one storage engine might return 1; another
might return the number of rows updated.

Ronald




More information about the DBIx-Class mailing list