RE: EOQualifier and Fetch Bug?
RE: EOQualifier and Fetch Bug?
- Subject: RE: EOQualifier and Fetch Bug?
- From: "Ruenagel, Frank" <email@hidden>
- Date: Tue, 9 Nov 2004 16:28:58 +0100
any nulls around?
NULL = anything is always false. So if any of your
foreign key relations are optional and there are nulls in
the joined tables , they would act like a filter.
The where-clause may be OR-d. The join-clause is not or-d.
Example:
(1)
select * from submitter where submitter = 'me'
(2)
select * from submitter a, user b where a.submitter = 'me'
and a.userid = b.userid
Now imagine (its an idiotic example) that a.userid is null.
The second query would not return any result, although
there *is* a submitter "me".
This is ugly. In SQL i resolve this with UNION Queries.
And this means: AFAIK, no-go with standard WO-Tools.
Sometimes i perform different fetches and merge the
results in one array manually.
:-(
> -----Original Message-----
> From: James Cicenia [mailto:email@hidden]
> Sent: Tuesday, November 09, 2004 3:29 PM
> To: WebObjects
> Subject: EOQualifier and Fetch Bug?
>
>
> Hello -
>
> I have been trying to get my fetch to work. When I perform
> the fetches
> one at a time
> I can get records. However, when I put them into an OR I
> don't get what
> the individual
> fetches get. Anyone else see a problem like this?
>
> -James
>
> EOQualifier myQualifier1;
> NSMutableArray args1 = new NSMutableArray();
> args1.addObject("projectState.lifeCycleState");
> args1.addObject(pLifeCycle);
> myQualifier1 =
> EOQualifier.qualifierWithQualifierFormat("%@ = %@",
> args1);
>
> EOQualifier myQualifier2;
> NSMutableArray args2 = new NSMutableArray();
> args2.addObject("portfolio");
> args2.addObject(portfolio);
> myQualifier2 =
> EOQualifier.qualifierWithQualifierFormat("%@ = %@",
> args2);
>
> EOQualifier myQualifier3;
> NSMutableArray args3 = new NSMutableArray();
> args3.addObject("rosterMembers.resource.tosuser");
> args3.addObject( this);
> myQualifier3 =
> EOQualifier.qualifierWithQualifierFormat("%@ = %@",
> args3);
>
> EOQualifier myQualifier4;
> NSMutableArray args4 = new NSMutableArray();
> args4.addObject("assignedProjectManager.tosuser");
> args4.addObject( this);
> myQualifier4 =
> EOQualifier.qualifierWithQualifierFormat("%@ = %@",
> args4);
>
> EOQualifier myQualifier5;
> NSMutableArray args5 = new NSMutableArray();
> args5.addObject("sponsor.tosuser");
> args5.addObject( this);
> myQualifier5 =
> EOQualifier.qualifierWithQualifierFormat("%@ = %@",
> args5);
>
> EOQualifier myQualifier6;
> NSMutableArray args6 = new NSMutableArray();
> args6.addObject("submitter.tosuser");
> args6.addObject( this);
> myQualifier6 =
> EOQualifier.qualifierWithQualifierFormat("%@ = %@",
> args6);
>
> EOAndQualifier andQualifier1 =
> new EOAndQualifier(
> new NSArray(
> new Object[] {
> myQualifier1,
> myQualifier2,
> myQualifier3}));
>
> EOAndQualifier andQualifier2 =
> new EOAndQualifier(
> new NSArray(
> new Object[] {
> myQualifier1,
> myQualifier2,
> myQualifier4}));
>
> EOAndQualifier andQualifier3 =
> new EOAndQualifier(
> new NSArray(
> new Object[] {
> myQualifier1,
> myQualifier2,
> myQualifier5}));
>
> EOAndQualifier andQualifier4 =
> new EOAndQualifier(
> new NSArray(
> new Object[] {
> myQualifier1,
> myQualifier2,
> myQualifier6}));
>
> EOOrQualifier orQualifier1 =
> new EOOrQualifier(
> new NSArray(
> new Object[] {
> andQualifier1,
> andQualifier2,
> andQualifier3,
> andQualifier4}));
>
> EOFetchSpecification fs1= new
> EOFetchSpecification("PortfolioProject",andQualifier1,null);
> NSMutableArray results1 = (NSMutableArray)
> this.editingContext().objectsWithFetchSpecification(fs1);
> System.out.println("1 Result count is
> "+results1.count());
>
> EOFetchSpecification fs2= new
> EOFetchSpecification("PortfolioProject",andQualifier2,null);
> NSMutableArray results2 = (NSMutableArray)
> this.editingContext().objectsWithFetchSpecification(fs2);
> System.out.println("2 Result count is
> "+results2.count());
>
> EOFetchSpecification fs3= new
> EOFetchSpecification("PortfolioProject",andQualifier3,null);
> NSMutableArray results3 = (NSMutableArray)
> this.editingContext().objectsWithFetchSpecification(fs3);
> System.out.println("3 Result count is
> "+results3.count());
>
> EOFetchSpecification fs4= new
> EOFetchSpecification("PortfolioProject",andQualifier4,null);
> NSMutableArray results4 = (NSMutableArray)
> this.editingContext().objectsWithFetchSpecification(fs4);
> System.out.println("4 Result count is
> "+results4.count());
>
> EOFetchSpecification fs= new
> EOFetchSpecification("PortfolioProject",andQualifier1,null);
> NSMutableArray results = (NSMutableArray)
> this.editingContext().objectsWithFetchSpecification(fs);
> System.out.println("TOTAL Result count is
> "+results.count());
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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