• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Efficient qualifier for to-many relationships?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient qualifier for to-many relationships?


  • Subject: Re: Efficient qualifier for to-many relationships?
  • From: Ken Anderson <email@hidden>
  • Date: Fri, 17 Feb 2006 17:18:55 -0500

Ondra,

In this case, I would use EOSQLQualifier.  Something like:

exists (select 1 from reltable where t0.primaryKey = reltable.foreignKey)

Using t0 assumes standard EOF SQL generation and the target table should be the target of the query (not a relationship from something else).

You can then mix the EOSQLQualifier in with other qualifiers to further qualify the result if necessary.

Ken

On Feb 17, 2006, at 5:05 PM, Ondra Cada wrote:

Hello,

this, I am afraid, is kind of EOF 101; still I haven't been able to find the answer on wodeveloper... thus, please, forgive the following question.

I need an efficient qualifier to fetch all objects from entity A, whose to-many relationship to another entity is non-empty (i.e., there is at least one object in the relationship). A programming solution like

NSMutableArray *ma=[NSMutableArray array];
for (id o,en=[[editingContext objectsForEntityNamed:@"A"] objectEnumerator];o=[en nextObject];)
if ([[o theRelationship] count]>0) [ma addObject:o];


is, with the number of objects, out of question for it is too inefficient.

Although from easthetical reasons I would like to use as high API level as possible, in worst, in this project it might be an EOSQLQualifier and the SQL might be MS-SQL-tailored, or even rawRowsWithSQL:modelNamed:. Alas, I am no SQL guru, and don't know how to create appropriate SQL expression.

Since the project is WO4.5-based, the ERXToManyQualifier of Project Wonder does not really help (unless I get all the sources and turn them to Objective-C myself).

Grateful for any help,
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


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
  • Follow-Ups:
    • Re: Efficient qualifier for to-many relationships?
      • From: Art Isbell <email@hidden>
References: 
 >Efficient qualifier for to-many relationships? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Help with: org.apache.xmlrpc.XmlRpcException: out of threads
  • Next by Date: WOXMLDecoder and mapping files
  • Previous by thread: Efficient qualifier for to-many relationships?
  • Next by thread: Re: Efficient qualifier for to-many relationships?
  • Index(es):
    • Date
    • Thread