predicate for a Core Data fetch request rejected by SQL
predicate for a Core Data fetch request rejected by SQL
- Subject: predicate for a Core Data fetch request rejected by SQL
- From: Mark Sanvitale <email@hidden>
- Date: Fri, 5 Mar 2010 13:55:58 -0800
- Old-return-path: email@hidden
RANT AGAINST DOCUMENTATION:
I have searched (a lot) and found various other pleas for help of the form, "I am trying to do a Core Date fetch on an SQL-backed store and it is failing because something is wrong with my predicate." I thought some investigate could promote my plea beyond this basic level, but I seem to be hitting the same wall-of-no-information as everyone else. This wall seems to built around Apple believing it's official Core Data docs adequately describes the issues with fetch predicates on SQL by stating, "You cannot necessarily translate “arbitrary” SQL queries into predicates". Translation: "The issue with predicates and SQL is that there are issues." Thanks for all the help, docs.
BEGIN PROBLEM AND QUESTION:
So, here is my plea for help. I have a predicate of the form: "<character string> BEGINSWITH path". In other words, I am searching entities that possess a (string) property "path" to look for one whose path is a prefix of some string (which is inserted into the predicate via the fetch-request-template variable substitution). This fetch executes just fine on an XML store. The same fetch on an SQL store yields: unimplemented SQL generation for predicate ("/Volumes/MacHD/Applications/Utilities" BEGINSWITH path).
My guess (given the lack of explicit documentation) is that SQL itself (or, perhaps, just Core Data's use of SQL) does not allow the left-hand-side to be a literal string, rather, it wants the left-hand-side to be a property key or key-path. Anyone know if this is actually the case?
So far, in the world of "path has to be on the left-hand-side" I have not formulated a predicate that can determine if path is a prefix of the supplied string. Yes, I can fetch all entities from the DB and then do an in-memory search amongst the paths. Just hoping I could have the fetch do all the work.
Mark Sanvitale
Real Networks
_______________________________________________
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