MysqliConnection
in package
implements
Connection, PingableConnection, ServerInfoAwareConnection
Tags
Interfaces, Classes and Traits
- Connection
- Connection interface.
- PingableConnection
- An interface for connections which support a "native" ping method.
- ServerInfoAwareConnection
- Contract for a connection that is able to provide information about the server it is connected to.
Table of Contents
- OPTION_FLAGS = 'flags'
- Name of the option to set connection flags
- $_conn : mysqli
- __construct() : mixed
- beginTransaction() : bool
- Initiates a transaction.
- commit() : bool
- Commits a transaction.
- errorCode() : string|null
- Returns the error code associated with the last operation on the database handle.
- errorInfo() : array<string|int, mixed>
- Returns extended error information associated with the last operation on the database handle.
- exec() : int
- Executes an SQL statement and return the number of affected rows.
- getServerVersion() : string
- Returns the version number of the database server connected to.
- getWrappedResourceHandle() : mysqli
- Retrieves mysqli native resource handle.
- lastInsertId() : string
- Returns the ID of the last inserted row or sequence value.
- ping() : bool
- Pings the server and re-connects when `mysqli.reconnect = 1`
- prepare() : Statement
- Prepares a statement for execution and returns a Statement object.
- query() : Statement
- Executes an SQL statement, returning a result set as a Statement object.
- quote() : string
- Quotes a string for use in a query.
- requiresQueryForServerVersion() : bool
- Checks whether a query is required to retrieve the database server version.
- rollBack() : bool
- {@inheritdoc}non-PHPdoc)
- setDriverOptions() : mixed
- Apply the driver options to the connection.
Constants
OPTION_FLAGS
Name of the option to set connection flags
public
mixed
OPTION_FLAGS
= 'flags'
Properties
$_conn
private
mysqli
$_conn
Methods
__construct()
public
__construct(array<string|int, mixed> $params, string $username, string $password[, array<string|int, mixed> $driverOptions = array() ]) : mixed
Parameters
- $params : array<string|int, mixed>
- $username : string
- $password : string
- $driverOptions : array<string|int, mixed> = array()
Tags
Return values
mixed —beginTransaction()
Initiates a transaction.
public
beginTransaction() : bool
Return values
bool —TRUE on success or FALSE on failure.
commit()
Commits a transaction.
public
commit() : bool
Return values
bool —TRUE on success or FALSE on failure.
errorCode()
Returns the error code associated with the last operation on the database handle.
public
errorCode() : string|null
Return values
string|null —The error code, or null if no operation has been run on the database handle.
errorInfo()
Returns extended error information associated with the last operation on the database handle.
public
errorInfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —exec()
Executes an SQL statement and return the number of affected rows.
public
exec(mixed $statement) : int
Parameters
- $statement : mixed
Return values
int —getServerVersion()
Returns the version number of the database server connected to.
public
getServerVersion() : string
Return values
string —getWrappedResourceHandle()
Retrieves mysqli native resource handle.
public
getWrappedResourceHandle() : mysqli
Could be used if part of your application is not using DBAL.
Return values
mysqli —lastInsertId()
Returns the ID of the last inserted row or sequence value.
public
lastInsertId([mixed $name = null ]) : string
Parameters
- $name : mixed = null
Return values
string —ping()
Pings the server and re-connects when `mysqli.reconnect = 1`
public
ping() : bool
Return values
bool —prepare()
Prepares a statement for execution and returns a Statement object.
public
prepare(mixed $prepareString) : Statement
Parameters
- $prepareString : mixed
Return values
Statement —query()
Executes an SQL statement, returning a result set as a Statement object.
public
query() : Statement
Return values
Statement —quote()
Quotes a string for use in a query.
public
quote(mixed $input[, mixed $type = PDO::PARAM_STR ]) : string
Parameters
- $input : mixed
- $type : mixed = PDO::PARAM_STR
Return values
string —requiresQueryForServerVersion()
Checks whether a query is required to retrieve the database server version.
public
requiresQueryForServerVersion() : bool
Return values
bool —True if a query is required to retrieve the database server version, false otherwise.
rollBack()
{@inheritdoc}non-PHPdoc)
public
rollBack() : bool
Return values
bool —TRUE on success or FALSE on failure.
setDriverOptions()
Apply the driver options to the connection.
private
setDriverOptions([array<string|int, mixed> $driverOptions = array() ]) : mixed
Parameters
- $driverOptions : array<string|int, mixed> = array()