[CDBI] Using scalar functions with AbstractSearch

Rhesa Rozendaal perl at rhesa.com
Wed Feb 1 23:50:15 GMT 2006


Dylan Vanderhoof wrote:
> Trying to figure out a way to have an arbitrary where clause with
> AbstractSearch/AbstractCount that includes a scalar function (Such as
> NOW()).
> 
> Is there any way to do this?  I haven't been able to find anything in
> the documentation for SQL::Abstract or any of the other associated
> modules that indicates this is possible.

According to the SQL::Abstract docs, you can do this by passing a reference to 
a string:

	some_date => \q{< now()},

I've even used something like this in CDBI::Sweet:

$class->search({
	q{now()} => \q{ between start_date and end_date }
});

HTH,
Rhesa




More information about the ClassDBI mailing list