Re: Custom ORDER BY
Re: Custom ORDER BY
- Subject: Re: Custom ORDER BY
- From: Jonathan Rochkind <email@hidden>
- Date: Mon, 13 Jan 2003 17:43:30 -0600
This may or may not work, but you could try it: define a 'fake' attribute
in the EO whose external column name is defined as "NLSSORT(myColumn,
'NLS_SORT = FRENCH')" Do _not_ make it a class property. Do include an
EOSortOrdering that references the name of this 'fake' attribute in the
fetch specification.
I can think of a number of problems that might keep this from working:
* EOF might insist on generating an ORDER BY that have 'ASC' on the
end, which will mess you up.
* The 'fake' attribute might mess EOF up in other ways. Although it
shouldn't if it's not a class property, and not used for locking.
But it might work. In general, creating a 'fake' non-class property
attribute is a technique that is sometimes useful for 'tricking' EOF into
generating unusual SQL.
Your basic problem here is that that NLSSORT stuff is not, to my knowledge,
part of standard SQL, so EOF doesn't know much about it. Isn't there any
way, instead, to tell your db to always sort using French, instead of
needing it to be included in every SQL query? Although I suppose that
wouldn't work if you want some queries to be according to French, but
others for different languages.
At 12:26 PM 1/13/2003 -1000, Art Isbell wrote:
On Monday, January 13, 2003, at 11:04 AM, Pascal Robert wrote:
In pure SQL, I just have to say:
ORDER BY NLSSORT(myColumn, 'NLS_SORT = FRENCH')
and it works. Now the WO part: when I create a new Fetch Specification
in my EOModel, I go to the "SQL" tab, I choose "Use Raw SQL Expression"
and I put my custom ORDER BY there. But when I save the EOModel,
EOModeler just remove the ORDER BY clause :-/ An EOSQLQualifier just let
me modify the WHERE clause, not the ORDER BY, so I'm lost.
Any other solutions beside using a stored procedure ?
If raw rows are sufficient, see EOUtilities.rawRowsForSQL
If you want to fetch objects into an editing context, see the
method description for EOFetchSpecification's setHints(). The hints
dictionary should contain a key of
EODatabaseContext.CustomQueryExpressionHintKey with a value of the SQL
string for the query. See the "Using a Custom Query" section of the
EODatabaseContext class description for restrictions on the SQL that can
be specified.
Art
http://homepage.mac.com/aisbell/
_______________________________________________
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.
_______________________________________________
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.