MysqlConnectionInterface
interface MysqlConnectionInterface (View source)
Defines MySQLi-specific operations used by the MySQL driver in addition to the generic connection contract.
Methods
Returns the underlying MySQLi handle for extension-specific operations.
Executes SQL with bound values and captures both result-set and write metadata.
Reads an entire result set as associative rows.
Streams associative rows without materializing the result set.
Executes a data-changing statement and returns its affected-row count.
Begins a physical MySQL transaction.
Commits the active physical MySQL transaction.
Rolls back the active physical MySQL transaction.
Reconnects the underlying MySQLi handle using its configured connection settings.
Closes the underlying MySQLi handle.
Returns the MySQL server version reported by MySQLi.
Requests the connection character set and reports whether MySQL accepted it.
Escapes a string fragment for inclusion in a MySQL literal.
Selects the active MySQL database for subsequent statements.
Returns the affected-row count reported by the latest MySQLi operation.
Returns the generated identifier reported by the latest insert when available.
Lists database tables, optionally restricted to the configured table prefix.
Lists column names for one table through MySQL metadata.
Returns the code and message reported by the latest MySQLi error.
Details
mysqli
mysqli
mysqli()
Returns the underlying MySQLi handle for extension-specific operations.
execute
MysqlExecutionResult
execute(string $sql, array $bindings = [])
Executes SQL with bound values and captures both result-set and write metadata.
select
array
select(string $sql, array $bindings = [])
Reads an entire result set as associative rows.
cursor
Generator
cursor(string $sql, array $bindings = [])
Streams associative rows without materializing the result set.
statement
int
statement(string $sql, array $bindings = [])
Executes a data-changing statement and returns its affected-row count.
beginTransaction
void
beginTransaction()
Begins a physical MySQL transaction.
commit
void
commit()
Commits the active physical MySQL transaction.
rollBack
void
rollBack()
Rolls back the active physical MySQL transaction.
reconnect
void
reconnect()
Reconnects the underlying MySQLi handle using its configured connection settings.
close
void
close()
Closes the underlying MySQLi handle.
serverVersion
string
serverVersion()
Returns the MySQL server version reported by MySQLi.
setCharset
bool
setCharset(string $charset)
Requests the connection character set and reports whether MySQL accepted it.
escapeString
string
escapeString(string $value)
Escapes a string fragment for inclusion in a MySQL literal.
selectDatabase
void
selectDatabase(string $database)
Selects the active MySQL database for subsequent statements.
affectedRows
int
affectedRows()
Returns the affected-row count reported by the latest MySQLi operation.
lastInsertId
int|string|null
lastInsertId()
Returns the generated identifier reported by the latest insert when available.
listTables
array
listTables(bool $prefixLimit = false)
Lists database tables, optionally restricted to the configured table prefix.
listColumns
array
listColumns(string $table)
Lists column names for one table through MySQL metadata.
lastError
array
lastError()
Returns the code and message reported by the latest MySQLi error.