Hello Ronald!

In my opinion ist better to fetch the datetime in your model to be database 
function independent and pass that to update and let the database specific 
deflator make what it's best at:

$row->mydate(DateTime->now( time_zone=> 'UTC' ));
$row->update;

or

$row->update(mydate => DateTime->now(time_zone=> 'UTC' ));

What should GREATEST do in your case?

-Alex

-----Original Message-----
From: Ronald J Kimball [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2008 5:03 PM
To: [EMAIL PROTECTED]
Subject: [Dbix-class] SQL Function in update

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

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to