[Dbix-class] mysql date_sub function in DBIx catalyst call

daniel at caret.cam.ac.uk daniel at caret.cam.ac.uk
Thu Jan 18 17:05:03 GMT 2007



Hello,

Apologies for being a newbie, but could someone please help me with the correct
syntax for this mysql query:

select * from sessions where id='foo' and created > DATE_SUB(NOW(), INTERVAL 1
HOUR );

using DBIx in catalyst. I've tried such things as:

my $rs = $c->model('SmsDB::Session')->search({ -and => [
  { id => 'foo' },
  { created => { '<' => { 'DATETIME()' => { 'NOW()', 'INTERVAL 1 HOUR' } } } }
]})

and 1001 subtle variations thereof, but really I haven't a clue and would really
appreciate some help please!

Many thanks in advance,

Daniel

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the Dbix-class mailing list