MydbMysqli
in package
implements
MydbMysqliInterface
Facade for php mysqli extension
Tags
Table of Contents
Interfaces
Constants
- MYSQLI_INIT_COMMAND = \MYSQLI_INIT_COMMAND
- Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.
- MYSQLI_OPT_CONNECT_TIMEOUT = \MYSQLI_OPT_CONNECT_TIMEOUT
- Connect timeout in seconds
- MYSQLI_OPT_NET_CMD_BUFFER_SIZE = \MYSQLI_OPT_NET_CMD_BUFFER_SIZE
- The size of the internal command/network buffer. Only valid for mysqlnd.
- MYSQLI_OPT_NET_READ_BUFFER_SIZE = \MYSQLI_OPT_NET_READ_BUFFER_SIZE
- Maximum read chunk size in bytes when reading the body of a MySQL command packet. Only valid for mysqlnd.
- MYSQLI_OPT_READ_TIMEOUT = \MYSQLI_OPT_READ_TIMEOUT
- Command execution result timeout in seconds. Available as of PHP 7.2.0.
- MYSQLI_REPORT_ALL = \MYSQLI_REPORT_ALL
- Set all options on (report all), report all warnings/errors.
- MYSQLI_REPORT_INDEX = \MYSQLI_REPORT_INDEX
- Report if no index or bad index was used in a query.
- MYSQLI_REPORT_STRICT = \MYSQLI_REPORT_STRICT
- Throw a mysqli_sql_exception for errors instead of warnings.
- MYSQLI_STORE_RESULT_COPY_DATA = \MYSQLI_STORE_RESULT_COPY_DATA
- Copy results from the internal mysqlnd buffer into the PHP variables fetched.
- MYSQLI_TRANS_COR_NO_RELEASE = \MYSQLI_TRANS_COR_NO_RELEASE
- Appends "NO RELEASE" to mysqli_commit() or mysqli_rollback().
- MYSQLI_TRANS_COR_RELEASE = \MYSQLI_TRANS_COR_RELEASE
- Appends "RELEASE" to mysqli_commit() or mysqli_rollback().
- MYSQLI_TRANS_START_READ_ONLY = \MYSQLI_TRANS_START_READ_ONLY
- Start the transaction as "START TRANSACTION READ ONLY" with mysqli_begin_transaction().
- MYSQLI_TRANS_START_READ_WRITE = \MYSQLI_TRANS_START_READ_WRITE
- Start the transaction as "START TRANSACTION READ WRITE" with mysqli_begin_transaction().
- SQL_MODE = 'TRADITIONAL'
- Safe MySQL SQL_MODE
Properties
- $isConnected : bool
- Flag indicating whether physical connection was established with remote server Is connected to remove server
- $isTransaction : bool
- Flag indicating whether SQL transaction was started WARNING: best-effort, only guaranteed when library is used correctly Is transaction started
- $mysqli : mysqli|null
- Mysqli instance The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above
Methods
- __construct() : mixed
- autocommit() : bool
- beginTransactionReadonly() : bool
- beginTransactionReadwrite() : bool
- close() : bool
- commit() : bool
- commitAndRelease() : bool
- Commit transaction and release connection from server side
- extractServerResponse() : mysqli_result|null
- getAffectedRows() : int|null
- getConnectErrno() : int|null
- getConnectError() : string|null
- getErrNo() : int|null
- getError() : string|null
- getInsertId() : int|string|null
- getMysqli() : mysqli|null
- getWarnings() : array<string|int, mixed>
- init() : bool
- Allocate mysqli resource instance, no physical connection to remote is done
- isConnected() : bool
- isServerGone() : bool
- isTransactionOpen() : bool
- mysqliReport() : bool
- readServerResponse() : MydbMysqliResult|null
- React to mysqli resource changes after query/command execution
- realConnect() : bool
- realEscapeString() : string|null
- realQuery() : bool
- rollback() : bool
- setTransactionIsolationLevel() : bool
- setTransportOptions() : bool
- Set various options that affect mysqli resource, before connection is established
- getFieldCount() : int|null
- Returns fields count caused by query execution Requires store_result to be called first
- getWarningCount() : int|null
- Returns warnings caused by query execution Requires store_result to be called first
Constants
MYSQLI_INIT_COMMAND
Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.
public
mixed
MYSQLI_INIT_COMMAND
= \MYSQLI_INIT_COMMAND
Tags
MYSQLI_OPT_CONNECT_TIMEOUT
Connect timeout in seconds
public
mixed
MYSQLI_OPT_CONNECT_TIMEOUT
= \MYSQLI_OPT_CONNECT_TIMEOUT
Tags
MYSQLI_OPT_NET_CMD_BUFFER_SIZE
The size of the internal command/network buffer. Only valid for mysqlnd.
public
mixed
MYSQLI_OPT_NET_CMD_BUFFER_SIZE
= \MYSQLI_OPT_NET_CMD_BUFFER_SIZE
Tags
MYSQLI_OPT_NET_READ_BUFFER_SIZE
Maximum read chunk size in bytes when reading the body of a MySQL command packet. Only valid for mysqlnd.
public
mixed
MYSQLI_OPT_NET_READ_BUFFER_SIZE
= \MYSQLI_OPT_NET_READ_BUFFER_SIZE
Tags
MYSQLI_OPT_READ_TIMEOUT
Command execution result timeout in seconds. Available as of PHP 7.2.0.
public
mixed
MYSQLI_OPT_READ_TIMEOUT
= \MYSQLI_OPT_READ_TIMEOUT
Tags
MYSQLI_REPORT_ALL
Set all options on (report all), report all warnings/errors.
public
mixed
MYSQLI_REPORT_ALL
= \MYSQLI_REPORT_ALL
Tags
MYSQLI_REPORT_INDEX
Report if no index or bad index was used in a query.
public
mixed
MYSQLI_REPORT_INDEX
= \MYSQLI_REPORT_INDEX
Tags
MYSQLI_REPORT_STRICT
Throw a mysqli_sql_exception for errors instead of warnings.
public
mixed
MYSQLI_REPORT_STRICT
= \MYSQLI_REPORT_STRICT
Tags
MYSQLI_STORE_RESULT_COPY_DATA
Copy results from the internal mysqlnd buffer into the PHP variables fetched.
public
mixed
MYSQLI_STORE_RESULT_COPY_DATA
= \MYSQLI_STORE_RESULT_COPY_DATA
By default, mysqlnd will use a reference logic to avoid copying and duplicating results held in memory. For certain result sets, for example, result sets with many small rows, the copy approach can reduce the overall memory usage because PHP variables holding results may be released earlier (available with mysqlnd only)
Tags
MYSQLI_TRANS_COR_NO_RELEASE
Appends "NO RELEASE" to mysqli_commit() or mysqli_rollback().
public
mixed
MYSQLI_TRANS_COR_NO_RELEASE
= \MYSQLI_TRANS_COR_NO_RELEASE
The NO RELEASE clause asks the server to not disconnect the current client session after terminating the current transaction
Tags
MYSQLI_TRANS_COR_RELEASE
Appends "RELEASE" to mysqli_commit() or mysqli_rollback().
public
mixed
MYSQLI_TRANS_COR_RELEASE
= \MYSQLI_TRANS_COR_RELEASE
The RELEASE clause causes the server to disconnect the current client session after terminating the current transaction
Tags
MYSQLI_TRANS_START_READ_ONLY
Start the transaction as "START TRANSACTION READ ONLY" with mysqli_begin_transaction().
public
mixed
MYSQLI_TRANS_START_READ_ONLY
= \MYSQLI_TRANS_START_READ_ONLY
Tags
MYSQLI_TRANS_START_READ_WRITE
Start the transaction as "START TRANSACTION READ WRITE" with mysqli_begin_transaction().
public
mixed
MYSQLI_TRANS_START_READ_WRITE
= \MYSQLI_TRANS_START_READ_WRITE
Tags
SQL_MODE
Safe MySQL SQL_MODE
protected
mixed
SQL_MODE
= 'TRADITIONAL'
Tags
Properties
$isConnected
Flag indicating whether physical connection was established with remote server Is connected to remove server
protected
bool
$isConnected
= false
$isTransaction
Flag indicating whether SQL transaction was started WARNING: best-effort, only guaranteed when library is used correctly Is transaction started
protected
bool
$isTransaction
= false
$mysqli
Mysqli instance The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above
protected
mysqli|null
$mysqli
= null
Tags
Methods
__construct()
public
__construct([mysqli|null $resource = null ]) : mixed
Parameters
- $resource : mysqli|null = null
autocommit()
public
autocommit(bool $enable) : bool
Parameters
- $enable : bool
Return values
boolbeginTransactionReadonly()
public
beginTransactionReadonly() : bool
Tags
Return values
boolbeginTransactionReadwrite()
public
beginTransactionReadwrite() : bool
Tags
Return values
boolclose()
public
close() : bool
Return values
boolcommit()
public
commit() : bool
Return values
boolcommitAndRelease()
Commit transaction and release connection from server side
public
commitAndRelease() : bool
Return values
boolextractServerResponse()
public
extractServerResponse(MydbEnvironmentInterface $environment, array<int, string> &$events) : mysqli_result|null
Parameters
- $environment : MydbEnvironmentInterface
- $events : array<int, string>
Tags
Return values
mysqli_result|nullgetAffectedRows()
public
getAffectedRows() : int|null
Return values
int|nullgetConnectErrno()
public
getConnectErrno() : int|null
Return values
int|nullgetConnectError()
public
getConnectError() : string|null
Return values
string|nullgetErrNo()
public
getErrNo() : int|null
Return values
int|nullgetError()
public
getError() : string|null
Return values
string|nullgetInsertId()
public
getInsertId() : int|string|null
Tags
Return values
int|string|nullgetMysqli()
public
getMysqli() : mysqli|null
Return values
mysqli|nullgetWarnings()
public
getWarnings() : array<string|int, mixed>
Return values
array<string|int, mixed>init()
Allocate mysqli resource instance, no physical connection to remote is done
public
init() : bool
Return values
boolisConnected()
public
isConnected() : bool
Return values
boolisServerGone()
public
isServerGone() : bool
Return values
boolisTransactionOpen()
public
isTransactionOpen() : bool
Return values
boolmysqliReport()
public
mysqliReport(int $level) : bool
Parameters
- $level : int
Return values
boolreadServerResponse()
React to mysqli resource changes after query/command execution
public
readServerResponse(MydbEnvironmentInterface $environment) : MydbMysqliResult|null
Parameters
- $environment : MydbEnvironmentInterface
Return values
MydbMysqliResult|nullrealConnect()
public
realConnect(string $host, string $username, string $password, string $dbname, int|null $port, string|null $socket, int $flags) : bool
Parameters
- $host : string
- $username : string
- $password : string
- $dbname : string
- $port : int|null
- $socket : string|null
- $flags : int
Return values
boolrealEscapeString()
public
realEscapeString(string $string) : string|null
Parameters
- $string : string
Tags
Return values
string|nullrealQuery()
public
realQuery(string $query) : bool
Parameters
- $query : string
Tags
Return values
boolrollback()
public
rollback() : bool
Tags
Return values
boolsetTransactionIsolationLevel()
public
setTransactionIsolationLevel(string $level) : bool
Parameters
- $level : string
Return values
boolsetTransportOptions()
Set various options that affect mysqli resource, before connection is established
public
setTransportOptions(MydbOptionsInterface $options, MydbEnvironmentInterface $environment) : bool
Parameters
- $options : MydbOptionsInterface
- $environment : MydbEnvironmentInterface
Tags
Return values
boolgetFieldCount()
Returns fields count caused by query execution Requires store_result to be called first
protected
getFieldCount() : int|null
Tags
Return values
int|nullgetWarningCount()
Returns warnings caused by query execution Requires store_result to be called first
protected
getWarningCount() : int|null