Re: [CDBI] where clause in AbstractSearch
Rhesa Rozendaal <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
rahed h wrote:
> Hello,
>
> I can retrieve records from sqlite this way:
> select id,col1 from mytable where date(mydate) = date('now');
>
> This will return records as of today.
>
> With Class::DBI I tried:
> @records = Mymodule->search_where ('date(mydate)' => { '=',
> "date('now')" });
>
> but no records found. If I supply value as a string such as 2006-12-13,
> it's ok.
>
> What's the right syntax like?
Since CDBI::AbstractSearch uses SQL::Abstract, you can look at the
documentation for the latter. You'll see that supplying a reference to a
string will pass that string unaltered:
search_where( q{date(mydate)} => \ q{ = date('now') } );
HTH,
Rhesa