Re: ERXBatchingDisplayGroup, Oracle and Sorting Null Values **FIXED**
Re: ERXBatchingDisplayGroup, Oracle and Sorting Null Values **FIXED**
- Subject: Re: ERXBatchingDisplayGroup, Oracle and Sorting Null Values **FIXED**
- From: Chuck Hill <email@hidden>
- Date: Fri, 8 Jan 2010 11:52:49 -0800
On Jan 8, 2010, at 11:47 AM, Pascal Robert wrote:
I'd guess that few of us use Oracle.
Tsétsétsé :
Which database systems does your organization use with WebObjects?
MySQL
46%
Oracle Database
34%
PostgreSQL
30%
FrontBase
25%
Oracle is #2, mister "I know that FB was coming" :-P
How many of those are outside of Apple? :-P
And few of those use ERXBatchingDisplayGroup with a column
containing nulls. IOW, you are just lucky.
Chuck
On Jan 8, 2010, at 10:37 AM, David Avendasora wrote:
Before I submit the patch, am I really the only one to have run
into this with Oracle? Am I missing something fundamental?
Dave
On Jan 8, 2010, at 12:28 PM, David Avendasora wrote:
Hi Mike,
Almost perfect. Following your example, here's what I came up
with: (patch to follow in Jira)
@Override
public void addOrderByAttributeOrdering(EOSortOrdering
sortOrdering) {
super.addOrderByAttributeOrdering(sortOrdering);
if (sortOrdering.selector() ==
EOSortOrdering.CompareCaseInsensitiveDescending
|| sortOrdering.selector() ==
EOSortOrdering.CompareDescending) {
_orderByString().append(" NULLS LAST"); // Oracle's
Default
} else {
_orderByString().append(" NULLS FIRST");
}
}
Dave
On Jan 8, 2010, at 10:36 AM, Mike Schrag wrote:
maybe try something like (completely untested):
public void addOrderByAttributeOrdering(EOSortOrdering
sortOrdering) {
super. addOrderByAttributeOrdering(sortOrdering);
_orderByString().append(" NULLS FIRST");
}
On Jan 8, 2010, at 10:20 AM, David Avendasora wrote:
Hi all,
This has taken me a while to track down, and I just want to
make sure I've figured it out correctly, and if so, what the
possible solutions are.
Oracle sorts null values to the end, so ORDER BY FIRST_NAME
returns:
Anjo
Chunk
Mike
Null
EOSortOrdering sorts null values to the begining, so
NAME.ascs() returns:
Null
Anjo
Chunk
Mike
Which does some really crazy things to ERXBatchingDisplayGroup.
Let's say I have 100 rows in the DG. All the Name attributes
are null, except for those three.
First the DB selects all the records and sorts them with nulls
last, then gets the first 10 ids :
select * from (select NAME, rownum eo_rownum from (SELECT
t0.NAME FROM PEOPLE t0 ORDER BY t0.NAME ASC)) where eo_rownum
between 1 and 10
The results will be: Anjo, Chunk, Mike, null, null, null, null,
null, null, null.
Then EOF sorts the array again, so the DG displays: null, null,
null, null, null, null, null, Anjo, Chunk, Mike and all the
subsequent batches will be full of nulls.
If this interpretation is correct, am I the first to run into
this with Oracle?
I've been digging through the EROraclePlugin, and I figured
adding this to the EROracleExpression class would fix it, but
it doesn't:
@Override
protected void appendItemToOrderByString(String sqlString) {
appendItemToListString(sqlString + " NULLS FIRST",
_orderByString());
}
Anyone have any other suggestions?
Thanks,
Dave
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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
--
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
_______________________________________________
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
----
Pascal Robert
email@hidden
AIM: MacTICanada
Twitter : MacTICanada
LinkedIn : http://www.linkedin.com/in/macti
--
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
_______________________________________________
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