* [Dbix-class] Re: how to specify current timestamps in a ->search operation in DBIx::Class?

Tom Hukins tom at eborcom.com
Thu Jun 25 10:54:07 GMT 2009


On Thu, Jun 25, 2009 at 08:13:07PM +1000, kakimoto at tpg.com.au wrote:
> Something like this, " ->search({'created_time' => { '>=', '2006-06-01
> 00:00:00' } })" has worked well for me!

But in your original question you asked:

> > I have looked through SQL::Abstract and well, got stuck as I don't know
> > how to specify "NOW()".

If you trace the search() query with 'created_time' you wrote above,
you'll see it includes "2006-06-01 00:00:00" in the SQL, not "NOW()":
http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Manual/Troubleshooting.pod#Tracing_SQL

You want to pass search() a scalar reference to the string 'NOW()' as
described in the first link I sent.

Tom



More information about the DBIx-Class mailing list