RBORMQuery Class Reference
Inherits from | NSObject |
---|---|
Conforms to | NSCopying |
Declared in | RBORMQuery.h |
+ deleteQueryWithObjectType:withDatabaseIdentifier:
Creates a new DELETE query for the given object type.
+ (nonnull instancetype)deleteQueryWithObjectType:(nonnull Class)objectType withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new DELETE query for the given object type.
Declared In
RBORMQuery.h
+ selectQueryWithObjectType:withDatabaseIdentifier:
Creates a new SELECT query for the given object type.
+ (nonnull instancetype)selectQueryWithObjectType:(nonnull Class)objectType withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new SELECT query for the given object type.
Declared In
RBORMQuery.h
+ countQueryWithObjectType:ofProperty:withDatabaseIdentifier:
Creates a new COUNT aggregate query for the given object type.
+ (nonnull instancetype)countQueryWithObjectType:(nonnull Class)objectType ofProperty:(nonnull NSString *)propertyName withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
propertyName |
The name of the property who’s values will be aggregated. |
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new COUNT aggregate query for the given object type.
Declared In
RBORMQuery.h
+ sumQueryWithObjectType:ofProperty:withDatabaseIdentifier:
Creates a new SUM aggregate query for the given object type.
+ (nonnull instancetype)sumQueryWithObjectType:(nonnull Class)objectType ofProperty:(nonnull NSString *)propertyName withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
propertyName |
The name of the property who’s values will be aggregated. |
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new SUM aggregate query for the given object type.
Declared In
RBORMQuery.h
+ minQueryWithObjectType:ofProperty:withDatabaseIdentifier:
Creates a new MIN aggregate query for the given object type.
+ (nonnull instancetype)minQueryWithObjectType:(nonnull Class)objectType ofProperty:(nonnull NSString *)propertyName withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
propertyName |
The name of the property who’s values will be aggregated. |
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new MIN aggregate query for the given object type.
Declared In
RBORMQuery.h
+ maxQueryWithObjectType:ofProperty:withDatabaseIdentifier:
Creates a new MAX aggregate query for the given object type.
+ (nonnull instancetype)maxQueryWithObjectType:(nonnull Class)objectType ofProperty:(nonnull NSString *)propertyName withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
propertyName |
The name of the property who’s values will be aggregated. |
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new MAX aggregate query for the given object type.
Declared In
RBORMQuery.h
+ averageQueryWithObjectType:ofProperty:withDatabaseIdentifier:
Creates a new AVERAGE aggregate query for the given object type.
+ (nonnull instancetype)averageQueryWithObjectType:(nonnull Class)objectType ofProperty:(nonnull NSString *)propertyName withDatabaseIdentifier:(nonnull NSString *)databaseIdentifier
Parameters
objectType |
The type of object that will be queried. |
---|---|
propertyName |
The name of the property who’s values will be aggregated. |
databaseIdentifier |
The identifier of the database to use. |
Return Value
An initialized instance of the RBORMQuery
class.
Discussion
Creates a new AVERAGE aggregate query for the given object type.
Declared In
RBORMQuery.h
databaseIdentifer
The identifier of the database that the query will be executed on.
@property (nonatomic, readonly, nonnull) NSString *databaseIdentifer
Discussion
The identifier of the database that the query will be executed on.
Declared In
RBORMQuery.h
objectType
The type of object (and corresponding database table) that the query will be executed on.
@property (nonatomic, readonly, nonnull) Class objectType
Discussion
The type of object (and corresponding database table) that the query will be executed on.
Declared In
RBORMQuery.h
isScalar
Whether or not the query will yield a scalar result type (such as a number).
@property (nonatomic, readonly) BOOL isScalar
Discussion
Whether or not the query will yield a scalar result type (such as a number).
Declared In
RBORMQuery.h
isNonQuery
Whether or not the query will not yield a value result, but rather the number of rows affected or an error message.
@property (nonatomic, readonly) BOOL isNonQuery
Discussion
Whether or not the query will not yield a value result, but rather the number of rows affected or an error message.
Declared In
RBORMQuery.h
queryString
The SQL query string that represents this query.
@property (nonatomic, readonly, nonnull) NSString *queryString
Discussion
The SQL query string that represents this query.
Declared In
RBORMQuery.h
bindings
The bindings that are associated respectively with the binding references in queryString
.
@property (nonatomic, readonly, nullable) NSArray *bindings
Discussion
The bindings that are associated respectively with the binding references in queryString
.
Declared In
RBORMQuery.h
– execute
Compiles and executes the query.
- (nullable NSArray *)execute
Return Value
An NSArray
containing a list of any returned results as managed RBORMObject
objects. In the case of scalar queries use [array firstObject] to retrieve the scalar value. Will return nil on error.
Discussion
Compiles and executes the query.
Declared In
RBORMQuery.h
– where:
The SQL ‘WHERE’ clause.
- (nonnull RBORMQuery *)where:(nonnull NSString *)criteria
Parameters
criteria |
A filter indicating which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). |
---|
Return Value
The updated RBORMQuery
object.
Discussion
The SQL ‘WHERE’ clause.
Declared In
RBORMQuery.h
– where:bindings:
The SQL ‘WHERE’ clause.
- (nonnull RBORMQuery *)where:(nonnull NSString *)criteria bindings:(nullable NSArray *)bindings
Parameters
criteria |
A filter indicating which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). The criteria may contain ‘?’ bindings. |
---|---|
bindings |
An array of items the provide the values that should correspond to the ‘?’ bidnings specified in the criteria. |
Return Value
The updated RBORMQuery
object.
Discussion
The SQL ‘WHERE’ clause.
Declared In
RBORMQuery.h
– orderBy:
THE SQL ‘ORDER BY’ clause.
- (nonnull RBORMQuery *)orderBy:(nonnull NSString *)orderBy
Parameters
orderBy |
The order in which to return the resultant rows formatted as a SQL ORDER BY clause (exclude the ORDER BY itself). Passing null will ommit any ordering |
---|
Return Value
The updated RBORMQuery
object.
Discussion
THE SQL ‘ORDER BY’ clause.
Declared In
RBORMQuery.h
– limit:
The SQL ‘LIMIT’ clause.
- (nonnull RBORMQuery *)limit:(NSUInteger)limit
Parameters
limit |
The maximum number of results to return passing |
---|
Return Value
The updated RBORMQuery
object.
Discussion
The SQL ‘LIMIT’ clause.
Declared In
RBORMQuery.h
– offset:
The SQL ‘OFFSET’ clause.
- (nonnull RBORMQuery *)offset:(NSUInteger)offset
Parameters
offset |
The offset from which to returns rows from. A ‘LIMIT’ must be provided for this to take affect, this is ignored otherwise. |
---|
Return Value
The updated RBORMQuery
object.
Discussion
The SQL ‘OFFSET’ clause.
Declared In
RBORMQuery.h
– relatedTo:withKeyProperty:
Selects only those items who’s foreign key property name given refers to the object given.
- (nonnull RBORMQuery *)relatedTo:(nonnull RBORMObject *)object withKeyProperty:(nonnull NSString *)propertyName
Parameters
object |
The object to filter relations to. |
---|---|
propertyName |
The name of the foreign key property on the receiver class. |
Return Value
The updated RBORMQuery
object.
Discussion
Selects only those items who’s foreign key property name given refers to the object given.
Declared In
RBORMQuery.h
– forDatabaseIdentifier:
The database identifier for this query. Set to DEFAULT_DATABASE_IDENTIFIER
by default.
- (nonnull RBORMQuery *)forDatabaseIdentifier:(nonnull NSString *)identifier
Parameters
identifier |
A database identifier indicating which specific database this query should be run on. |
---|
Return Value
The updated RBORMQuery
object.
Discussion
The database identifier for this query. Set to DEFAULT_DATABASE_IDENTIFIER
by default.
Declared In
RBORMQuery.h