[DBIx-Class-Devel] UPDATE RETURNING

fREW Schmidt frioux at gmail.com
Mon Jul 15 15:13:11 GMT 2013


I just found out about UPDATE RETURNING (and the various dialects
thereof, of course) and I'm aching to use it in DBIC.  What do you
guys think about something like this?

my @rows = $rs->update({ .... }, { columns => $columns_spec })->all;

It should be able to use select/as too, fwiw.

The main problem I see here is that this critically changes update from
an immediate db hit to a typical lazy resultset.  It might be fine to
call execute immediately either way and then the user can either use
the returned RS or not.  That brings up another issue, that it throws
away the rv, which I certainly leverage in a few places in my app.

The other obvious and safe use case is to add another thing to the column
definitions so that when a user calls $row->update the row object can
have it's guts automatically updated.

--
fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20130715/a7a84fcf/attachment.pgp


More information about the DBIx-Class-Devel mailing list