Re: Problem with NSPredicate in core data fetch request
Re: Problem with NSPredicate in core data fetch request
- Subject: Re: Problem with NSPredicate in core data fetch request
- From: Andreas Grosam <email@hidden>
- Date: Mon, 14 Mar 2011 14:47:46 +0100
On Mar 13, 2011, at 3:08 PM, Gideon King wrote:
> I'm seeing a strange thing with a predicate. When I apply the predicate to a fetch request, it doesn't return any results, but when I do the fetch without the predicate and then use filteredArrayUsingPredicate to filter the results, it has the matching row that I expect.
...
> I am really mystified by this - I can't understand why it would not work when applied to a fetch request, but would work when applied to the array of results.
>
> Any suggestions?
Well, in general, sending executeFetchRequest to the context and performing a predicate upon a result set, behaves not (always) the same, respectively certain requirements must be met.
In case of SQLite as the datastore, if you sent executeFetchRequest to the context, the context constructs corresponding SQL Select commands which are sent to SQLite and performed by SQLite itself. First of all, fetch request including the predicate must be convertible to equivalent SQL statements. Then, the SQL statements must be valid of course, and this requires (for instance) that all attributes within the predicate exist as fields in the corresponding table in the database.
Do you use a SQLite data store and is the attribute transient or is there a value transformer attached to it?
Regards
Andreas
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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