Connection
public protocol Connection : AnyObject
Defines the protocol which all database plugins must implement.
-
The
QueryBuilder
with connection specific substitutions.Declaration
Swift
var queryBuilder: QueryBuilder { get }
-
Establish a connection with the database.
Declaration
Swift
func connect(onCompletion: @escaping (QueryResult) -> ())
Parameters
onCompletion
The function to be called when the connection call completes.
-
Establish a connection with the database.
Declaration
Swift
func connectSync() -> QueryResult
Return Value
A QueryResult indicating success or error.
-
Close the connection to the database.
Declaration
Swift
func closeConnection()
-
An indication whether there is a connection to the database.
Declaration
Swift
var isConnected: Bool { get }
-
Execute a query.
Declaration
Swift
func execute(query: Query, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
query
The query to execute.
onCompletion
The function to be called when the execution of the query has completed.
-
Execute a raw query.
Declaration
Swift
func execute(_ raw: String, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
raw
A String with the query to execute.
onCompletion
The function to be called when the execution of the query has completed.
-
execute(query:
Default implementationparameters: onCompletion: ) Execute a query with parameters.
Default Implementation
Undocumented
Declaration
Swift
func execute(query: Query, parameters: [Any?], onCompletion: @escaping ((QueryResult) -> ()))
Parameters
query
The query to execute.
parameters
An array of the parameters.
onCompletion
The function to be called when the execution of the query has completed.
-
Execute a raw query with parameters.
Declaration
Swift
func execute(_ raw: String, parameters: [Any?], onCompletion: @escaping ((QueryResult) -> ()))
Parameters
raw
A String with the query to execute.
parameters
An array of the parameters.
onCompletion
The function to be called when the execution of the query has completed.
-
Execute a query with parameters.
Declaration
Swift
func execute(query: Query, parameters: [String : Any?], onCompletion: @escaping ((QueryResult) -> ()))
Parameters
query
The query to execute.
parameters
A dictionary of the parameters with parameter names as the keys.
onCompletion
The function to be called when the execution of the query has completed.
-
Execute a raw query with parameters.
Declaration
Swift
func execute(_ raw: String, parameters: [String : Any?], onCompletion: @escaping ((QueryResult) -> ()))
Parameters
raw
A String with the query to execute.
parameters
A dictionary of the parameters with parameter names as the keys.
onCompletion
The function to be called when the execution of the query has completed.
-
Prepare statement.
Declaration
Swift
func prepareStatement(_ query: Query, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
query
The query to prepare statement for.
onCompletion
The function to be called when the statement has been prepared.
-
Prepare statement.
Declaration
Swift
func prepareStatement(_ raw: String, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
raw
A String with the query to prepare statement for.
onCompletion
The function to be called when the statement has been prepared.
-
Execute a prepared statement.
Declaration
Swift
func execute(preparedStatement: PreparedStatement, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
preparedStatement
The prepared statement to execute.
onCompletion
The function to be called when the execution has completed.
-
Execute a prepared statement with parameters.
Declaration
Swift
func execute(preparedStatement: PreparedStatement, parameters: [Any?], onCompletion: @escaping ((QueryResult) -> ()))
Parameters
preparedStatement
The prepared statement to execute.
parameters
An array of the parameters.
onCompletion
The function to be called when the execution has completed.
-
Execute a prepared statement with parameters.
Declaration
Swift
func execute(preparedStatement: PreparedStatement, parameters: [String : Any?], onCompletion: @escaping ((QueryResult) -> ()))
Parameters
preparedStatement
The prepared statement to execute.
parameters
A dictionary of the parameters with parameter names as the keys.
onCompletion
The function to be called when the execution has completed.
-
Release a prepared statement.
Declaration
Swift
func release(preparedStatement: PreparedStatement, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
preparedStatement
The prepared statement to release.
onCompletion
The function to be called when the execution has completed.
-
Return a String representation of the query.
Throws
QueryError.syntaxError if query build fails.Declaration
Swift
func descriptionOf(query: Query) throws -> String
Parameters
query
The query.
Return Value
A String representation of the query.
-
Start a transaction.
Declaration
Swift
func startTransaction(onCompletion: @escaping ((QueryResult) -> ()))
Parameters
onCompletion
The function to be called when the execution of start transaction command has completed.
-
Commit the current transaction.
Declaration
Swift
func commit(onCompletion: @escaping ((QueryResult) -> ()))
Parameters
onCompletion
The function to be called when the execution of commit transaction command has completed.
-
Rollback the current transaction.
Declaration
Swift
func rollback(onCompletion: @escaping ((QueryResult) -> ()))
Parameters
onCompletion
The function to be called when the execution of rolback transaction command has completed.
-
Create a savepoint.
Declaration
Swift
func create(savepoint: String, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
savepoint
The name to be given to the created savepoint.
onCompletion
The function to be called when the execution of create savepoint command has completed.
-
Rollback the current transaction to the specified savepoint.
Declaration
Swift
func rollback(to savepoint: String, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
onCompletion
The function to be called when the execution of rolback transaction command has completed.
-
Release a savepoint.
Declaration
Swift
func release(savepoint: String, onCompletion: @escaping ((QueryResult) -> ()))
Parameters
savepoint
The name of the savepoint to release.
onCompletion
The function to be called when the execution of release savepoint command has completed.
-
runCompletionHandler(_:
Extension methodonCompletion: ) Undocumented
Declaration
Swift
func runCompletionHandler(_ result: QueryResult, onCompletion: @escaping ((QueryResult) -> ()))
-
runCompletionHandlerRetainingConnection(result:
Extension methodonCompletion: ) Undocumented
Declaration
Swift
func runCompletionHandlerRetainingConnection(result: QueryResult, onCompletion: @escaping ((QueryResult) -> ()))