Is there general consensus that the way sorting _should_ work is that null is 
considered to be less-than non-null?

Dave

On Jan 8, 2010, at 2:42 PM, Chuck Hill wrote:

> I'd guess that few of us use Oracle.  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 protected])
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com
>>>>> 
>>>>> This email sent to [email protected]
>>>> 
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
>>> 
>>> This email sent to [email protected]
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>> 
>> This email sent to [email protected]
> 
> -- 
> 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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to