class DbiMysqli implements DbiExtension (View source)

Interface to the MySQL Improved extension (MySQLi)

Methods

Connection|null
connect(Server $server)

Connects to the database server.

bool
selectDb(DatabaseName $databaseName, Connection $connection)

selects given database

ResultInterface|false
realQuery(string $query, Connection $connection, int $options)

runs a query and returns the result

bool
realMultiQuery(Connection $connection, string $query)

Run the multi query and output the results

bool
nextResult(Connection $connection)

Prepare next result from multi_query

ResultInterface|false
storeResult(Connection $connection)

Store the result returned from multi query

string
getHostInfo(Connection $connection)

Returns a string representing the type of connection used

int
getProtoInfo(Connection $connection)

Returns the version of the MySQL protocol used

string
getClientInfo()

returns a string that represents the client library version

string
getError(Connection $connection)

Returns last error message or an empty string if no errors occurred.

int|string
affectedRows(Connection $connection)

returns the number of rows affected by last query

string
escapeString(Connection $connection, string $string)

returns properly escaped string for use in MySQL queries

Statement|null
prepare(Connection $connection, string $query)

Prepare an SQL statement for execution.

int
getWarningCount(Connection $connection)

Returns the number of warnings from the last query.

Details

Connection|null connect(Server $server)

Connects to the database server.

Parameters

Server $server

Return Value

Connection|null

Exceptions

ConnectionException

bool selectDb(DatabaseName $databaseName, Connection $connection)

selects given database

Parameters

DatabaseName $databaseName

database name to select

Connection $connection

Return Value

bool

ResultInterface|false realQuery(string $query, Connection $connection, int $options)

runs a query and returns the result

Parameters

string $query

query to execute

Connection $connection
int $options

query options

Return Value

ResultInterface|false result

bool realMultiQuery(Connection $connection, string $query)

Run the multi query and output the results

Parameters

Connection $connection
string $query

multi query statement to execute

Return Value

bool

bool nextResult(Connection $connection)

Prepare next result from multi_query

Parameters

Connection $connection

Return Value

bool

ResultInterface|false storeResult(Connection $connection)

Store the result returned from multi query

Parameters

Connection $connection

Return Value

ResultInterface|false

false when empty results / result set when not empty

string getHostInfo(Connection $connection)

Returns a string representing the type of connection used

Parameters

Connection $connection

Return Value

string

type of connection used

int getProtoInfo(Connection $connection)

Returns the version of the MySQL protocol used

Parameters

Connection $connection

Return Value

int

version of the MySQL protocol used

string getClientInfo()

returns a string that represents the client library version

Return Value

string

MySQL client library version

string getError(Connection $connection)

Returns last error message or an empty string if no errors occurred.

Parameters

Connection $connection

Return Value

string

int|string affectedRows(Connection $connection)

returns the number of rows affected by last query

Parameters

Connection $connection

Return Value

int|string

string escapeString(Connection $connection, string $string)

returns properly escaped string for use in MySQL queries

Parameters

Connection $connection
string $string

string to be escaped

Return Value

string

a MySQL escaped string

Statement|null prepare(Connection $connection, string $query)

Prepare an SQL statement for execution.

Parameters

Connection $connection
string $query

The query, as a string.

Return Value

Statement|null

int getWarningCount(Connection $connection)

Returns the number of warnings from the last query.

Parameters

Connection $connection

Return Value

int