what about creating a 'View' in the database. The 'view' could have a date prior to any other date (01-01-1000).
the original table remains intact, and if you need to write, you can have rules that redirect the write to the original table. JM2C Ted > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 19 Jul 2012 08:02:17 +0200 > From: ALEXANDRE Grégoire <[email protected]> > To: Farrukh Ijaz <[email protected]> > Cc: "[email protected] > Dev Apple" > <[email protected]> > Subject: Re: EOSortOrdering first null > Message-ID: <[email protected]> > Content-Type: text/plain; charset="iso-8859-1"; > Format="flowed" > > hi, > thanks for your reply, but i don't have all my object > because i use > objectInRange function so when i execute my > fetchSpecification i just > have the first ten element so i need to have "last null" sql > function > execute by my fetchSpecification. > > Le 18/07/12 22:00, Farrukh Ijaz a écrit : > > 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] > > > <mailto:[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] > <mailto:[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/archive%40mail-archive.com This email sent to [email protected]
