interface MysqlConnectionInterface (View source)

Defines MySQLi-specific operations used by the MySQL driver in addition to the generic connection contract.

Methods

mysqli
mysqli()

Returns the underlying MySQLi handle for extension-specific operations.

mysqli
execute(string $sql, array $bindings = [])

Executes SQL with bound values and captures both result-set and write metadata.

array
select(string $sql, array $bindings = [])

Reads an entire result set as associative rows.

array
cursor(string $sql, array $bindings = [])

Streams associative rows without materializing the result set.

int
statement(string $sql, array $bindings = [])

Executes a data-changing statement and returns its affected-row count.

int
void

Begins a physical MySQL transaction.

void
void
commit()

Commits the active physical MySQL transaction.

void
void

Rolls back the active physical MySQL transaction.

void
void

Reconnects the underlying MySQLi handle using its configured connection settings.

void
void
close()

Closes the underlying MySQLi handle.

void
string

Returns the MySQL server version reported by MySQLi.

string
bool
setCharset(string $charset)

Requests the connection character set and reports whether MySQL accepted it.

bool
string
escapeString(string $value)

Escapes a string fragment for inclusion in a MySQL literal.

string
void
selectDatabase(string $database)

Selects the active MySQL database for subsequent statements.

void
int

Returns the affected-row count reported by the latest MySQLi operation.

int
int|string|null

Returns the generated identifier reported by the latest insert when available.

int|string|null
array
listTables(bool $prefixLimit = false)

Lists database tables, optionally restricted to the configured table prefix.

array
array
listColumns(string $table)

Lists column names for one table through MySQL metadata.

array
array

Returns the code and message reported by the latest MySQLi error.

array

Details

mysqli

mysqli mysqli()

Returns the underlying MySQLi handle for extension-specific operations.

Return Value

mysqli

execute

MysqlExecutionResult execute(string $sql, array $bindings = [])

Executes SQL with bound values and captures both result-set and write metadata.

Parameters

string $sql
array $bindings

Return Value

MysqlExecutionResult

select

array select(string $sql, array $bindings = [])

Reads an entire result set as associative rows.

Parameters

string $sql
array $bindings

Return Value

array

cursor

Generator cursor(string $sql, array $bindings = [])

Streams associative rows without materializing the result set.

Parameters

string $sql
array $bindings

Return Value

Generator

statement

int statement(string $sql, array $bindings = [])

Executes a data-changing statement and returns its affected-row count.

Parameters

string $sql
array $bindings

Return Value

int

beginTransaction

void beginTransaction()

Begins a physical MySQL transaction.

Return Value

void

commit

void commit()

Commits the active physical MySQL transaction.

Return Value

void

rollBack

void rollBack()

Rolls back the active physical MySQL transaction.

Return Value

void

reconnect

void reconnect()

Reconnects the underlying MySQLi handle using its configured connection settings.

Return Value

void

close

void close()

Closes the underlying MySQLi handle.

Return Value

void

serverVersion

string serverVersion()

Returns the MySQL server version reported by MySQLi.

Return Value

string

setCharset

bool setCharset(string $charset)

Requests the connection character set and reports whether MySQL accepted it.

Parameters

string $charset

Return Value

bool

escapeString

string escapeString(string $value)

Escapes a string fragment for inclusion in a MySQL literal.

Parameters

string $value

Return Value

string

selectDatabase

void selectDatabase(string $database)

Selects the active MySQL database for subsequent statements.

Parameters

string $database

Return Value

void

affectedRows

int affectedRows()

Returns the affected-row count reported by the latest MySQLi operation.

Return Value

int

lastInsertId

int|string|null lastInsertId()

Returns the generated identifier reported by the latest insert when available.

Return Value

int|string|null

listTables

array listTables(bool $prefixLimit = false)

Lists database tables, optionally restricted to the configured table prefix.

Parameters

bool $prefixLimit

Return Value

array

listColumns

array listColumns(string $table)

Lists column names for one table through MySQL metadata.

Parameters

string $table

Return Value

array

lastError

array lastError()

Returns the code and message reported by the latest MySQLi error.

Return Value

array