Module: Perfect-SQLite
enum SQLiteError : Error
This enum type indicates an exception when dealing with a SQLite database
case Error(code: Int, msg: String)
A SQLite error code and message.
class SQLite
A SQLite database
func init(_ path: String, readOnly: Bool = false, busyTimeoutMillis: Int = 1000) throws
Create or open a SQLite database given a file path.

- parameter path: String path to SQLite database
- parameter readOnly: Optional, Bool flag for read/write setting, defaults to false
- throws: SQLiteError
func close()
Close the SQLite database.
func prepare(statement stat: String) throws -> SQLiteStmt
Compile the SQL statement.

- returns: A SQLiteStmt object representing the compiled statement.
func lastInsertRowID() -> Int
Returns the value of `sqlite3_last_insert_rowid`.

- returns: Int last inserted row ID
func totalChanges() -> Int
Returns the value of `sqlite3_total_changes`.

- returns: Int total changes
func changes() -> Int
Returns the value of `sqlite3_changes`.

- returns: Int number of changes
func errCode() -> Int
Returns the value of `sqlite3_errcode`.

- returns: Int error code
func errMsg() -> String
Returns the value of `sqlite3_errmsg`.

- returns: String error message
func execute(statement: String) throws
Execute the given statement. Assumes there will be no parameter binding or resulting row data.

- parameter statement: String statement to be executed
- throws: ()
func execute(statement: String, doBindings: (SQLiteStmt) throws -> ()) throws
Execute the given statement. Calls the provided callback one time for parameter binding. Assumes there will be no resulting row data.

- parameter statement: String statement to be executed
- parameter doBindings: Block used for bindings
- throws: ()
func execute(statement: String, count: Int, doBindings: (SQLiteStmt, Int) throws -> ()) throws
Execute the given statement `count` times. Calls the provided callback on each execution for parameter binding. Assumes there will be no resulting row data.

- parameter statement: String statement to be executed
- parameter count: Int number of times to execute
- parameter doBindings: Block to be executed for binding on each call
- throws: ()
func doWithTransaction(closure: () throws -> ()) throws
Executes a BEGIN, calls the provided closure and executes a ROLLBACK if an exception occurs or a COMMIT if no exception occurs.

- parameter closure: Block to be executed inside transaction
- throws: ErrorType
func forEachRow(statement: String, handleRow: (SQLiteStmt, Int) throws -> ()) throws
Executes the statement and calls the closure for each resulting row.

- parameter statement: String statement to be executed
- parameter handleRow: Block to be executed for each row
- throws: ()
func forEachRow(statement: String, doBindings: (SQLiteStmt) throws -> (), handleRow: (SQLiteStmt, Int) throws -> ()) throws
Executes the statement, calling `doBindings` to handle parameter bindings and calling `handleRow` for each resulting row.

- parameter statement: String statement to be executed
- parameter doBindings: Block to perform bindings on statement
- parameter handleRow: Block to execute for each row
- throws: ()
class SQLiteStmt
A compiled SQLite statement
func close()
Close or "finalize" the statement.
func finalize()
Close the statement.
func step() -> Int32
Advance to the next row.
func bind(position: Int, _ d: Double) throws
Bind the Double value to the indicated parameter.

- parameter position: Int position of binding
- parameter d: Double to be bound
- throws: ()
func bind(position: Int, _ i: Int32) throws
Bind the Int32 value to the indicated parameter.

- parameter position: Int position of binding
- parameter i: Int32 to be bound
- throws: ()
func bind(position: Int, _ i: Int) throws
Bind the Int value to the indicated parameter.

- parameter position: Int position of binding
- parameter i: Int to be bound
- throws: ()
func bind(position: Int, _ i: Int64) throws
Bind the Int64 value to the indicated parameter.

- parameter position: Int position of binding
- parameter i: Int64 to be bound
- throws: ()
func bind(position: Int, _ s: String) throws
Bind the String value to the indicated parameter.

- parameter position: Int position of binding
- parameter s: String to be bound
- throws: ()
func bind(position: Int, _ b: [Int8]) throws
Bind the [Int8] blob value to the indicated parameter.

- parameter position: Int position of binding
- parameter b: [Int8] blob to be bound
- throws: ()
func bind(position: Int, _ b: [UInt8]) throws
Bind the [UInt8] blob value to the indicated parameter.

- parameter position: Int position of binding
- parameter b: [UInt8] blob to be bound
- throws: ()
func bindZeroBlob(position: Int, count: Int) throws
Bind a blob of `count` zero values to the indicated parameter.

- parameter position: Int position of binding
- parameter count: Int number of zero values in blob to be bound
- throws: ()
func bindNull(position: Int) throws
Bind a null to the indicated parameter.

- parameter position: Int position of binding
- throws: ()
func bind(name: String, _ d: Double) throws
Bind the Double value to the indicated parameter.

- parameter name: String name of binding
- parameter d: Double to be bound
- throws: ()
func bind(name: String, _ i: Int32) throws
Bind the Int32 value to the indicated parameter.

- parameter name: String name of binding
- parameter i: Int32 to be bound
- throws: ()
func bind(name: String, _ i: Int) throws
Bind the Int value to the indicated parameter.

- parameter name: String name of binding
- parameter i: Int to be bound
- throws: ()
func bind(name: String, _ i: Int64) throws
Bind the Int64 value to the indicated parameter.

- parameter name: String name of binding
- parameter i: Int64 to be bound
- throws: ()
func bind(name: String, _ s: String) throws
Bind the String value to the indicated parameter.

- parameter name: String name of binding
- parameter s: String to be bound
- throws: ()
func bind(name: String, _ b: [Int8]) throws
Bind the [Int8] blob value to the indicated parameter.

- parameter name: String name of binding
- parameter b: [Int8] blob to be bound
- throws: ()
func bindZeroBlob(name: String, count: Int) throws
Bind a blob of `count` zero values to the indicated parameter.

- parameter name: String name of binding
- parameter count: Int number of zero values in blob to be bound
- throws: ()
func bindNull(name: String) throws
Bind a null to the indicated parameter.

- parameter name: String name of binding
- throws: ()
func bindParameterIndex(name: String) throws -> Int
Returns the index for the named parameter.

- parameter name: String name of binding
- throws: ()
- returns: Int index of parameter
func reset() throws -> Int
Resets the SQL statement.

- returns: Int result
func columnCount() -> Int
Return the number of columns in mthe result set.

- returns: Int count of columns in result set
func columnName(position: Int) -> String
Returns the name for the indicated column.

- parameter position: Int position of column
- returns: String name of column
func columnDeclType(position: Int) -> String
Returns the name of the declared type for the indicated column.

- parameter position: Int position of column
- returns: String name of declared type
func columnBlob(position: Int) -> [Int8]
Returns the blob data for the indicated column.

- parameter position: Int position of column
- returns: [Int8] blob
func columnDouble(position: Int) -> Double
Returns the Double value for the indicated column.

- parameter: Int position of column
- returns: Double value for column
func columnInt(position: Int) -> Int
Returns the Int value for the indicated column.

- parameter: Int position of column
- returns: Int value for column
func columnInt32(position: Int) -> Int32
Returns the Int32 value for the indicated column.

- parameter: Int position of column
- returns: Int32 value for column
func columnInt64(position: Int) -> Int64
Returns the Int64 value for the indicated column.

- parameter: Int position of column
- returns: Int64 value for column
func columnText(position: Int) -> String
Returns the String value for the indicated column.

- parameter: Int position of column
- returns: String value for column
func columnType(position: Int) -> Int32
Returns the type for the indicated column.

- parameter: Int position of column
- returns: Int32