[CDBI] Using scalar functions with AbstractSearch

Rhesa Rozendaal perl at rhesa.com
Thu Feb 2 00:07:13 GMT 2006


Matt S Trout wrote:
> On Thu, Feb 02, 2006 at 12:50:15AM +0100, Rhesa Rozendaal wrote:
>>I've even used something like this in CDBI::Sweet:
>>
>>$class->search({
>>	q{now()} => \q{ between start_date and end_date }
>>});
> 
> 
> Why not just use { -between => [ $start, $end ] } ?
> 

Because in this case "start_date" and "end_date" are columns in the table.
I tried to get a search with several other criteria, and the fixed string 
"start_date < now() and end_date > now()" or something to that effect.
The above way was the first thing I got working in Sweet.

When I need to limit a single column to be between two variables, I definitely 
do use the -between syntax.

Hope that explains,

Rhesa




More information about the ClassDBI mailing list