Dear John,
I believe that I have a $spec{require_objects} = ['destaddress', ...] and
this is working otherwise
> push @query, ('destaddress.primecontact' => {like => '%smith%'});
wouldn't work. I know that a single 'or' element makes the 'or' redundant.
I have other things in the 'or' but was trying to keep it simple for my
email. This is the nub of the issue, though:- If I replace the above line
with:
> push @query, ('or' => ['destaddress.primecontact' => {like =>
'%smith%'}]);
I think they should be exactly equivalent but in fact the former works but
the latter gives the error message.
Anyway, your email implies that it should work so I'll have a look with the
debug option on...
thanks,
James.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of John
Siracusa
Sent: 10 January 2008 13:40
To: Rose-DB-Object
Subject: Re: [RDBO] Manager queries with secondary table and "or"
On 1/10/08 8:19 AM, James Masters wrote:
> Have a bit of trouble with a Manager query. Trying to keep it short and
> sweet, I am searching a table "orders" which has a onetoone relationship
> called destaddress. The first 3 queries here work:
>
> push @query, ('custlastname' => {like => '%smith%'});
> push @query, ('destaddress.primecontact' => {like => '%smith%'});
> push @query, (or => ['custlastname' => {like => '%smith%'}]);
>
> but when the subtable query is put in the "OR" array viz:
>
> push @query, ('or' => ['destaddress.primecontact' => {like =>
'%smith%'}]);
>
> it fails with:
>
> Invalid query parameter: destaddress.primecontact at oprosemgord.pl line
991
> at C:/Perl/site/lib/Rose/DB/Object/QueryBuilder.pm line 132
Are you sure that "destaddress" appears in the with_objects or
require_objects lists?
One more thing: remember that "or" and "and" are prefix operators:
or => [ A, B, C ] -> (A OR B OR C)
and => [ A, B, C ] -> (A AND B AND C)
So including just one thing in the "or" list doesn't really do anything:
or => [ 'destaddress.primecontact' => { like => '%smith%' } ]
is just:
or => [ A ]
which becomes:
(A)
which is the same thing as not including the "or" at all and just adding
this directly to the query:
'destaddress.primecontact' => { like => '%smith%' }
-John
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object