Re: EOSortOrdering first null
Re: EOSortOrdering first null
- Subject: Re: EOSortOrdering first null
- From: Farrukh Ijaz <email@hidden>
- Date: Thu, 19 Jul 2012 09:57:19 +0300
On 2012-07-19, at 9:39 AM, Maik Musall < email@hidden> wrote:
Approach 2: This will make 1 db call, uses less memory. It's quite simple and easy to understand. The whole idea is to push the nulls at the end with minimum instructions.
It uses less memory, but still does the null filtering in Java. I think the question was how to delegate that task to the database.
I agree, that's why suggested to check median to find whether nulls are more or less and use reverse enumeration if needed and this null repositioning is much faster with worst case O(n/2) which is linear but still faster if records are in millions as repositioning will be done of at most half of the data size and basically is memory pointer relocation.
Yes the question was about delegating to database but my opinion is this is vendor specific feature and perhaps not available from WO / Wonder API directly. Enumeration<MyTable> e = objects.objectEnumerator(); while(e.hasMoreElements()) { object = e.nextElement();
}
Java side note: if you can't use a Java 5 foreach loop and still have to use Enumeration, you can at least do it in a for loop so that the reference to the Enumeration object is contained inside the loop: for( Enumeration<MyTable> e = objects.objectEnumerator(); e.hasMoreElements(); ) { object = e.nextElement(); }
In regard to the original question: I'm not sure what you're up to, Grégoire. If you just don't want to deal with the null columns, include that in the fetchspec:
new EOKeyValueQualifier( key, EOQualifier.QualifierOperatorNotEqual, NSKeyValueCoding.NullValue );
That's plain WO. Perhaps there's even a shorter way using some Wonder stuff I don't know about yet.
Maik
|
_______________________________________________
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