Re: EOQualifier issue
Re: EOQualifier issue
- Subject: Re: EOQualifier issue
- From: Fabrice Pipart <email@hidden>
- Date: Tue, 21 Nov 2006 16:10:46 +0100
On Nov 21, 2006, at 3:58 PM, Daniele Corti wrote: 2006/11/21, Fabrice Pipart <email@hidden>: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?
I would have prefered to see : WHERE (T1.COMPANY_FID = ? AND T0.ID = T1.PERSON_FID) OR (T2.COMPANY_FID = ? AND T0.ID = T2.PERSON_FID)
Do I make a mistake ???
I think your code should work too, it would be interesting to try it... But, the meaning in this context is the same.
bye, -- Daniele Corti AIM: S0CR4TE5 Messenger: email@hidden
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden