COQuery class documentation
COQuery : NSObjectOverview
COQuery is provided to search the core objects either in store through -[COStore resultDictionariesForQuery:] or in memory through the COObjectMatching protocol.
It allows to combine a predicate or a raw SQL query with various additional constraints, and control how the search results are returned.
NOTE: This API is unstable and incomplete, and SQL query support is not implemented.
Initialization
- + (COQuery *) queryWithPredicate: (NSPredicate *)aPredicate
Returns a new autoreleased query that uses a predicate.
- + (COQuery *) queryWithPredicateBlock: (BOOL(^)(id object,NSDictionary*bindings))aBlock
Returns a new autoreleased query that uses a predicate based on a block.
See -[NSPredicate predicateWithBlock:] .
- + (COQuery *) queryWithSQLString: (NSString *)aSQLString
Returns a new autoreleased query that uses a SQL request.
Note: To search the store based on the returned query is not implemented, so this method is useless presently.
Query Representations
Query Constraints
- - (BOOL) matchesAgainstObjectsInMemory
Determines whether the objects in memory should be searched directly, rather than turning the predicate into a SQL query and evaluates it against the store.
When set to YES, the objects are loaded lazily while traversing the object graph bound the object on which the query was started with -[COObjectMatching objectsMatchingQuery:] .
If no predicate is set, this property is ignored.
By default, returns NO.
See also -[COObjectMatching matchesPredicate:] .
- - (void) setMatchesAgainstObjectsInMemory: (BOOL)matchesAgainstObjectsInMemory
Determines whether the objects in memory should be searched directly, rather than turning the predicate into a SQL query and evaluates it against the store.
When set to YES, the objects are loaded lazily while traversing the object graph bound the object on which the query was started with -[COObjectMatching objectsMatchingQuery:] .
If no predicate is set, this property is ignored.
By default, returns NO.
See also -[COObjectMatching matchesPredicate:] .