Re: NSPredicate with CoreData SQL store behavior
Re: NSPredicate with CoreData SQL store behavior
- Subject: Re: NSPredicate with CoreData SQL store behavior
- From: Jesse Grosjean <email@hidden>
- Date: Wed, 15 Mar 2006 16:45:01 -0500
OK, I've posted an example that illustrates some of the problems that
I'm running into. You can download it here:
http://www.hogbaysoftware.com/files/CoreDataFetchTest.zip
My goal is to find if a core data string attribute contains a given
string. The failure in the above CoreDataFetchTest are:
1. "def" IN[cd] entryData.note.noteString - when crossing
relationships on a saved context (works on an unsaved context)
2. all searches for LIKE[cd] "*def*" - when noteString contains a
newline. If noteString doesn't contain a newline then all forms of
LIKE[cd] "*def*" work.
And if so what is the best way to find if a string attribute (that
might have new lines) contains another string?
"CONTAINS[cd]" ?
Thanks. I'm trying that now in the above test cases, but can only get
it to work reliably if I don't fetch across any relationships.
First at some point I "learned" that when fetching on a SQL type
store predicates would only return results from the entities that
were committed to the store. For example if I add a new entity it
would not show up in the fetch results until I saved the store.
This is not the case; the documentation lists the precise
conditions that apply:
<http://developer.apple.com/documentation/Cocoa/Reference/
CoreData_ObjC/Classes/NSManagedObjectContext.html#//apple_ref/occ/
instm/NSManagedObjectContext/executeFetchRequest:error:>
Thanks for the pointer. I was looking for this in the predicate
tutorial documentation, though I now see that it makes a lot more
sense to document it in the managed object context. I'm still having
trouble with my own app, but my test case works fine so the problem
must be my bug somewhere.
Jesse
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden