Index

RBORMQuery.swift

Enumerations

Classes


RBORMQuery

Provides a FLUENT API for querying an SQLite database.

Properties

Whether or not the query will not yield a value result, but rather the number of rows affected or an error message.
public var isNonQuery Bool { get }

Whether or not the query will yield a scalar result type (such as a number).
public var isScalar Bool { get }

The SQL query string that represents this query.
public var queryString String { get }

The bindings that are associated respectively with the binding references in queryString.
public var bindings [Any] { get }

The type of object (and corresponding database table) that the query will be executed on.
public var objectType RBORMObject { get set }

The identifier of the database that the query will be executed on. Set to RBORMCenter.defaultDatabaseIdentifier by default.
public var databaseIdentifier String { get set }

Functions

Creates a new DELETE query for the given object type for the default database identifier.
@param objectType : The type of object that will be queried.
@returns An initialized instance of the RBORMQuery class.
public class func deleteQuery(objectType type: RBORMObject.Type) -> RBORMQuery

Creates a new DELETE query for the given object type.
@param objectType : The type of object that will be queried.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the RBORMQuery class.
public class func deleteQuery(objectType type: RBORMObject.Type, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Creates a new SELECT query for the given object type for the default database identifier.
@param type : The type of object that will be queried.
@returns An initialized instance of the RBORMQuery class.
public class func selectQuery(objectType type: RBORMObject.Type) -> RBORMQuery

Creates a new SELECT query for the given object type.
@param type : The type of object that will be queried.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the RBORMQuery class.
public class func selectQuery(objectType type: RBORMObject.Type, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Creates a new COUNT aggregate query for the given object type for the default database identifier.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@returns An initialized instance of the RBORMQuery class.
public class func countQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String) -> RBORMQuery

Creates a new COUNT aggregate query for the given object type.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated or *.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the *
RBORMQuery
class.
public class func countQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Creates a new SUM aggregate query for the given object type for the default database identifier.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@returns An initialized instance of the RBORMQuery class.
public class func sumQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String) -> RBORMQuery

Creates a new SUM aggregate query for the given object type.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the RBORMQuery class.
public class func sumQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Creates a new MIN aggregate query for the given object type for the default database identifier.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@returns An initialized instance of the RBORMQuery class.
public class func minQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String) -> RBORMQuery

Creates a new MIN aggregate query for the given object type.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the RBORMQuery class.
public class func minQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Creates a new MAX aggregate query for the given object type for the default database identifier.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@returns An initialized instance of the RBORMQuery class.
public class func maxQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String) -> RBORMQuery

Creates a new MAX aggregate query for the given object type.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the RBORMQuery class.
public class func maxQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Creates a new AVERAGE aggregate query for the given object type.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@returns An initialized instance of the RBORMQuery class.
public class func averageQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String) -> RBORMQuery

Creates a new AVERAGE aggregate query for the given object type.
@param type : The type of object that will be queried.
@param propertyName : The name of the property who's values will be aggregated.
@param databaseIdentifier : The identifier of the database to use.
@returns An initialized instance of the RBORMQuery class.
public class func averageQuery(objectType type: RBORMObject.Type, ofProperty propertyName: String, withDatabaseIdentifier databaseIdentifier: String) -> RBORMQuery

Compiles and executes the query.
@returns The result.
public func execute() -> RBORMResult

The SQL 'WHERE' clause.
@param criteria : A filter indicating which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself).
@returns The updated RBORMQuery object.
public funcwhere(_ criteria: String) -> RBORMQuery

The SQL 'WHERE' clause.
@param criteria : A filter indicating which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). The criteria may contain '?' bindings.
@param bindings : An array of items the provide the values that should correspond to the '?' bidnings specified in the criteria.
@returns The updated RBORMQuery object.
public funcwhere(_ criteria: String, bindings: [Any]) -> RBORMQuery

THE SQL 'ORDER BY' clause.
@param 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
@returns The updated RBORMQuery object.
public func order(by orderBy: String) -> RBORMQuery

The SQL 'LIMIT' clause.
@param limit : The maximum number of results to return passing 0 returns all matching rows.
@returns The updated RBORMQuery object.
public func limit(_ limit: Int) -> RBORMQuery

The SQL 'OFFSET' clause.
@param offset : The offset from which to returns rows from. A 'LIMIT' must be provided for this to take affect, this is ignored otherwise.
@returns The updated RBORMQuery object.
public func offset(_ offset: Int) -> RBORMQuery

Selects only those rows whos foreign key property name given refers to the object given.
@param object : The object to filter relations to.
@param propertyName : The name of the foreign key property on the receiver class.
@returns The updated RBORMQuery object.
public func related(to object: RBORMObject, withKeyProperty propertyName: String) -> RBORMQuery