objective c - CoreData - "join" rows from the same entity -


i'm quite new core data , want apologise in advance if wil use sql terminology try explain question better. did search net didn't find answer in clean manner. possible core data 'join' 2 rows - @ search time - same entity have unique 'external' id (not 1 provided core data @ insertion time). exaple have 1 table has fields:

unique_id | description      | iso_code  ---------------------------------------- 13        | desc        | code  13        | other stuff | code b  13        | foo         | code c  ---------------------------------------- 16        | fun desc    | code  16        | other stuff | code b  16        | foo bar     | code c 

so every row has same id of 13 or other, want "join" such sets of same id @ fetch time , example sort such joined result sets description example - iso_code code c. display results in table view.

is possible without additional multiple array , dictionary manipulations in memory @ runtime - eg getting 3 x more results combining them reduced filtered collection displayed. or without using 1 entity more , create relations it.

core data not wrapper sqlite. core data not relational database. net result, core data not joins.

core data persistent object graph. can search object graph.

what you'd run nsfetchrequest predicate of unique_id = 13, 3 separate instances of entity , proceed processing there. can specify sort descriptors on request achieve sorting.

you can use nsfetchedresultscontroller automatically wire particular request table, leaving write specific view stuff.

edit: other concerns, core data has quite advanced memory management system objects scale being plain faults (essentially table name + row number if persistent store sqlite), still being faults having information inside core data's cache (sqlite doesn't multithread, core data does, intermediate result caching) or being entirely present in memory (ie, fields attached directly object). core data automatically go store needed transition through states*.

(*) though sqlite weak link in modern application because of c.1995 single-threaded nature; when performance tweaking want compel core data full fetch rather fault automatically because otherwise main thread can end locked on 'background' activity else has sqlite lock. depends on workload , how you've arranged threads or queues though, obviously.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -