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: Gideon King <email@hidden>
- Date: Tue, 15 Mar 2011 01:40:23 +1000
Thanks for that information - that's an important distinction to understand. I guess that may be something to do with what I'm observing, but am not sure exactly how.
In my case, I am using an NSAtomicStore subclass. The actual storage behind the scenes maps that attribute to an "id" attribute in an XML file, but that should all be completely hidden from the layers that actually do the fetch. Anything working with the atomic store cache node would be reading and writing it as nmObjectId - String, mandatory, no value transformer
Regards
Gideon
On 14/03/2011, at 11:47 PM, Andreas Grosam wrote:
>
> 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?
_______________________________________________
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