[CDBI] simplest way to do WHERE stuff

Bill Moseley moseley at hank.org
Tue Nov 29 23:33:28 GMT 2005


On Tue, Nov 29, 2005 at 05:26:58PM -0600, Eamon Daly wrote:
> Quick question: I'm doing a lot of stuff like this with
> Class::DBI::AbstractSearch:
> 
> @i = My::Foo->search_where
>  ({ '-or' => [ 'foo' => 'x', 'bar' => 'x' ] });

My guess is you do this:

        $criteria->{-nest} = [ 
                foo => 'x',
                bar => 'y',
        ];

Here's what I do when searching in two fields:

        $criteria->{-nest} = [ 
                first_name => { -ilike => "%$search%" },
                last_name  => { -ilike => "%$search%" },
        ];

-- 
Bill Moseley
moseley at hank.org





More information about the ClassDBI mailing list