Properties

$options

$options : mixed

Database connection options

Type

mixed

$connection

$connection : mixed

Database connection object/resource

Type

mixed

$statement

$statement : mixed

Statement object/resource

Type

mixed

$result

$result : mixed

Result object/resource

Type

mixed

$error

$error : mixed

Error string/object/resource

Type

mixed

$listener

$listener : \Pop\Utils\CallableObject

Query listener object/resource

Type

\Pop\Utils\CallableObject

$statementResult

$statementResult : boolean

Statement result

Type

boolean

Methods

__construct()

__construct(array  $options = array()) 

Constructor

Instantiate the MySQL database connection object using mysqli

Parameters

array $options

connect()

connect(array  $options = array()) : \Pop\Db\Adapter\Mysql

Connect to the database

Parameters

array $options

Returns

\Pop\Db\Adapter\Mysql

setOptions()

setOptions(array  $options) : \Pop\Db\Adapter\Mysql

Set database connection options

Parameters

array $options

Returns

\Pop\Db\Adapter\Mysql

getOptions()

getOptions() : array

Get database connection options

Returns

array

hasOptions()

hasOptions() : boolean

Has database connection options

Returns

boolean

beginTransaction()

beginTransaction(integer  $flags = null, string  $name = null) : \Pop\Db\Adapter\Mysql

Begin a transaction

Parameters

integer $flags
string $name

Returns

\Pop\Db\Adapter\Mysql

commit()

commit(integer  $flags = null, string  $name = null) : \Pop\Db\Adapter\Mysql

Commit a transaction

Parameters

integer $flags
string $name

Returns

\Pop\Db\Adapter\Mysql

rollback()

rollback(integer  $flags = null, string  $name = null) : \Pop\Db\Adapter\Mysql

Rollback a transaction

Parameters

integer $flags
string $name

Returns

\Pop\Db\Adapter\Mysql

query()

query(mixed  $sql) : \Pop\Db\Adapter\Mysql

Execute a SQL query directly

Parameters

mixed $sql

Returns

\Pop\Db\Adapter\Mysql

prepare()

prepare(mixed  $sql) : \Pop\Db\Adapter\Mysql

Prepare a SQL query

Parameters

mixed $sql

Returns

\Pop\Db\Adapter\Mysql

bindParams()

bindParams(array  $params) : \Pop\Db\Adapter\Mysql

Bind parameters to a prepared SQL query

Parameters

array $params

Returns

\Pop\Db\Adapter\Mysql

execute()

execute() : \Pop\Db\Adapter\Mysql

Execute a prepared SQL query

Throws

\Pop\Db\Adapter\Exception

Returns

\Pop\Db\Adapter\Mysql

fetch()

fetch() : array

Fetch and return a row from the result

Throws

\Pop\Db\Adapter\Exception

Returns

array

fetchAll()

fetchAll() : array

Fetch and return all rows from the result

Returns

array

createSql()

createSql() : \Pop\Db\Sql

Create SQL builder

Returns

\Pop\Db\Sql

createSchema()

createSchema() : \Pop\Db\Sql\Schema

Create Schema builder

Returns

\Pop\Db\Sql\Schema

isConnected()

isConnected() : boolean

Determine whether or not connected

Returns

boolean

getConnection()

getConnection() : mixed

Get the connection object/resource

Returns

mixed

hasStatement()

hasStatement() : boolean

Determine whether or not a statement resource exists

Returns

boolean

getStatement()

getStatement() : mixed

Get the statement object/resource

Returns

mixed

hasResult()

hasResult() : boolean

Determine whether or not a result resource exists

Returns

boolean

getResult()

getResult() : mixed

Get the result object/resource

Returns

mixed

listen()

listen(mixed  $listener, mixed  $params = null, \Pop\Db\Adapter\Profiler\Profiler  $profiler = null) : mixed

Add query listener to the adapter

Parameters

mixed $listener
mixed $params
\Pop\Db\Adapter\Profiler\Profiler $profiler

Returns

mixed

getListener()

getListener() : \Pop\Utils\CallableObject

Get query listener

Returns

\Pop\Utils\CallableObject

hasError()

hasError() : boolean

Determine whether or not there is an error

Returns

boolean

getError()

getError() : mixed

Get the error

Returns

mixed

throwError()

throwError(string  $error = null) : void

Throw a database error exception

Parameters

string $error

Throws

\Pop\Db\Adapter\Exception

disconnect()

disconnect() : void

Disconnect from the database

escape()

escape(string  $value) : string

Escape the value

Parameters

string $value

Returns

string

getLastId()

getLastId() : integer

Return the last ID of the last query

Returns

integer

getNumberOfRows()

getNumberOfRows() : integer

Return the number of rows from the last query

Returns

integer

getVersion()

getVersion() : string

Return the database version.

Returns

string

getTables()

getTables() : array

Return the tables in the database

Returns

array

hasTable()

hasTable(string  $table) : boolean

Return if the database has a table

Parameters

string $table

Returns

boolean