phpDocumentor

MydbOptions
in package
implements MydbOptionsInterface

Tags
author

Sergei Shilko contact@sshilko.com

license

https://opensource.org/licenses/mit-license.php MIT

see
https://github.com/sshilko/php-sql-mydb

Table of Contents

Interfaces

MydbOptionsInterface

Constants

NET_CMD_BUFFER_SIZE_MAX  = 16384
NET_CMD_BUFFER_SIZE_MIN  = 4096
NET_READ_BUFFER_MAX  = 131072
NET_READ_BUFFER_MIN  = 8192

Properties

$autocommit  : bool
Recommended defaults: false for rw connection true for ro connection true for async connection
$charset  : string
$clientErrorLevel  : int
Sets mysqli error reporting mode
$connectTimeout  : int
MySql client connection timeout, seconds
$errorReporting  : int
$networkBufferSize  : int
Internal network buffer of mysqlnd.net_cmd_buffer_size bytes for every connection
$networkReadBuffer  : int
More memory for better performance
$nonInteractiveTimeout  : int
The number of seconds the server waits for activity on a non-interactive TCP/IP or UNIX File connection before closing it
$persistent  : bool
Transaction block will also carry over to the next script which uses that connection if script execution ends before the transaction block does
$readonly  : bool
Readonly connection
$readTimeout  : int
The timeout in seconds for each attempt to read from the server.
$serverSideSelectTimeout  : int
The execution timeout ONLY APPLIES TO "SELECT" statements, seconds X > 0, enabled X = 0, not enabled.
$timeZone  : string
Set session time zone
$transactionIsolationLevel  : string|null
Transaction isolation is one of the foundations of database processing.

Methods

getCharset()  : string
getClientErrorLevel()  : int
getConnectTimeout()  : int
getErrorReporting()  : int
getNetworkBufferSize()  : int
getNetworkReadBuffer()  : int
getNonInteractiveTimeout()  : int
getReadTimeout()  : int
getServerSideSelectTimeout()  : int
getTimeZone()  : string
getTransactionIsolationLevel()  : string|null
isAutocommit()  : bool
isPersistent()  : bool
isReadonly()  : bool
setAutocommit()  : void
setCharset()  : void
setClientErrorLevel()  : void
setConnectTimeout()  : void
setErrorReporting()  : void
setNetworkBufferSize()  : void
setNetworkReadBuffer()  : void
setNonInteractiveTimeout()  : void
setPersistent()  : void
setReadonly()  : void
setReadTimeout()  : void
setServerSideSelectTimeout()  : void
setTimeZone()  : void
setTransactionIsolationLevel()  : void

Constants

NET_CMD_BUFFER_SIZE_MAX

protected mixed NET_CMD_BUFFER_SIZE_MAX = 16384

NET_CMD_BUFFER_SIZE_MIN

protected mixed NET_CMD_BUFFER_SIZE_MIN = 4096

NET_READ_BUFFER_MAX

protected mixed NET_READ_BUFFER_MAX = 131072

NET_READ_BUFFER_MIN

protected mixed NET_READ_BUFFER_MIN = 8192

Properties

$autocommit

Recommended defaults: false for rw connection true for ro connection true for async connection

protected bool $autocommit = false

$clientErrorLevel

Sets mysqli error reporting mode

protected int $clientErrorLevel = \sql\MydbMysqli::MYSQLI_REPORT_ALL ^ \sql\MydbMysqli::MYSQLI_REPORT_STRICT ^ \sql\MydbMysqli::MYSQLI_REPORT_INDEX

=8.1.0 The default value is now MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. < 8.1.0 MYSQLI_REPORT_OFF.

MYSQLI_REPORT_OFF Turns reporting off MYSQLI_REPORT_ERROR Report errors from mysqli function calls MYSQLI_REPORT_STRICT Throw mysqli_sql_exception for errors instead of warnings MYSQLI_REPORT_INDEX Report if no index or bad index was used in a query MYSQLI_REPORT_ALL Set all options (report all)

Tags
see
https://www.php.net/manual/en/function.mysqli-report.php

$connectTimeout

MySql client connection timeout, seconds

protected int $connectTimeout = 5

$errorReporting

protected int $errorReporting = \E_ALL & ~\E_WARNING & ~\E_NOTICE

$networkBufferSize

Internal network buffer of mysqlnd.net_cmd_buffer_size bytes for every connection

protected int $networkBufferSize = 6144

Scope: connection.

Number of network command buffer extensions while sending commands from PHP to MySQL.

mysqlnd allocates an internal command/network buffer of mysqlnd.net_cmd_buffer_size (php.ini) bytes for every connection. If a MySQL Client Server protocol command, for example, COM_QUERY ("normal&quot query), does not fit into the buffer, mysqlnd will grow the buffer to what is needed for sending the command. Whenever the buffer gets extended for one connection command_buffer_too_small will be incremented by one.

If mysqlnd has to grow the buffer beyond its initial size of mysqlnd.net_cmd_buffer_size (php.ini) bytes for almost every connection, you should consider to increase the default size to avoid re-allocations.

The default can set either through the php.ini setting mysqlnd.net_cmd_buffer_size or using mysqli_options(MYSQLI_OPT_NET_CMD_BUFFER_SIZE, int size).

It is recommended to set the buffer size to no less than 4096 bytes because mysqlnd also uses it when reading certain communication packet from MySQL.

As of PHP 5.3.2 mysqlnd does not allow setting buffers smaller than 4096 bytes.

Default 4096

More memory usage, in exchange for better performance

Tags
see

mysqlnd.net_cmd_buffer_size

see
http://php.net/manual/en/mysqlnd.config.php

$networkReadBuffer

More memory for better performance

protected int $networkReadBuffer = 49152

Maximum read chunk size in bytes when reading the body of a MySQL command packet The MySQL client server protocol encapsulates all its commands in packets. The packets consist of a small header and a body with the actual payload

If a packet body is larger than mysqlnd.net_read_buffer_size bytes, mysqlnd has to call read() multiple times

This buffer controls how many bytes mysqlnd fetches from the PHP streams with one call. If a result set has less than 32kB in size, mysqlnd will call the PHP streams network functions only once, if it is larger more calls are needed

Default 32768

Tags
see

mysqlnd.net_read_buffer_size

see
http://php.net/manual/en/mysqlnd.config.php
see
http://blog.ulf-wendel.de/2007/php-mysqlnd-saves-40-memory-finally-new-tuning-options/

$nonInteractiveTimeout

The number of seconds the server waits for activity on a non-interactive TCP/IP or UNIX File connection before closing it

protected int $nonInteractiveTimeout = 7200

$readonly

Readonly connection

protected bool $readonly = false

$timeZone

Set session time zone

protected string $timeZone = 'UTC'

SET time_zone = timezone;

  • As the value 'SYSTEM', indicating that the server time zone is the same as the system time zone.
  • As a string, an offset from UTC of the form [H]H:MM, prefixed with a + or -, such as '+10:00', '-6:00' Prior to MySQL 8.0.19, this value had to be in the range '-12:59' to '+13:00'
  • As a named time zone, such as 'Europe/Helsinki', 'US/Eastern', 'MET', or 'UTC'.
Tags
see
https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html

$transactionIsolationLevel

Transaction isolation is one of the foundations of database processing.

protected string|null $transactionIsolationLevel = null

Isolation is the I in the acronym ACID; the isolation level is the setting that fine-tunes the balance between performance and reliability, consistency, and reproducibility of results when multiple transactions are making changes and performing queries at the same time.

Tags
see
https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html

Methods

getCharset()

public getCharset() : string
Return values
string

getClientErrorLevel()

public getClientErrorLevel() : int
Return values
int

getConnectTimeout()

public getConnectTimeout() : int
Return values
int

getErrorReporting()

public getErrorReporting() : int
Return values
int

getNetworkBufferSize()

public getNetworkBufferSize() : int
Return values
int

getNetworkReadBuffer()

public getNetworkReadBuffer() : int
Return values
int

getNonInteractiveTimeout()

public getNonInteractiveTimeout() : int
Return values
int

getReadTimeout()

public getReadTimeout() : int
Return values
int

getServerSideSelectTimeout()

public getServerSideSelectTimeout() : int
Return values
int

getTimeZone()

public getTimeZone() : string
Return values
string

getTransactionIsolationLevel()

public getTransactionIsolationLevel() : string|null
Return values
string|null

isAutocommit()

public isAutocommit() : bool
Return values
bool

isPersistent()

public isPersistent() : bool
Return values
bool

isReadonly()

public isReadonly() : bool
Return values
bool

setAutocommit()

public setAutocommit(bool $autocommit) : void
Parameters
$autocommit : bool

setCharset()

public setCharset(string $charset) : void
Parameters
$charset : string

setClientErrorLevel()

public setClientErrorLevel(int $mysqliReport) : void
Parameters
$mysqliReport : int
Tags
throws
OptionException

setConnectTimeout()

public setConnectTimeout(int $seconds) : void
Parameters
$seconds : int

setErrorReporting()

public setErrorReporting(int $errorReporting) : void
Parameters
$errorReporting : int

setNetworkBufferSize()

public setNetworkBufferSize(int $bytes) : void
Parameters
$bytes : int

bytes

Tags
throws
OptionException

setNonInteractiveTimeout()

public setNonInteractiveTimeout(int $nonInteractiveTimeout) : void
Parameters
$nonInteractiveTimeout : int

setPersistent()

public setPersistent(bool $persistent) : void
Parameters
$persistent : bool

setReadonly()

public setReadonly(bool $readonly) : void
Parameters
$readonly : bool

setReadTimeout()

public setReadTimeout(int $seconds) : void
Parameters
$seconds : int

setServerSideSelectTimeout()

public setServerSideSelectTimeout(int $seconds) : void
Parameters
$seconds : int

setTimeZone()

public setTimeZone(string $timeZone) : void
Parameters
$timeZone : string

setTransactionIsolationLevel()

public setTransactionIsolationLevel(string $isolationLevel) : void
Parameters
$isolationLevel : string

        
On this page

Search results