Re: When NSArray is not an Array
Re: When NSArray is not an Array
- Subject: Re: When NSArray is not an Array
- From: Robert Walker <email@hidden>
- Date: Thu, 11 Jan 2007 15:28:15 -0500
Gordon,
There is a very simple explanation for this; SQL SELECT returns an
unordered list of rows from a database. It's really that simple.
When ORDER BY is used the database will return a post fetch sorting
of the result set. If a database were to reorder rows every time
they needed to insert a record their performance would be horrible.
However, Core Data provides the mechanisms for sorting result sets in
a similar fashion to SQL.
NSArray is an ordered array, but Core Data uses NSSets (unordered
sets) for to-many relationships just like SQL SELECT effectively does.
On Jan 11, 2007, at 3:06 PM, Gordon Apple wrote:
Caution, rant ahead:
What is it with database designers and specifically Core Data
that they
don't understand the concept of an array, the definition of which
is an
ORDERED set? NSArray (NSMutableArray) are arrays, not sets -- that
is,
until you try to use Core Data. Like any typical relational
database, the
concept of order goes totally out the window.
Our application has many layers of lists (i.e., ordered sets,
arrays,
whatever): Lists of sessions which are lists of segments which are
lists of
screens which are lists of layers which are list of draw objects
which are
lists of attributes which could be lists of grouped objects, etc.
ORDER is
all important.
The only way around this seems to be to add an integer index
field that
has to be re-sequenced every time there is an edit that affects the
list.
It's a pain just to re-do what NSMutableArray and NSArrayController
are
supposed to do already. A search of the cocoa-dev list showed a
lot of
chatter on this subject -- too much to peruse. Has there been any
progress
on ordered list with CoreData? Any other workarounds?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
--
Robert Walker
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden