Hi Jerry
On Nov 21, 2006, at 5:06 PM, Jerry W. Walker wrote:
Hi, Fabrice,
For a given company record, the SQL logic is looking for a Person,
the Person's corresponding Employee record and the Person's
corresponding Employer record such that either the Employer's
corresponding company record or the Employee's corresponding
Company record is that given Company record.
I absolutely agree that this is what the SQL says.
Though I asked : (employee.company = %@) OR (employer.company = %@)
I am sorry, in my initial message I made it unclear. But that's a OR
that I want, not and AND
So the SQL should say :
For a given company record, the SQL logic is looking for a Person,
the Person's corresponding Employee record or the Person's
corresponding Employer record such that either the Employer's
corresponding company record or the Employee's corresponding
Company record is that given Company record.
Right?
In SQL terms, this statement:
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
says to return a selected set of 4 records (a Person, an Employer,
an Employee and a Company) such that for a given match between
either an Employer and a Company OR an Employee and a Company, the
Employer matches the same person who is matched by the Employee.
The last match is my problem right?
Is it me that asked for that in the Qualifier or that's a mistake of
EOF ?
So for a match, we have a Company matching an Employer matching a
Person matching an Employee (which may or may not match the
company), OR we have a Company matching an Employee matching a
Person matching an Employer (which may or may not match a company).
I think that's the logic you're requesting. It may not be the
answer you desire, but I think it's the answer you specified.
I agree that's what SQL asks... but was it what I meant with the
qualifier ?
If it is (or even if it is not), how could I ask for it properly?
The only solution I see would be to make two fetches... which does
not seem the best solution :-(
Regards
Fabrice
Regards,
Jerry
On Nov 21, 2006, at 10:10 AM, Fabrice Pipart wrote:
On Nov 21, 2006, at 3:58 PM, Daniele Corti wrote:
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?
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 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/jerrywwalker%
40gmail.com
This email sent to [EMAIL PROTECTED]
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
[EMAIL PROTECTED]
203 278-4085 office
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]