On 3/3/07, Randal L. Schwartz <[email protected]> wrote:
> Well, I did it. I peered under the hood, because I needed this:
>
> AND
> (f_name || ' ' || l_name) LIKE ?
> AND
>
> And I didn't see any way to do that in RDBO::QueryBuilder. Except in
> the source code, where I figured out I could use:
>
> some_valid_column => { field => "(f_name || ' ' || l_name)", like => $val },
>
> So, I presume it's in the source code because you also needed to do it, but it
> scares me that it's not documented. Will it stay? Will something better
> replace it? Should I have done this another way? And what about Naomi?
The documented way to do it is to use the "clauses" parameter, in
which case you have to quote and inline the value rather than using
placeholders:
$objs =
My::Foo::Manager->get_whatevers(...
clauses =>
[
'(f_name || ' ' || l_name) LIKE ' . $db->dbh->quote($val)
],
...);
(If that's too ugly, you can always pre-process the value of the query
param in a custom-written get_whatevers() and generate the clause
automatically before passing stuff on to get_objects().)
The "field" thing is an earlier attempt to support the stuff described here:
http://www.mail-archive.com/[email protected]/msg00710.html
It can be (ab)used to do some other things, but I can't guarantee that
it will stay around forever.
-John
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object