On Nov 21, 2006, at 5:18 PM, Daniele Corti wrote:
Hi Fabrice,
2006/11/21, Fabrice Pipart <[EMAIL PROTECTED]>:
Hi all !
I have been suprised by the behavior of the EOQualifier and I
wonder if it's a bug or just a misunderstanding on my part.
Let's take a simple example (mine was far too complicated to show
here) :
Let's say we have the following EO relationships :
Person <--> Employer <--> Company
Person <--> Employee <--> Company
fine, but I would prefer that you use the same name in the sql
code ...
Let's suppose I want to fetch the PERSONs that are employers and
employees in a given company
Naturally I had a qualifier like this one :
(employee.company = %@) OR (employer.company = %@)
I had troubles with this and then I activated the EOAdaptorDebug
From what I found there, EOF generates the following :
SELECT ... FROM PERSON T0, EMPLOYEE T1, EMPLOYER T2, COMPANY T3
WHERE (T1.COMPANY_FID = ? OR T2.COMPANY_FID = ?) AND T0.ID =
T1.PERSON_FID AND T0.ID = T2.PERSON_FID
What is between brackets makes sense obviously and then EOF adds
after ANDs all that is necessary to make the relationships right?
But in that case I am looking for someone that is an employer AND
an employee ???
I don't think so... T0.ID = T1.PERSON_FID and T0.ID =
T2.PERSON_FID
are just a check for consistency, I mean the system must check
that person are related with Employee and Employer. and it must be
true with AND logic...
It's a bit hard to explane in english...
I might be wrong because I hate SQL but...
I want a person to be an EMPLOYER or an EMPLOYEE, not both
(employee.company = %@) OR (employer.company = %@)
I mean if Bob is an EMPLOYEE (and not an EMPLOYER), how can it
match the requirement
T0.ID = T1.PERSON_FID and T0.ID = T2.PERSON_FID
?
In my personal problem, if I have an object that match
(employer.company = %@)
but none that matches (employee.company = %@)
If I just leave ( employer.company = %@) in the qualifier I find
the object.
If I leave both I don't find it... how come?
mmm...
mmmmmm...
mmmmmmmmmm...
well, that's a strange task... well, it's not the first time I saw
some of absurde using EOQualifier...
listen, try to use EOOrQualifier, create two qualifier :
(employee.company = %@) , (employer.company = %@)
then you create an EOOrQualifier with those. Maybe, it's a problem
with the creation.
I tried, it did not solve anything :-(
Do we agree that in the case I presented, the SQL generated does an
AND while I ask for a OR because of the badly placed consistency checks?
Can you post the code you are using?
I sent it to you off list
bye
--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]
www.easyshadow.com
International Corporate Consulting
Palais de la Scala
1 avenue Henri Dunant
Suite 1155
MC - 98000 Monaco
Skype: fabrice.pipart
Tel. +377 97 98 21 04 (direct)
Fax. +377 97 70 88 07
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]