How do I fetch, say, item 7 000 to 7 999 in my SQLite table with around 100 000 items?
The normal fetch returns to much to work with, and I rather fetch it little by little:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Log"
inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&err];
// here fetchedObjects holds around 100 000 rows
- Is there a way to specify a range with in
executeFetchRequest:fetchRequest? - Do I have to use the SQLite API?
- Is it a good idea?
Use the
fetchLimitandfetchOffsetproperties onNSFetchRequestto fetch an object in a selected range.