[Dbix-class] SQL Function in update
Ronald J Kimball
rkimball+dbixclass at pangeamedia.com
Mon Mar 31 16:03:01 BST 2008
Yes, it's another question about using SQL functions in an update. I
know I can pass a reference to a string containing literal SQL, as in:
$row->update({ mydate => \ 'NOW()' });
However, in this case I need to pass arguments to the function, one of
which needs to be quoted. Here's what I'm using right now:
my $date = DateTime->now();
my $until = "GREATEST(paused_until, " .
$schema->storage->dbh->quote("$dt") . ")";
$row->update({ paused_until => \$until });
Ideally, I could do something like this:
$row->update({ paused_until =>
{ GREATEST => [ \ 'paused_until', $dt ] } });
Suggestions?
Ronald
More information about the DBIx-Class
mailing list