Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EOSQLQualifier, more than one table in select



[demime could not interpret encoding binary - treating as plain text]
In raw SQL, you can easily include columns from more than one table in a
SELECT query. 

With EOF, you ordinarily don't want to do that, you ordinarily are
fetching a particular entity, and you want only the columns of the table
corresponding to that entity. One way to get other table's columns in
your entity is with flattened attributes, of course. 

But with raw rows, you don't need to add any flattened attributes to your 
model. You can include a 'raw row key path' that traverses relationships, 
for instance 'department.name' if the primary entity of your fetch is
Employee.  And exactly the right thing just happens, great. So EOF can
sometimes do this with a raw row fetch.

My problem is that, for reasons I won't go into here, I need to set up a
fetch using the EOSQLQualifier API.  And the only way to specify which
columns should be in the fetch seems to be to pass in an array of
EOAttributes, not a keypath.  [See prepareSelectExpressionWithAttributes
and/or assembleSelectStatementWithAttributes---both want an array of
EOAttributes].  And it assumes all those EOAttributes are in the
'primary' entity, if you pass in an EOAttribute from some other entity,
it generates bad SQL.  But there must be SOME way to do this----calling
setRawRowKeyPaths() on an EOFetchSpecification, using key paths that
traverse relationships, well, that WORKS, and it must be using
EOSQLExpression to do it's thing...  

But I can't figure out how to make EOSQLExpression do that. Anyone
especially wise in the ways of EOSQLExpression and related classes, who
can help me out?

--Jonathan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.