Module: Perfect-MariaDB
enum MySQLOpt
enum for mysql options
class MySQL
Provide access to MySQL connector functions
static func func clientInfo() -> String
Returns client info from mysql_get_client_info
func init()
Create mysql server connection and set ptr
func close()
Close connection and set ptr to nil
func errorCode() -> UInt32
Return mysql error number
func errorMessage() -> String
Return mysql error message
func serverVersion() -> Int
Return mysql server version
func listTables(wildcard wild: String? = nil) -> [String]
Returns table names matching an optional simple regular expression in an array of Strings
func listDatabases(wildcard wild: String? = nil) -> [String]
Returns database names matching an optional simple regular expression in an array of Strings
func commit() -> Bool
Commits the transaction
func rollback() -> Bool
Rolls back the transaction
func moreResults() -> Bool
Checks whether any more results exist
func nextResult() -> Int
Returns/initiates the next result in multiple-result executions
func query(statement stmt: String) -> Bool
Executes an SQL query using the specified string
func storeResults() -> MySQL.Results?
Retrieves a complete result set to the client
func setOption(_ option: MySQLOpt) -> Bool
Sets connect options for connect()
func setOption(_ option: MySQLOpt, _ b: Bool) -> Bool
Sets connect options for connect() with boolean option argument
func setOption(_ option: MySQLOpt, _ i: Int) -> Bool
Sets connect options for connect() with integer option argument
func setOption(_ option: MySQLOpt, _ s: String) -> Bool
Sets connect options for connect() with string option argument
class Results: IteratorProtocol
Class used to manage and interact with result sets
func close()
close result set by releasing the results
func dataSeek(_ offset: UInt)
Seeks to an arbitrary row number in a query result set
func numRows() -> Int
Returns the number of rows in a result set
func numFields() -> Int
Returns the number of columns in a result set
Returns: Int
func next() -> Element?
Fetches the next row from the result set
returning a String array of column names if row available
Returns: optional Element
func forEachRow(callback: (Element) -> ())
passes a string array of the column names to the callback provided
class MySQLStmt
handles mysql prepared statements
func init(_ mysql: MySQL)
initialize mysql statement structure
func close()
close and free mysql statement structure pointer
func reset()
Resets the statement buffers in the server
func freeResult()
Free the resources allocated to a statement handle
func errorCode() -> UInt32
Returns the error number for the last statement execution
func errorMessage() -> String
Returns the error message for the last statement execution
func prepare(statement query: String) -> Bool
Prepares an SQL statement string for execution
func execute() -> Bool
Executes a prepared statement, binding parameters if needed
func fetch() -> FetchResult
Fetches the next row of data from a result set and returns status
func numRows() -> UInt
Returns the row count from a buffered statement result set
func affectedRows() -> UInt
Returns the number of rows changed, deleted, or inserted by prepared UPDATE, DELETE, or INSERT statement
func insertId() -> UInt
Returns the ID generated for an AUTO_INCREMENT column by a prepared statement
func fieldCount() -> UInt
Returns the number of result columns for the most recent statement
func nextResult() -> Int
Returns/initiates the next result in a multiple-result execution
func dataSeek(offset: Int)
Seeks to an arbitrary row number in a statement result set
func paramCount() -> Int
Returns the number of parameters in a prepared statement
func bindParam(_ d: Double)
create Double parameter binding
func bindParam(_ i: Int)
create Int parameter binding
func bindParam(_ i: UInt64)
create UInt64 parameter binding
func bindParam(_ s: String)
create String parameter binding
func bindParam()
create null parameter binding
class Results
manage results sets for MysqlStmt
var numFields: Int
Field count for result set
func close()
Release results set
var numRows: Int
Row count for current set
func forEachRow(callback: (Element) -> ()) -> Bool
Retrieve and process each row with the provided callback