Re: Abstract Search question
[prev]
[thread]
[next]
[Date index for 2004/12/22]
Hello again,
It occurred to me that although I can't express A and (B or C) it might be
possible to change the logic but get the same result.
I refreshed my knowledge of boolean algebra and now see that the equivalent of
the above, which _can_ be expressed in SQL::Abstract, is :
(A and B) or (A and C)
That solves my problem. There is a good writeup of boolean algebra on
everything2
(http://www.everything2.com/index.pl?node_id=413665&lastnode_id=520379).
Andy
On Wednesday 22 December 2004 10:16 am, Andrew Hartford wrote:
> On Wednesday 22 December 2004 02:41 am, Peter Speltz wrote:
> > To clarify, i'm talking about being able to write statement like this:
> > my @objs = $class->search_where( { A => 'tom',
> > B => 'huck',
> > C => 'jim' } ,
> > { logic => [ 'AND', 'OR'] } );
> > and this would generate the:
> > WHERE A = ? and (B = ? or C = ?) .
> >
> > So every time you need 'logic' you shift one off if size > 1 or use the
> > one
>
> Thanks for the reply Peter! That would be a nice way to express that. I'm
> going to ping the author on this and see what he says.
>
> I was expecting to be able to use the normal syntax where items in a hash
> are and'ed together, and supply a special string for the key of the nested
> or'ed expression. Like this:
>
> { A => 'tom', NEST => [{B => 'huck'}, {C => 'jim'}] } # NEST is keyword so
> the arrayref isn't interpreted as a modified parameter expression.
>
> Andy
|
(message missing)
|