On 8/7/06, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > is there any way to do: > > query=> [ > first_name=> { lower=> 'john' }, > last_name=> { upper=> 'DOE' }, > ] > > becomes: > > SELECT t1.name FROM useraccount t1 WHERE lower(t1.first_name)= ? > AND upper(t1.last_name)= ?
Right now you have a few choices, none of which are really ideal. * Use ILIKE (as you mentioned earlier). * Use the "clauses" parameter to add literal SQL to the WHERE clause: My::Manager->get_whatever(... clauses => [ "lower(t1.first_name) = 'foobar'" ]); This is currently the only documented, fully-supported option for getting a LOWER() call around the left-=hand side. It requires you to build the literal SQL yourself, quoting the value (using $dbh->quote() or whatever) and inlining it manually. There is, however, other (currently) undocumented option... * Use the undocumented "field" modifier: My::Manager->get_whatever(... query => [ first_name => { field => 'LOWER(t1.first_name)', eq => 'john' }, ... ] ...); # Produces SQL like this: # SELECT ... WHERE LOWER(t1.first_name) = ? # with "john" bound on execute() I've never really been happy with this little escape-hatch feature, which is why it's undocumented, and I may remove the feature at some point in the future. But it works now. Does anyone have any ideas for a proper query interface for this type of thing? -John ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object