perfect.org
Documentation
|
API Documentation
PerfectLib
Perfect-CouchDB
Perfect-CURL
Perfect-Filemaker
Perfect-GoogleAnalytics-MeasurementProtocol
Perfect-HTTP
Perfect-HTTPServer
Perfect-Logger
Perfect-MongoDB
Perfect-Mustache
Perfect-MySQL
Perfect-MariaDB
Perfect-Net
Perfect-Notifications
Perfect-PostgreSQL
Perfect-Redis
Perfect-RequestLogger
Perfect-Session
Perfect-Session-SQLite
Perfect-Session-CouchDB
Perfect-Session-MySQL
Perfect-Session-PostgreSQL
Perfect-SQLite
Perfect-Thread
Perfect-WebSockets
Perfect-XML
Perfect-Zip
Turnstile-Perfect
Perfect-Turnstile-CouchDB
Perfect-Turnstile-MySQL
Perfect-Turnstile-PostgreSQL
Perfect-Turnstile-SQLite
StORM
CouchDB-StORM
MySQL-StORM
Postgres-StORM
SQLite-StORM
Module: Perfect-MariaDB
enum
MySQLOpt
case
MYSQL_OPT_CONNECT_TIMEOUT
case
MYSQL_OPT_COMPRESS
case
MYSQL_OPT_NAMED_PIPE
case
MYSQL_INIT_COMMAND
case
MYSQL_READ_DEFAULT_FILE
case
MYSQL_READ_DEFAULT_GROUP
case
MYSQL_SET_CHARSET_DIR
case
MYSQL_SET_CHARSET_NAME
case
MYSQL_OPT_LOCAL_INFILE
case
MYSQL_OPT_PROTOCOL
case
MYSQL_SHARED_MEMORY_BASE_NAME
case
MYSQL_OPT_READ_TIMEOUT
case
MYSQL_OPT_WRITE_TIMEOUT
case
MYSQL_OPT_USE_RESULT
case
MYSQL_OPT_USE_REMOTE_CONNECTION
case
MYSQL_OPT_USE_EMBEDDED_CONNECTION
case
MYSQL_OPT_GUESS_CONNECTION
case
MYSQL_SET_CLIENT_IP
case
MYSQL_SECURE_AUTH
case
MYSQL_REPORT_DATA_TRUNCATION
case
MYSQL_OPT_RECONNECT
case
MYSQL_OPT_SSL_VERIFY_SERVER_CERT
case
MYSQL_PLUGIN_DIR
case
MYSQL_DEFAULT_AUTH
case
MYSQL_OPT_BIND
case
MYSQL_OPT_SSL_KEY
case
MYSQL_OPT_SSL_CERT
case
MYSQL_OPT_SSL_CA
case
MYSQL_OPT_SSL_CAPATH
case
MYSQL_OPT_SSL_CIPHER
case
MYSQL_OPT_SSL_CRL
case
MYSQL_OPT_SSL_CRLPATH
case
MYSQL_OPT_CONNECT_ATTR_RESET
case
MYSQL_OPT_CONNECT_ATTR_ADD
case
MYSQL_OPT_CONNECT_ATTR_DELETE
enum
MySQLOpt
enum for mysql options
case
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
case
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
case
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
case
MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
case
MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
case
MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
case
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
case
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
case
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
case
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
case
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
case
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
case
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
case
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
case
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
case
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
case
MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
case
MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
case
MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
case
MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
case
MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
case
MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH,
case
MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH,
case
MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH,
case
MYSQL_OPT_BIND,
case
MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT,
case
MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT,
case
MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER,
case
MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER,
case
MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER,
case
MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH,
case
MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH,
case
MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_ADD,
case
MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_ADD,
case
MYSQL_OPT_CONNECT_ATTR_DELETE,
case
MYSQL_SERVER_PUBLIC_KEY,
case
MYSQL_ENABLE_CLEARTEXT_PLUGIN
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
connect(host hst: String? = nil, user: String? = nil, password: String? = nil, db: String? = nil, port: UInt32 = 0, socket: String? = nil, flag: UInt = 0) -> Bool
Connects to a MySQL server
func
selectDatabase(named namd: String) -> Bool
Selects a database
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
fieldNames() -> [Int: String]
enum
FieldType
case
integer,
case
double,
case
bytes,
case
string,
case
date,
case
null
struct
FieldInfo
func
fieldInfo(index: Int) -> FieldInfo?
enum
FetchResult
Possible status for fetch results
case
OK, Error, NoData, DataTruncated
case
OK, Error, NoData, DataTruncated
case
OK, Error, NoData, DataTruncated
case
OK, Error, NoData, DataTruncated
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
results() -> MySQLStmt.Results
returns current results
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(_ b: UnsafePointer<Int8>, length: Int)
create Blob 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