FROM : I. Savant
DATE : Tue Apr 29 18:31:20 2008
> > My question is: what is the most efficient fetch to pose given that every
> > fetch is IO.
>
> Yes.
Sorry, I thought this was "is this the most efficient" ... Meaning:
mmalc's response of "Execute a fetch for the entity in which you're
interested, and count the returned array." is the most efficient. It
means exactly what it says (a basic fetch for that entity will return
all instances of that entity). For the how too, see the documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html
So a simple fetch request for all "Foo" instances:
NSFetchRequest * f = [[[NSFetchRequest alloc] init] autorelease];
[f setEntity:[NSEntityDescription entityForName:@"Foo"
inManagedObjectContext:[self managedObjectContext]]];
NSArray * results = [[self managedObjectContext] executeFetchRequest:f
error:nil];
Obviously you wouldn't want to ignore potential errors, but ...
--
I.S.
DATE : Tue Apr 29 18:31:20 2008
> > My question is: what is the most efficient fetch to pose given that every
> > fetch is IO.
>
> Yes.
Sorry, I thought this was "is this the most efficient" ... Meaning:
mmalc's response of "Execute a fetch for the entity in which you're
interested, and count the returned array." is the most efficient. It
means exactly what it says (a basic fetch for that entity will return
all instances of that entity). For the how too, see the documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html
So a simple fetch request for all "Foo" instances:
NSFetchRequest * f = [[[NSFetchRequest alloc] init] autorelease];
[f setEntity:[NSEntityDescription entityForName:@"Foo"
inManagedObjectContext:[self managedObjectContext]]];
NSArray * results = [[self managedObjectContext] executeFetchRequest:f
error:nil];
Obviously you wouldn't want to ignore potential errors, but ...
--
I.S.
| Related mails | Author | Date |
|---|---|---|
| Steve Cronin | Apr 29, 18:03 | |
| I. Savant | Apr 29, 18:08 | |
| I. Savant | Apr 29, 18:31 | |
| Adam Swift | Apr 29, 20:18 | |
| I. Savant | Apr 29, 20:33 | |
| Adam Swift | Apr 29, 20:33 | |
| Ben Trumbull | Apr 29, 22:57 |






Cocoa mail archive

