I don't think the API supports this function as it appears to be a vendor
specific feature. There are two approaches and you can adapt whatever you like:
Approach 1: This will make 2 db calls at minimum and will have more memory
consumption.
NSArray<MyTable> objects1 = // objects where myDate() is null;
NSArray<MyTable> objects2 = // objects where myDate() is not null but sorted as
you like...
NSArray<MyTable> objects = // append objects1 and objects2
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.
Case 1: descs()
NSArray<MyTable> objects = // sorted objects either using descs() so nulls are
already at the end so no worries
Case 2: ascs()
NSArray<MyTable> objects = // sorted objects using ascs() so nulls are in the
beginning
MyTable object = objects.get(objects.count() / 2); // to check if the
if(object.myDate() != null) {
Enumeration<MyTable> e = objects.objectEnumerator();
while(e.hasMoreElements()) {
object = e.nextElement();
if(object.myDate() != null) break;
objects.remove(object);
objects.add(object);
}
} else {
Enumeration<MyTable> e = objects.reverseObjectEnumerator();
while(e.hasMoreElements()) {
object = e.nextElement();
if(object.myDate() == null) break;
objects.remove(object);
objects.add(0, object);
}
}
// After the above code execution, the nulls are pushed to the end in minimum
execution time.
Farrukh
On 2012-07-18, at 6:06 PM, ALEXANDRE Grégoire <[email protected]> wrote:
> Yes but i need
>
> MyTable.MY_DATE.descs() // will put nulls at the end
> MyTable.MY_DATE.ascs() // will put nulls at the end
>
> => "nulls last" in sql and i used ERXEOControlUtilities.ObjectInRange...
>
> Le 18/07/12 16:14, Farrukh Ijaz a écrit :
>> Hi,
>>
>> Should be something like:
>>
>> MyTable.MY_DATE.descs() // will put nulls at the end
>> MyTable.MY_DATE.ascs() // will put nulls at the first
>>
>> Farrukh
>>
>> On 2012-07-18, at 2:02 PM, ALEXANDRE Grégoire <[email protected]>
>> wrote:
>>
>>> hi,
>>> i need to create fecth specification with my null element at the end of the
>>> response
>>>
>>> for example i need tu create this;
>>>
>>> select * from my_table order by my_date nulls first;
>>>
>>> thanks for reply.
>>> --
>>> Grégoire ALEXANDRE
>>> Développeur
>>> GIP Sym@ris
>>> Pavillon 1
>>> 27 rue du 4ème RSM B.P. 29
>>> F-68250 ROUFFACH
>>> tel : 0389787406
>>> Courriel : [email protected]
>>> Web : http://www.symaris.com
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
>>>
>>> This email sent to [email protected]
>>
>
>
> --
> Grégoire ALEXANDRE
> Développeur
> GIP Sym@ris
> Pavillon 1
> 27 rue du 4ème RSM B.P. 29
> F-68250 ROUFFACH
> tel : 0389787406
> Courriel : [email protected]
> Web : http://www.symaris.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]