[Dbix-class] update with result of a function

Cedric Boudin cedric at dreamgnu.com
Fri Dec 7 09:38:42 GMT 2007


Dear Members of the list,

I want to do this on a table:

update table set column=function(column) where fk=some_value;

I'm generalising here, in fact in this first case function is "not" and
column type is boolean.

I tried :
a) something inspired of "Using database functions or stored procedures"
$rs->search(..)
b)creating a "customized" query like "Arbitrary SQL through a custom
ResultSource"

both without success

I found:
a description of something equivalent in the mailing list archives:
http://www.grokbase.com/topic/2006/05/23/dbix-class-update-or-insert-from-hash-reference/PJ2q4Sgq4N1UNmM9l7V3Gswz-Mg

where you dig into the resultset to get a $dbh, and then make your query
the good all DBI way.

As TIMTOWTDI, is there some more straightforward way to do it.

cheers

cedric




More information about the DBIx-Class mailing list