Discussion:
EOQualifier, contains, and a pair of relationships
Ondřej Čada
2011-08-15 18:36:35 UTC
Permalink
Hello there,

possibly I do something wrong, but can't see what -- any help please?

I need to filter by a presence of another object in a two-level N:1/M:N relationship. Means that an enterprise object X should be displayed in the DG iff its relToOne leads to any Y whose relToMany contains Z.

Well, what I do is

EOQualifier.qualifierWithQualifierFormat("relToOne.relToMany contains %@",new NSArray(Z));

is that conceptually right?

Anyway it does generate _almost_ proper SQL; alas, in one place there's a LIKE instead of =, namely (cleaned up from the unimportant stuff)

SELECT
t0.C_CREATION_DATE, ..., t0.C_UID FROM T_AUDIT AS t0,
T_USER_GROUP_USER AS T2,
T_USER_GROUP AS T3,
T_USER AS T1
WHERE (T3.C_UID LIKE 1000004) AND (T1.C_UID=T2.C_USER_ID) AND (T2.C_GROUP_ID=T3.C_UID) AND (t0.C_CREATOR_ID=T1.C_UID);

Any idea what do I do wrong and what causes the nonsense LIKE there? Had there be a = instead, it would work like a charm.

Or -- I admit I am no SQL guru -- should the LIKE work and it is a fault of my database (FrontBase 4.4.10) that it chokes over the thing?

And most important, any idea how to fix the problem?

Thanks a lot!
---
Ondra Čada
OCSoftware: ***@ocs.cz http://www.ocs.cz
private ***@ocs.cz http://www.ocs.cz/oc
Chuck Hill
2011-08-15 18:54:26 UTC
Permalink
Hi Ondra,

I don't think that you can do this using qualifierWithQualifierFormat. Wonder (ERXExtensions) and Houdah frameworks have additional qualifiers. You should be able to get the select that you want using those.


Chuck
Post by Ondřej Čada
Hello there,
possibly I do something wrong, but can't see what -- any help please?
I need to filter by a presence of another object in a two-level N:1/M:N relationship. Means that an enterprise object X should be displayed in the DG iff its relToOne leads to any Y whose relToMany contains Z.
Well, what I do is
is that conceptually right?
Anyway it does generate _almost_ proper SQL; alas, in one place there's a LIKE instead of =, namely (cleaned up from the unimportant stuff)
SELECT
t0.C_CREATION_DATE, ..., t0.C_UID FROM T_AUDIT AS t0,
T_USER_GROUP_USER AS T2,
T_USER_GROUP AS T3,
T_USER AS T1
WHERE (T3.C_UID LIKE 1000004) AND (T1.C_UID=T2.C_USER_ID) AND (T2.C_GROUP_ID=T3.C_UID) AND (t0.C_CREATOR_ID=T1.C_UID);
Any idea what do I do wrong and what causes the nonsense LIKE there? Had there be a = instead, it would work like a charm.
Or -- I admit I am no SQL guru -- should the LIKE work and it is a fault of my database (FrontBase 4.4.10) that it chokes over the thing?
And most important, any idea how to fix the problem?
Thanks a lot!
---
Ondra Čada
_______________________________________________
WebObjects-dev mailing list
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Pierre Gilquin
2011-08-16 07:33:15 UTC
Permalink
Not a qualifier, but you can get the raw data from any sql using :
NSArray rawRows= EOUtilities.rawRowsForSQL(ec, "Your model", "SELECT t0.C_CREATION_DATE, ..., ");

Pierre
----- Original Message -----
From: Chuck Hill
To: Ondřej Čada
Cc: WebObjects Dev Dev
Sent: Monday, August 15, 2011 8:54 PM
Subject: Re: EOQualifier, contains, and a pair of relationships


Hi Ondra,

I don't think that you can do this using qualifierWithQualifierFormat. Wonder (ERXExtensions) and Houdah frameworks
have additional qualifiers. You should be able to get the select that you want using those.


Chuck
Post by Ondřej Čada
Hello there,
possibly I do something wrong, but can't see what -- any help please?
I need to filter by a presence of another object in a two-level N:1/M:N relationship. Means that an enterprise object
X should be displayed in the DG iff its relToOne leads to any Y whose relToMany contains Z.
Well, what I do is
is that conceptually right?
Anyway it does generate _almost_ proper SQL; alas, in one place there's a LIKE instead of =, namely (cleaned up from
the unimportant stuff)
SELECT
t0.C_CREATION_DATE, ..., t0.C_UID FROM T_AUDIT AS t0,
T_USER_GROUP_USER AS T2,
T_USER_GROUP AS T3,
T_USER AS T1
WHERE (T3.C_UID LIKE 1000004) AND (T1.C_UID=T2.C_USER_ID) AND (T2.C_GROUP_ID=T3.C_UID) AND (t0.C_CREATOR_ID=T1.C_UID);
Any idea what do I do wrong and what causes the nonsense LIKE there? Had there be a = instead, it would work like a
charm.
Or -- I admit I am no SQL guru -- should the LIKE work and it is a fault of my database (FrontBase 4.4.10) that it
chokes over the thing?
And most important, any idea how to fix the problem?
Thanks a lot!
---
Ondra Čada
_______________________________________________
WebObjects-dev mailing list
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to
solve specific problems.
http://www.global-village.net/products/practical_webobjects
Loading...