|
Spec-Zone .ru
спецификации, руководства, описания, API
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection {
MysqlndUhConnectionMethodspublic bool MysqlndUhConnection::changeUser(mysqlnd_connection connection,
string user,
string password,
string database,
bool silent,
int passwd_len);public string MysqlndUhConnection::charsetName(mysqlnd_connection connection);public bool MysqlndUhConnection::close(mysqlnd_connection connection,
int close_type);public bool MysqlndUhConnection::connect(mysqlnd_connection connection,
string host,
string use",
string password,
string database,
int port,
string socket,
int mysql_flags);public MysqlndUhConnection::__construct();public bool MysqlndUhConnection::endPSession(mysqlnd_connection connection);public string MysqlndUhConnection::escapeString(mysqlnd_connection connection,
string escape_string);public int MysqlndUhConnection::getAffectedRows(mysqlnd_connection connection);public int MysqlndUhConnection::getErrorNumber(mysqlnd_connection connection);public string MysqlndUhConnection::getErrorString(mysqlnd_connection connection);public int MysqlndUhConnection::getFieldCount(mysqlnd_connection connection);public string MysqlndUhConnection::getHostInformation(mysqlnd_connection connection);public int MysqlndUhConnection::getLastInsertId(mysqlnd_connection connection);public void MysqlndUhConnection::getLastMessage(mysqlnd_connection connection);public string MysqlndUhConnection::getProtocolInformation(mysqlnd_connection connection);public string MysqlndUhConnection::getServerInformation(mysqlnd_connection connection);public string MysqlndUhConnection::getServerStatistics(mysqlnd_connection connection);public int MysqlndUhConnection::getServerVersion(mysqlnd_connection connection);public string MysqlndUhConnection::getSqlstate(mysqlnd_connection connection);public array MysqlndUhConnection::getStatistics(mysqlnd_connection connection);public int MysqlndUhConnection::getThreadId(mysqlnd_connection connection);public int MysqlndUhConnection::getWarningCount(mysqlnd_connection connection);public bool MysqlndUhConnection::init(mysqlnd_connection connection);public bool MysqlndUhConnection::killConnection(mysqlnd_connection connection,
int pid);public array MysqlndUhConnection::listFields(mysqlnd_connection connection,
string table,
string achtung_wild);public void MysqlndUhConnection::listMethod(mysqlnd_connection connection,
string query,
string achtung_wild,
string par1);public bool MysqlndUhConnection::moreResults(mysqlnd_connection connection);public bool MysqlndUhConnection::nextResult(mysqlnd_connection connection);public bool MysqlndUhConnection::ping(mysqlnd_connection connection);public bool MysqlndUhConnection::query(mysqlnd_connection connection,
string query);public bool MysqlndUhConnection::queryReadResultsetHeader(mysqlnd_connection connection,
mysqlnd_statement mysqlnd_stmt);public bool MysqlndUhConnection::reapQuery(mysqlnd_connection connection);public bool MysqlndUhConnection::refreshServer(mysqlnd_connection connection,
int options);public bool MysqlndUhConnection::restartPSession(mysqlnd_connection connection);public bool MysqlndUhConnection::selectDb(mysqlnd_connection connection,
string database);public bool MysqlndUhConnection::sendClose(mysqlnd_connection connection);public bool MysqlndUhConnection::sendQuery(mysqlnd_connection connection,
string query);public bool MysqlndUhConnection::serverDumpDebugInformation(mysqlnd_connection connection);public bool MysqlndUhConnection::setAutocommit(mysqlnd_connection connection,
int mode);public bool MysqlndUhConnection::setCharset(mysqlnd_connection connection,
string charset);public bool MysqlndUhConnection::setClientOption(mysqlnd_connection connection,
int option,
int value);public void MysqlndUhConnection::setServerOption(mysqlnd_connection connection,
int option);public void MysqlndUhConnection::shutdownServer(string MYSQLND_UH_RES_MYSQLND_NAME,
string "level");public bool MysqlndUhConnection::simpleCommand(mysqlnd_connection connection,
int command,
string arg,
int ok_packet,
bool silent,
bool ignore_upsert_status);public bool MysqlndUhConnection::simpleCommandHandleResponse(mysqlnd_connection connection,
int ok_packet,
bool silent,
int command,
bool ignore_upsert_status);public bool MysqlndUhConnection::sslSet(mysqlnd_connection connection,
string key,
string cert,
string ca,
string capath,
string cipher);public resource MysqlndUhConnection::stmtInit(mysqlnd_connection connection);public resource MysqlndUhConnection::storeResult(mysqlnd_connection connection);public bool MysqlndUhConnection::txCommit(mysqlnd_connection connection);public bool MysqlndUhConnection::txRollback(mysqlnd_connection connection);public resource MysqlndUhConnection::useResult(mysqlnd_connection connection);
}
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::changeUser
Changes the user of the specified mysqlnd database connection
Description
public bool MysqlndUhConnection::changeUser(mysqlnd_connection connection,
string user,
string password,
string database,
bool silent,
int passwd_len);
Changes the user of the specified mysqlnd database connection
Parameters
connection
Mysqlnd connection handle. Do not modify!
user The MySQL user name.
password
The MySQL password.
database
The MySQL database to change to.
silent Controls if mysqlnd is allowed to emit errors or not.
passwd_len
Length of the MySQL password.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.340. MysqlndUhConnection::changeUserexample
<?phpclass proxy extends MysqlndUhConnection { /* Hook mysqlnd's connection::change_user call */ public function changeUser($res, $user, $passwd, $db, $silent, $passwd_len) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::changeUser($res, $user, $passwd, $db, $silent, $passwd_len); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}/* Install proxy/hooks to be used with all future mysqlnd connection */mysqlnd_uh_set_connection_proxy(new proxy());/* Create mysqli connection which is using the mysqlnd library */$mysqli = new mysqli("localhost", "root", "", "test");/* Example of a user API call which triggers the hooked mysqlnd call */var_dump($mysqli->change_user("root", "bar", "test"));?>
The above example will output:
proxy::changeUser(array ( 0 => NULL, 1 => 'root', 2 => 'bar', 3 => 'test', 4 => false, 5 => 3,))proxy::changeUser returns falsebool(false)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_change_user
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::charsetName
Returns the default character set for the database connection
Description
public string MysqlndUhConnection::charsetName(mysqlnd_connection connection);
Returns the default character set for the database connection.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
The default character set.
Examples
Example 22.341. MysqlndUhConnection::charsetNameexample
<?phpclass proxy extends MysqlndUhConnection { public function charsetName($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::charsetName($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump(mysqli_character_set_name($mysqli));?>
The above example will output:
proxy::charsetName(array ( 0 => NULL,))proxy::charsetName returns 'latin1'string(6) "latin1"
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_character_set_name
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::close
Closes a previously opened database connection
Description
public bool MysqlndUhConnection::close(mysqlnd_connection connection,
int close_type);
Closes a previously opened database connection.
Failing to call the parent implementation may cause memory leaks or crash PHP. This is not
considered a bug. Please, keep in mind that the mysqlnd library functions
have never been designed to be exposed to the user space.
Parameters
connection
The connection to be closed. Do not modify!
close_type
Why the connection is to be closed. The value of close_type is one of MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT
, MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT , MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED
or MYSQLND_UH_MYSQLND_CLOSE_LAST . The latter should never be seen,
unless the default behaviour of the mysqlnd library has been changed by
a plugin.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.342. MysqlndUhConnection::closeexample
<?phpfunction close_type_to_string($close_type) { $mapping = array( MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED => "MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED", MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT => "MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT", MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT => "MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT", MYSQLND_UH_MYSQLND_CLOSE_LAST => "MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT" ); return (isset($mapping[$close_type])) ? $mapping[$close_type] : 'unknown';}class proxy extends MysqlndUhConnection { public function close($res, $close_type) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); printf("close_type = %s\n", close_type_to_string($close_type)); /* WARNING: you must call the parent */ $ret = parent::close($res, $close_type); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->close();?>
The above example will output:
proxy::close(array ( 0 => NULL, 1 => 0,))close_type = MYSQLND_UH_MYSQLND_CLOSE_EXPLICITproxy::close returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_close
|
mysql_close |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::connect
Open a new connection to the MySQL server
Description
public bool MysqlndUhConnection::connect(mysqlnd_connection connection,
string host,
string use",
string password,
string database,
int port,
string socket,
int mysql_flags);
Open a new connection to the MySQL server.
Parameters
connection
Mysqlnd connection handle. Do not modify!
host Can be either a host name or an IP address. Passing the NULL value or the string "localhost" to this parameter, the local host is assumed. When possible, pipes will be used instead of the TCP/IP protocol.
user The MySQL user name.
password
If not provided or NULL , the MySQL server will attempt to
authenticate the user against those user records which have no password only. This allows one
username to be used with different permissions (depending on if a password as provided or not).
database
If provided will specify the default database to be used when performing queries.
port Specifies the port number to attempt to connect to the MySQL server.
socket Specifies the socket or named pipe that should be used. If NULL ,
mysqlnd will default to /tmp/mysql.sock.
mysql_flags
Connection options.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.343. MysqlndUhConnection::connectexample
<?phpclass proxy extends MysqlndUhConnection { public function connect($res, $host, $user, $passwd, $db, $port, $socket, $mysql_flags) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::connect($res, $host, $user, $passwd, $db, $port, $socket, $mysql_flags); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");?>
The above example will output:
proxy::connect(array ( 0 => NULL, 1 => 'localhost', 2 => 'root', 3 => '', 4 => 'test', 5 => 3306, 6 => NULL, 7 => 131072,))proxy::connect returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_connect |
mysql_connect |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::__construct
The __construct purpose
Description
public MysqlndUhConnection::__construct();
This function iscurrently not documented; only its argument list is available.
Parameters
This function has no parameters.
Return Values
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::endPSession
End a persistent connection
Description
public bool MysqlndUhConnection::endPSession(mysqlnd_connection connection);
End a persistent connection
This function iscurrently not documented; only its argument list is available.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.344. MysqlndUhConnection::endPSessionexample
<?phpclass proxy extends MysqlndUhConnection { public function endPSession($conn) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::endPSession($conn); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("p:localhost", "root", "", "test");$mysqli->close();?>
The above example will output:
proxy::endPSession(array ( 0 => NULL,))proxy::endPSession returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::escapeString
Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
Description
public string MysqlndUhConnection::escapeString(mysqlnd_connection connection,
string escape_string);
Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection.
Parameters
MYSQLND_UH_RES_MYSQLND_NAME
Mysqlnd connection handle. Do not modify!
escape_string The string to be escaped.
Return Values
The escaped string.
Examples
Example 22.345. MysqlndUhConnection::escapeStringexample
<?phpclass proxy extends MysqlndUhConnection { public function escapeString($res, $string) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::escapeString($res, $string); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->set_charset("latin1");$mysqli->real_escape_string("test0'test");?>
The above example will output:
proxy::escapeString(array ( 0 => NULL, 1 => 'test0\'test',))proxy::escapeString returns 'test0\\\'test'
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_real_escape_string |
mysql_real_escape_string |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getAffectedRows
Gets the number of affected rows in a previous MySQL operation
Description
public int MysqlndUhConnection::getAffectedRows(mysqlnd_connection connection);
Gets the number of affected rows in a previous MySQL operation.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Number of affected rows.
Examples
Example 22.346. MysqlndUhConnection::getAffectedRowsexample
<?phpclass proxy extends MysqlndUhConnection { public function getAffectedRows($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getAffectedRows($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->query("DROP TABLE IF EXISTS test");$mysqli->query("CREATE TABLE test(id INT)");$mysqli->query("INSERT INTO test(id) VALUES (1)");var_dump($mysqli->affected_rows);?>
The above example will output:
proxy::getAffectedRows(array ( 0 => NULL,))proxy::getAffectedRows returns 1int(1)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_affected_rows
|
mysql_affected_rows
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getErrorNumber
Returns the error code for the most recent function call
Description
public int MysqlndUhConnection::getErrorNumber(mysqlnd_connection connection);
Returns the error code for the most recent function call.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Error code for the most recent function call.
Examples
MysqlndUhConnection::getErrorNumber
is not only executed after the invocation of a user space API call which maps directly to it but also called
internally.
Example 22.347. MysqlndUhConnection::getErrorNumberexample
<?phpclass proxy extends MysqlndUhConnection { public function getErrorNumber($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getErrorNumber($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());printf("connect...\n");$mysqli = new mysqli("localhost", "root", "", "test");printf("query...\n");$mysqli->query("PLEASE_LET_THIS_BE_INVALID_SQL");printf("errno...\n");var_dump($mysqli->errno);printf("close...\n");$mysqli->close();?>
The above example will output:
connect...proxy::getErrorNumber(array ( 0 => NULL,))proxy::getErrorNumber returns 0query...errno...proxy::getErrorNumber(array ( 0 => NULL,))proxy::getErrorNumber returns 1064int(1064)close...
See Also
mysqlnd_uh_set_connection_proxy
|
MysqlndUhConnection::getErrorString
|
mysqli_errno
|
mysql_errno |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getErrorString
Returns a string description of the last error
Description
public string MysqlndUhConnection::getErrorString(mysqlnd_connection connection);
Returns a string description of the last error.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Error string for the most recent function call.
Examples
MysqlndUhConnection::getErrorString
is not only executed after the invocation of a user space API call which maps directly to it but also called
internally.
Example 22.348. MysqlndUhConnection::getErrorStringexample
<?phpclass proxy extends MysqlndUhConnection { public function getErrorString($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getErrorString($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());printf("connect...\n");$mysqli = new mysqli("localhost", "root", "", "test");printf("query...\n");$mysqli->query("WILL_I_EVER_LEARN_SQL?");printf("errno...\n");var_dump($mysqli->error);printf("close...\n");$mysqli->close();?>
The above example will output:
connect...proxy::getErrorString(array ( 0 => NULL,))proxy::getErrorString returns ''query...errno...proxy::getErrorString(array ( 0 => NULL,))proxy::getErrorString returns 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'WILL_I_EVER_LEARN_SQL?\' at line 1'string(168) "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WILL_I_EVER_LEARN_SQL?' at line 1"close...
See Also
mysqlnd_uh_set_connection_proxy
|
MysqlndUhConnection::getErrorNumber
|
mysqli_error
|
mysql_error |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getFieldCount
Returns the number of columns for the most recent query
Description
public int MysqlndUhConnection::getFieldCount(mysqlnd_connection connection);
Returns the number of columns for the most recent query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Number of columns.
Examples
MysqlndUhConnection::getFieldCount
is not only executed after the invocation of a user space API call which maps directly to it but also called
internally.
Example 22.349. MysqlndUhConnection::getFieldCountexample
<?phpclass proxy extends MysqlndUhConnection { public function getFieldCount($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getFieldCount($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->query("WILL_I_EVER_LEARN_SQL?");var_dump($mysqli->field_count);$mysqli->query("SELECT 1, 2, 3 FROM DUAL");var_dump($mysqli->field_count);?>
The above example will output:
proxy::getFieldCount(array ( 0 => NULL,))proxy::getFieldCount returns 0int(0)proxy::getFieldCount(array ( 0 => NULL,))proxy::getFieldCount returns 3proxy::getFieldCount(array ( 0 => NULL,))proxy::getFieldCount returns 3int(3)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_field_count
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getHostInformation
Returns a string representing the type of connection used
Description
public string MysqlndUhConnection::getHostInformation(mysqlnd_connection connection);
Returns a string representing the type of connection used.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Connection description.
Examples
Example 22.350. MysqlndUhConnection::getHostInformationexample
<?phpclass proxy extends MysqlndUhConnection { public function getHostInformation($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getHostInformation($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->host_info);?>
The above example will output:
proxy::getHostInformation(array ( 0 => NULL,))proxy::getHostInformation returns 'Localhost via UNIX socket'string(25) "Localhost via UNIX socket"
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_get_host_info
|
mysql_get_host_info
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getLastInsertId
Returns the auto generated id used in the last query.
Description
public int MysqlndUhConnection::getLastInsertId(mysqlnd_connection connection);
Returns the auto generated id used in the last query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Last insert id.
Examples
Example 22.351. MysqlndUhConnection::getLastInsertIdexample
<?phpclass proxy extends MysqlndUhConnection { public function getLastInsertId($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getLastInsertId($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->query("DROP TABLE IF EXISTS test");$mysqli->query("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col VARCHAR(255))");$mysqli->query("INSERT INTO test(col) VALUES ('a')");var_dump($mysqli->insert_id);?>
The above example will output:
proxy::getLastInsertId(array ( 0 => NULL,))proxy::getLastInsertId returns 1int(1)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_insert_id |
mysql_insert_id |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getLastMessage
Retrieves information about the most recently executed query
Description
public void MysqlndUhConnection::getLastMessage(mysqlnd_connection connection);
Retrieves information about the most recently executed query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Last message. Trying to return a string longer than 511 bytes will cause an error of the type E_WARNING and result in the string being truncated.
Examples
Example 22.352. MysqlndUhConnection::getLastMessageexample
<?phpclass proxy extends MysqlndUhConnection { public function getLastMessage($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getLastMessage($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->info);$mysqli->query("DROP TABLE IF EXISTS test");var_dump($mysqli->info);?>
The above example will output:
proxy::getLastMessage(array ( 0 => NULL,))proxy::getLastMessage returns ''string(0) ""proxy::getLastMessage(array ( 0 => NULL,))proxy::getLastMessage returns ''string(0) ""
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_info
|
mysql_info |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getProtocolInformation
Returns the version of the MySQL protocol used
Description
public string MysqlndUhConnection::getProtocolInformation(mysqlnd_connection connection);
Returns the version of the MySQL protocol used.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
The protocol version.
Examples
Example 22.353. MysqlndUhConnection::getProtocolInformationexample
<?phpclass proxy extends MysqlndUhConnection { public function getProtocolInformation($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getProtocolInformation($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->protocol_version);?>
The above example will output:
proxy::getProtocolInformation(array ( 0 => NULL,))proxy::getProtocolInformation returns 10int(10)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_get_proto_info
|
mysql_get_proto_info
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getServerInformation
Returns the version of the MySQL server
Description
public string MysqlndUhConnection::getServerInformation(mysqlnd_connection connection);
Returns the version of the MySQL server.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
The server version.
Examples
Example 22.354. MysqlndUhConnection::getServerInformationexample
<?phpclass proxy extends MysqlndUhConnection { public function getServerInformation($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getServerInformation($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->server_info);?>
The above example will output:
proxy::getServerInformation(array ( 0 => NULL,))proxy::getServerInformation returns '5.1.45-debug-log'string(16) "5.1.45-debug-log"
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_get_server_info
|
mysql_get_server_info |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getServerStatistics
Gets the current system status
Description
public string MysqlndUhConnection::getServerStatistics(mysqlnd_connection connection);
Gets the current system status.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
The system status message.
Examples
Example 22.355. MysqlndUhConnection::getServerStatisticsexample
<?phpclass proxy extends MysqlndUhConnection { public function getServerStatistics($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getServerStatistics($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump(mysqli_stat($mysqli));?>
The above example will output:
proxy::getServerStatistics(array ( 0 => NULL,))proxy::getServerStatistics returns 'Uptime: 2059995 Threads: 1 Questions: 126157 Slow queries: 0 Opens: 6377 Flush tables: 1 Open tables: 18 Queries per second avg: 0.61'string(140) "Uptime: 2059995 Threads: 1 Questions: 126157 Slow queries: 0 Opens: 6377 Flush tables: 1 Open tables: 18 Queries per second avg: 0.61"
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_stat |
mysql_stat |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getServerVersion
Returns the version of the MySQL server as an integer
Description
public int MysqlndUhConnection::getServerVersion(mysqlnd_connection connection);
Returns the version of the MySQL server as an integer.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
The MySQL version.
Examples
Example 22.356. MysqlndUhConnection::getServerVersionexample
<?phpclass proxy extends MysqlndUhConnection { public function getServerVersion($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getServerVersion($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->server_version);?>
The above example will output:
proxy::getServerVersion(array ( 0 => NULL,))proxy::getServerVersion returns 50145int(50145)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_get_server_version
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getSqlstate
Returns the SQLSTATE error from previous MySQL operation
Description
public string MysqlndUhConnection::getSqlstate(mysqlnd_connection connection);
Returns the SQLSTATE error from previous MySQL operation.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
The SQLSTATE code.
Examples
Example 22.357. MysqlndUhConnection::getSqlstateexample
<?phpclass proxy extends MysqlndUhConnection { public function getSqlstate($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getSqlstate($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->sqlstate);$mysqli->query("AN_INVALID_REQUEST_TO_PROVOKE_AN_ERROR");var_dump($mysqli->sqlstate);?>
The above example will output:
proxy::getSqlstate(array ( 0 => NULL,))proxy::getSqlstate returns '00000'string(5) "00000"proxy::getSqlstate(array ( 0 => NULL,))proxy::getSqlstate returns '42000'string(5) "42000"
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getStatistics
Returns statistics about the client connection.
Description
public array MysqlndUhConnection::getStatistics(mysqlnd_connection connection);
Returns statistics about the client connection.
This function iscurrently not documented; only its argument list is available.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Connection statistics collected by mysqlnd.
Examples
Example 22.358. MysqlndUhConnection::getStatisticsexample
<?phpclass proxy extends MysqlndUhConnection { public function getStatistics($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getStatistics($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->get_connection_stats());?>
The above example will output:
proxy::getStatistics(array ( 0 => NULL,))proxy::getStatistics returns array ( 'bytes_sent' => '73', 'bytes_received' => '77', 'packets_sent' => '2', 'packets_received' => '2', 'protocol_overhead_in' => '8', 'protocol_overhead_out' => '8', 'bytes_received_ok_packet' => '0', 'bytes_received_eof_packet' => '0', 'bytes_received_rset_header_packet' => '0', 'bytes_received_rset_field_meta_packet' => '0', 'bytes_received_rset_row_packet' => '0', 'bytes_received_prepare_response_packet' => '0', 'bytes_received_change_user_packet' => '0', 'packets_sent_command' => '0', 'packets_received_ok' => '0', 'packets_received_eof' => '0', 'packets_received_rset_header' => '0', 'packets_received_rset_field_meta' => '0', 'packets_received_rset_row' => '0', 'packets_received_prepare_response' => '0', 'packets_received_change_user' => '0', 'result_set_queries' => '0', 'non_result_set_queries' => '0', 'no_index_used' => '0', 'bad_index_used' => '0', 'slow_queries' => '0', 'buffered_sets' => '0', 'unbuffered_sets' => '0', 'ps_buffered_sets' => '0', 'ps_unbuffered_sets' => '0', 'flushed_normal_sets' => '0', 'flushed_ps_sets' => '0', 'ps_prepared_never_executed' => '0', 'ps_prepared_once_executed' => '0', 'rows_fetched_from_server_normal' => '0', 'rows_fetched_from_server_ps' => '0', 'rows_buffered_from_client_normal' => '0', 'rows_buffered_from_client_ps' => '0', 'rows_fetched_from_client_normal_buffered' => '0', 'rows_fetched_from_client_normal_unbuffered' => '0', 'rows_fetched_from_client_ps_buffered' => '0', 'rows_fetched_from_client_ps_unbuffered' => '0', 'rows_fetched_from_client_ps_cursor' => '0', 'rows_affected_normal' => '0', 'rows_affected_ps' => '0', 'rows_skipped_normal' => '0', 'rows_skipped_ps' => '0', 'copy_on_write_saved' => '0', 'copy_on_write_performed' => '0', 'command_buffer_too_small' => '0', 'connect_success' => '1', 'connect_failure' => '0', 'connection_reused' => '0', 'reconnect' => '0', 'pconnect_success' => '0', 'active_connections' => '1', 'active_persistent_connections' => '0', 'explicit_close' => '0', 'implicit_close' => '0', 'disconnect_close' => '0', 'in_middle_of_command_close' => '0', 'explicit_free_result' => '0', 'implicit_free_result' => '0', 'explicit_stmt_close' => '0', 'implicit_stmt_close' => '0', 'mem_emalloc_count' => '0', 'mem_emalloc_amount' => '0', 'mem_ecalloc_count' => '0', 'mem_ecalloc_amount' => '0', 'mem_erealloc_count' => '0', 'mem_erealloc_amount' => '0', 'mem_efree_count' => '0', 'mem_efree_amount' => '0', 'mem_malloc_count' => '0', 'mem_malloc_amount' => '0', 'mem_calloc_count' => '0', 'mem_calloc_amount' => '0', 'mem_realloc_count' => '0', 'mem_realloc_amount' => '0', 'mem_free_count' => '0', 'mem_free_amount' => '0', 'mem_estrndup_count' => '0', 'mem_strndup_count' => '0', 'mem_estndup_count' => '0', 'mem_strdup_count' => '0', 'proto_text_fetched_null' => '0', 'proto_text_fetched_bit' => '0', 'proto_text_fetched_tinyint' => '0', 'proto_text_fetched_short' => '0', 'proto_text_fetched_int24' => '0', 'proto_text_fetched_int' => '0', 'proto_text_fetched_bigint' => '0', 'proto_text_fetched_decimal' => '0', 'proto_text_fetched_float' => '0', 'proto_text_fetched_double' => '0', 'proto_text_fetched_date' => '0', 'proto_text_fetched_year' => '0', 'proto_text_fetched_time' => '0', 'proto_text_fetched_datetime' => '0', 'proto_text_fetched_timestamp' => '0', 'proto_text_fetched_string' => '0', 'proto_text_fetched_blob' => '0', 'proto_text_fetched_enum' => '0', 'proto_text_fetched_set' => '0', 'proto_text_fetched_geometry' => '0', 'proto_text_fetched_other' => '0', 'proto_binary_fetched_null' => '0', 'proto_binary_fetched_bit' => '0', 'proto_binary_fetched_tinyint' => '0', 'proto_binary_fetched_short' => '0', 'proto_binary_fetched_int24' => '0', 'proto_binary_fetched_int' => '0', 'proto_binary_fetched_bigint' => '0', 'proto_binary_fetched_decimal' => '0', 'proto_binary_fetched_float' => '0', 'proto_binary_fetched_double' => '0', 'proto_binary_fetched_date' => '0', 'proto_binary_fetched_year' => '0', 'proto_binary_fetched_time' => '0', 'proto_binary_fetched_datetime' => '0', 'proto_binary_fetched_timestamp' => '0', 'proto_binary_fetched_string' => '0', 'proto_binary_fetched_blob' => '0', 'proto_binary_fetched_enum' => '0', 'proto_binary_fetched_set' => '0', 'proto_binary_fetched_geometry' => '0', 'proto_binary_fetched_other' => '0', 'init_command_executed_count' => '0', 'init_command_failed_count' => '0', 'com_quit' => '0', 'com_init_db' => '0', 'com_query' => '0', 'com_field_list' => '0', 'com_create_db' => '0', 'com_drop_db' => '0', 'com_refresh' => '0', 'com_shutdown' => '0', 'com_statistics' => '0', 'com_process_info' => '0', 'com_connect' => '0', 'com_process_kill' => '0', 'com_debug' => '0', 'com_ping' => '0', 'com_time' => '0', 'com_delayed_insert' => '0', 'com_change_user' => '0', 'com_binlog_dump' => '0', 'com_table_dump' => '0', 'com_connect_out' => '0', 'com_register_slave' => '0', 'com_stmt_prepare' => '0', 'com_stmt_execute' => '0', 'com_stmt_send_long_data' => '0', 'com_stmt_close' => '0', 'com_stmt_reset' => '0', 'com_stmt_set_option' => '0', 'com_stmt_fetch' => '0', 'com_deamon' => '0', 'bytes_received_real_data_normal' => '0', 'bytes_received_real_data_ps' => '0',)array(160) { ["bytes_sent"]=> string(2) "73" ["bytes_received"]=> string(2) "77" ["packets_sent"]=> string(1) "2" ["packets_received"]=> string(1) "2" ["protocol_overhead_in"]=> string(1) "8" ["protocol_overhead_out"]=> string(1) "8" ["bytes_received_ok_packet"]=> string(1) "0" ["bytes_received_eof_packet"]=> string(1) "0" ["bytes_received_rset_header_packet"]=> string(1) "0" ["bytes_received_rset_field_meta_packet"]=> string(1) "0" ["bytes_received_rset_row_packet"]=> string(1) "0" ["bytes_received_prepare_response_packet"]=> string(1) "0" ["bytes_received_change_user_packet"]=> string(1) "0" ["packets_sent_command"]=> string(1) "0" ["packets_received_ok"]=> string(1) "0" ["packets_received_eof"]=> string(1) "0" ["packets_received_rset_header"]=> string(1) "0" ["packets_received_rset_field_meta"]=> string(1) "0" ["packets_received_rset_row"]=> string(1) "0" ["packets_received_prepare_response"]=> string(1) "0" ["packets_received_change_user"]=> string(1) "0" ["result_set_queries"]=> string(1) "0" ["non_result_set_queries"]=> string(1) "0" ["no_index_used"]=> string(1) "0" ["bad_index_used"]=> string(1) "0" ["slow_queries"]=> string(1) "0" ["buffered_sets"]=> string(1) "0" ["unbuffered_sets"]=> string(1) "0" ["ps_buffered_sets"]=> string(1) "0" ["ps_unbuffered_sets"]=> string(1) "0" ["flushed_normal_sets"]=> string(1) "0" ["flushed_ps_sets"]=> string(1) "0" ["ps_prepared_never_executed"]=> string(1) "0" ["ps_prepared_once_executed"]=> string(1) "0" ["rows_fetched_from_server_normal"]=> string(1) "0" ["rows_fetched_from_server_ps"]=> string(1) "0" ["rows_buffered_from_client_normal"]=> string(1) "0" ["rows_buffered_from_client_ps"]=> string(1) "0" ["rows_fetched_from_client_normal_buffered"]=> string(1) "0" ["rows_fetched_from_client_normal_unbuffered"]=> string(1) "0" ["rows_fetched_from_client_ps_buffered"]=> string(1) "0" ["rows_fetched_from_client_ps_unbuffered"]=> string(1) "0" ["rows_fetched_from_client_ps_cursor"]=> string(1) "0" ["rows_affected_normal"]=> string(1) "0" ["rows_affected_ps"]=> string(1) "0" ["rows_skipped_normal"]=> string(1) "0" ["rows_skipped_ps"]=> string(1) "0" ["copy_on_write_saved"]=> string(1) "0" ["copy_on_write_performed"]=> string(1) "0" ["command_buffer_too_small"]=> string(1) "0" ["connect_success"]=> string(1) "1" ["connect_failure"]=> string(1) "0" ["connection_reused"]=> string(1) "0" ["reconnect"]=> string(1) "0" ["pconnect_success"]=> string(1) "0" ["active_connections"]=> string(1) "1" ["active_persistent_connections"]=> string(1) "0" ["explicit_close"]=> string(1) "0" ["implicit_close"]=> string(1) "0" ["disconnect_close"]=> string(1) "0" ["in_middle_of_command_close"]=> string(1) "0" ["explicit_free_result"]=> string(1) "0" ["implicit_free_result"]=> string(1) "0" ["explicit_stmt_close"]=> string(1) "0" ["implicit_stmt_close"]=> string(1) "0" ["mem_emalloc_count"]=> string(1) "0" ["mem_emalloc_amount"]=> string(1) "0" ["mem_ecalloc_count"]=> string(1) "0" ["mem_ecalloc_amount"]=> string(1) "0" ["mem_erealloc_count"]=> string(1) "0" ["mem_erealloc_amount"]=> string(1) "0" ["mem_efree_count"]=> string(1) "0" ["mem_efree_amount"]=> string(1) "0" ["mem_malloc_count"]=> string(1) "0" ["mem_malloc_amount"]=> string(1) "0" ["mem_calloc_count"]=> string(1) "0" ["mem_calloc_amount"]=> string(1) "0" ["mem_realloc_count"]=> string(1) "0" ["mem_realloc_amount"]=> string(1) "0" ["mem_free_count"]=> string(1) "0" ["mem_free_amount"]=> string(1) "0" ["mem_estrndup_count"]=> string(1) "0" ["mem_strndup_count"]=> string(1) "0" ["mem_estndup_count"]=> string(1) "0" ["mem_strdup_count"]=> string(1) "0" ["proto_text_fetched_null"]=> string(1) "0" ["proto_text_fetched_bit"]=> string(1) "0" ["proto_text_fetched_tinyint"]=> string(1) "0" ["proto_text_fetched_short"]=> string(1) "0" ["proto_text_fetched_int24"]=> string(1) "0" ["proto_text_fetched_int"]=> string(1) "0" ["proto_text_fetched_bigint"]=> string(1) "0" ["proto_text_fetched_decimal"]=> string(1) "0" ["proto_text_fetched_float"]=> string(1) "0" ["proto_text_fetched_double"]=> string(1) "0" ["proto_text_fetched_date"]=> string(1) "0" ["proto_text_fetched_year"]=> string(1) "0" ["proto_text_fetched_time"]=> string(1) "0" ["proto_text_fetched_datetime"]=> string(1) "0" ["proto_text_fetched_timestamp"]=> string(1) "0" ["proto_text_fetched_string"]=> string(1) "0" ["proto_text_fetched_blob"]=> string(1) "0" ["proto_text_fetched_enum"]=> string(1) "0" ["proto_text_fetched_set"]=> string(1) "0" ["proto_text_fetched_geometry"]=> string(1) "0" ["proto_text_fetched_other"]=> string(1) "0" ["proto_binary_fetched_null"]=> string(1) "0" ["proto_binary_fetched_bit"]=> string(1) "0" ["proto_binary_fetched_tinyint"]=> string(1) "0" ["proto_binary_fetched_short"]=> string(1) "0" ["proto_binary_fetched_int24"]=> string(1) "0" ["proto_binary_fetched_int"]=> string(1) "0" ["proto_binary_fetched_bigint"]=> string(1) "0" ["proto_binary_fetched_decimal"]=> string(1) "0" ["proto_binary_fetched_float"]=> string(1) "0" ["proto_binary_fetched_double"]=> string(1) "0" ["proto_binary_fetched_date"]=> string(1) "0" ["proto_binary_fetched_year"]=> string(1) "0" ["proto_binary_fetched_time"]=> string(1) "0" ["proto_binary_fetched_datetime"]=> string(1) "0" ["proto_binary_fetched_timestamp"]=> string(1) "0" ["proto_binary_fetched_string"]=> string(1) "0" ["proto_binary_fetched_blob"]=> string(1) "0" ["proto_binary_fetched_enum"]=> string(1) "0" ["proto_binary_fetched_set"]=> string(1) "0" ["proto_binary_fetched_geometry"]=> string(1) "0" ["proto_binary_fetched_other"]=> string(1) "0" ["init_command_executed_count"]=> string(1) "0" ["init_command_failed_count"]=> string(1) "0" ["com_quit"]=> string(1) "0" ["com_init_db"]=> string(1) "0" ["com_query"]=> string(1) "0" ["com_field_list"]=> string(1) "0" ["com_create_db"]=> string(1) "0" ["com_drop_db"]=> string(1) "0" ["com_refresh"]=> string(1) "0" ["com_shutdown"]=> string(1) "0" ["com_statistics"]=> string(1) "0" ["com_process_info"]=> string(1) "0" ["com_connect"]=> string(1) "0" ["com_process_kill"]=> string(1) "0" ["com_debug"]=> string(1) "0" ["com_ping"]=> string(1) "0" ["com_time"]=> string(1) "0" ["com_delayed_insert"]=> string(1) "0" ["com_change_user"]=> string(1) "0" ["com_binlog_dump"]=> string(1) "0" ["com_table_dump"]=> string(1) "0" ["com_connect_out"]=> string(1) "0" ["com_register_slave"]=> string(1) "0" ["com_stmt_prepare"]=> string(1) "0" ["com_stmt_execute"]=> string(1) "0" ["com_stmt_send_long_data"]=> string(1) "0" ["com_stmt_close"]=> string(1) "0" ["com_stmt_reset"]=> string(1) "0" ["com_stmt_set_option"]=> string(1) "0" ["com_stmt_fetch"]=> string(1) "0" ["com_deamon"]=> string(1) "0" ["bytes_received_real_data_normal"]=> string(1) "0" ["bytes_received_real_data_ps"]=> string(1) "0"}
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_get_connection_stats |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getThreadId
Returns the thread ID for the current connection
Description
public int MysqlndUhConnection::getThreadId(mysqlnd_connection connection);
Returns the thread ID for the current connection.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Connection thread id.
Examples
Example 22.359. MysqlndUhConnection::getThreadIdexample
<?phpclass proxy extends MysqlndUhConnection { public function getThreadId($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getThreadId($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->thread_id);?>
The above example will output:
proxy::getThreadId(array ( 0 => NULL,))proxy::getThreadId returns 27646int(27646)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_thread_id |
mysql_thread_id |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::getWarningCount
Returns the number of warnings from the last query for the given link
Description
public int MysqlndUhConnection::getWarningCount(mysqlnd_connection connection);
Returns the number of warnings from the last query for the given link.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Number of warnings.
Examples
Example 22.360. MysqlndUhConnection::getWarningCountexample
<?phpclass proxy extends MysqlndUhConnection { public function getWarningCount($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::getWarningCount($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");var_dump($mysqli->warning_count);?>
The above example will output:
proxy::getWarningCount(array ( 0 => NULL,))proxy::getWarningCount returns 0int(0)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_warning_count
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::init
Initialize mysqlnd connection
Description
public bool MysqlndUhConnection::init(mysqlnd_connection connection);
Initialize mysqlnd connection. This is an mysqlnd internal call to initialize the connection object.
Failing to call the parent implementation may cause memory leaks or crash PHP. This is not
considered a bug. Please, keep in mind that the mysqlnd library functions
have never been designed to be exposed to the user space.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.361. MysqlndUhConnection::initexample
<?phpclass proxy extends MysqlndUhConnection { public function init($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::init($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");?>
The above example will output:
proxy::init(array ( 0 => NULL,))proxy::init returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::killConnection
Asks the server to kill a MySQL thread
Description
public bool MysqlndUhConnection::killConnection(mysqlnd_connection connection,
int pid);
Asks the server to kill a MySQL thread.
Parameters
connection
Mysqlnd connection handle. Do not modify!
pid Thread Id of the connection to be killed.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.362. example
<?phpclass proxy extends MysqlndUhConnection { public function killConnection($res, $pid) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::killConnection($res, $pid); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->kill($mysqli->thread_id);?>
The above example will output:
proxy::killConnection(array ( 0 => NULL, 1 => 27650,))proxy::killConnection returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_kill |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::listFields
List MySQL table fields
Description
public array MysqlndUhConnection::listFields(mysqlnd_connection connection,
string table,
string achtung_wild);
List MySQL table fields.
This function iscurrently not documented; only its argument list is available.
Parameters
connection
Mysqlnd connection handle. Do not modify!
table The name of the table that's being queried.
pattern Name pattern.
Return Values
Examples
Example 22.363. MysqlndUhConnection::listFieldsexample
<?phpclass proxy extends MysqlndUhConnection { public function listFields($res, $table, $pattern) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::listFields($res, $table, $pattern); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysql = mysql_connect("localhost", "root", "");mysql_select_db("test", $mysql);mysql_query("DROP TABLE IF EXISTS test_a", $mysql);mysql_query("CREATE TABLE test_a(id INT, col1 VARCHAR(255))", $mysql);$res = mysql_list_fields("test", "test_a", $mysql);printf("num_rows = %d\n", mysql_num_rows($res));while ($row = mysql_fetch_assoc($res)) var_dump($row);?>
The above example will output:
proxy::listFields(array ( 0 => NULL, 1 => 'test_a', 2 => '',))proxy::listFields returns NULLnum_rows = 0
See Also
mysqlnd_uh_set_connection_proxy
|
mysql_list_fields |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::listMethod
Wrapper for assorted list commands
Description
public void MysqlndUhConnection::listMethod(mysqlnd_connection connection,
string query,
string achtung_wild,
string par1);
Wrapper for assorted list commands.
This function iscurrently not documented; only its argument list is available.
Parameters
connection
Mysqlnd connection handle. Do not modify!
query SHOW command to be executed.
achtung_wild
par1Return Values
Return Values
TODO
Examples
Example 22.364. MysqlndUhConnection::listMethodexample
<?phpclass proxy extends MysqlndUhConnection { public function listMethod($res, $query, $pattern, $par1) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::listMethod($res, $query, $pattern, $par1); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysql = mysql_connect("localhost", "root", "");$res = mysql_list_dbs($mysql);printf("num_rows = %d\n", mysql_num_rows($res));while ($row = mysql_fetch_assoc($res)) var_dump($row);?>
The above example will output:
proxy::listMethod(array ( 0 => NULL, 1 => 'SHOW DATABASES', 2 => '', 3 => '',))proxy::listMethod returns NULLnum_rows = 6array(1) { ["Database"]=> string(18) "information_schema"}array(1) { ["Database"]=> string(5) "mysql"}array(1) { ["Database"]=> string(8) "oxid_new"}array(1) { ["Database"]=> string(7) "phptest"}array(1) { ["Database"]=> string(7) "pushphp"}array(1) { ["Database"]=> string(4) "test"}
See Also
mysqlnd_uh_set_connection_proxy
|
mysql_list_dbs |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::moreResults
Check if there are any more query results from a multi query
Description
public bool MysqlndUhConnection::moreResults(mysqlnd_connection connection);
Check if there are any more query results from a multi query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.365. MysqlndUhConnection::moreResultsexample
<?phpclass proxy extends MysqlndUhConnection { public function moreResults($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::moreResults($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->multi_query("SELECT 1 AS _one; SELECT 2 AS _two");do { $res = $mysqli->store_result(); var_dump($res->fetch_assoc()); printf("%s\n", str_repeat("-", 40));} while ($mysqli->more_results() && $mysqli->next_result());?>
The above example will output:
array(1) { ["_one"]=> string(1) "1"}----------------------------------------proxy::moreResults(array ( 0 => NULL,))proxy::moreResults returns trueproxy::moreResults(array ( 0 => NULL,))proxy::moreResults returns truearray(1) { ["_two"]=> string(1) "2"}----------------------------------------proxy::moreResults(array ( 0 => NULL,))proxy::moreResults returns false
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_more_results
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::nextResult
Prepare next result from multi_query
Description
public bool MysqlndUhConnection::nextResult(mysqlnd_connection connection);
Prepare next result from multi_query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.366. MysqlndUhConnection::nextResultexample
<?phpclass proxy extends MysqlndUhConnection { public function nextResult($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::nextResult($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->multi_query("SELECT 1 AS _one; SELECT 2 AS _two");do { $res = $mysqli->store_result(); var_dump($res->fetch_assoc()); printf("%s\n", str_repeat("-", 40));} while ($mysqli->more_results() && $mysqli->next_result());?>
The above example will output:
array(1) { ["_one"]=> string(1) "1"}----------------------------------------proxy::nextResult(array ( 0 => NULL,))proxy::nextResult returns truearray(1) { ["_two"]=> string(1) "2"}----------------------------------------
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_next_result
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::ping
Pings a server connection, or tries to reconnect if the connection has gone down
Description
public bool MysqlndUhConnection::ping(mysqlnd_connection connection);
Pings a server connection, or tries to reconnect if the connection has gone down.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.367. MysqlndUhConnection::pingexample
<?phpclass proxy extends MysqlndUhConnection { public function ping($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::ping($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->ping();?>
The above example will output:
proxy::ping(array ( 0 => NULL,))proxy::ping returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_ping |
mysql_ping |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::query
Performs a query on the database
Description
public bool MysqlndUhConnection::query(mysqlnd_connection connection,
string query);
Performs a query on the database (COM_QUERY).
Parameters
connection
Mysqlnd connection handle. Do not modify!
query The query string.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.368. MysqlndUhConnection::queryexample
<?phpclass proxy extends MysqlndUhConnection { public function query($res, $query) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $query = "SELECT 'How about query rewriting?'"; $ret = parent::query($res, $query); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$res = $mysqli->query("SELECT 'Welcome mysqlnd_uh!' FROM DUAL");var_dump($res->fetch_assoc());?>
The above example will output:
proxy::query(array ( 0 => NULL, 1 => 'SELECT \'Welcome mysqlnd_uh!\' FROM DUAL',))proxy::query returns truearray(1) { ["How about query rewriting?"]=> string(26) "How about query rewriting?"}
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_query
|
mysql_query |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::queryReadResultsetHeader
Read a result set header
Description
public bool MysqlndUhConnection::queryReadResultsetHeader(mysqlnd_connection connection,
mysqlnd_statement mysqlnd_stmt);
Read a result set header.
Parameters
connection
Mysqlnd connection handle. Do not modify!
mysqlnd_stmt
Mysqlnd statement handle. Do not modify! Set to NULL , if function
is not used in the context of a prepared statement.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.369. MysqlndUhConnection::queryReadResultsetHeaderexample
<?phpclass proxy extends MysqlndUhConnection { public function queryReadResultsetHeader($res, $stmt) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::queryReadResultsetHeader($res, $stmt); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$res = $mysqli->query("SELECT 'Welcome mysqlnd_uh!' FROM DUAL");var_dump($res->fetch_assoc());?>
The above example will output:
proxy::queryReadResultsetHeader(array ( 0 => NULL, 1 => NULL,))proxy::queryReadResultsetHeader returns truearray(1) { ["Welcome mysqlnd_uh!"]=> string(19) "Welcome mysqlnd_uh!"}
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::reapQuery
Get result from async query
Description
public bool MysqlndUhConnection::reapQuery(mysqlnd_connection connection);
Get result from async query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.370. MysqlndUhConnection::reapQueryexample
<?phpclass proxy extends MysqlndUhConnection { public function reapQuery($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::reapQuery($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$conn1 = new mysqli("localhost", "root", "", "test");$conn2 = new mysqli("localhost", "root", "", "test");$conn1->query("SELECT 1 as 'one', SLEEP(1) AS _sleep FROM DUAL", MYSQLI_ASYNC | MYSQLI_USE_RESULT);$conn2->query("SELECT 1.1 as 'one dot one' FROM DUAL", MYSQLI_ASYNC | MYSQLI_USE_RESULT);$links = array( $conn1->thread_id => array('link' => $conn1, 'processed' => false), $conn2->thread_id => array('link' => $conn2, 'processed' => false));$saved_errors = array();do { $poll_links = $poll_errors = $poll_reject = array(); foreach ($links as $thread_id => $link) { if (!$link['processed']) { $poll_links[] = $link['link']; $poll_errors[] = $link['link']; $poll_reject[] = $link['link']; } } if (0 == count($poll_links)) break; if (0 == ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000))) continue; if (!empty($poll_errors)) { die(var_dump($poll_errors)); } foreach ($poll_links as $link) { $thread_id = mysqli_thread_id($link); $links[$thread_id]['processed'] = true; if (is_object($res = mysqli_reap_async_query($link))) { // result set object while ($row = mysqli_fetch_assoc($res)) { // eat up all results var_dump($row); } mysqli_free_result($res); } else { // either there is no result (no SELECT) or there is an error if (mysqli_errno($link) > 0) { $saved_errors[$thread_id] = mysqli_errno($link); printf("'%s' caused %d\n", $links[$thread_id]['query'], mysqli_errno($link)); } } }} while (true);?>
The above example will output:
proxy::reapQuery(array ( 0 => NULL,))proxy::reapQuery returns truearray(1) { ["one dot one"]=> string(3) "1.1"}proxy::reapQuery(array ( 0 => NULL,))proxy::reapQuery returns truearray(2) { ["one"]=> string(1) "1" ["_sleep"]=> string(1) "0"}
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::refreshServer
Flush or reset tables and caches
Description
public bool MysqlndUhConnection::refreshServer(mysqlnd_connection connection,
int options);
Flush or reset tables and caches.
This function iscurrently not documented; only its argument list is available.
Parameters
connection
Mysqlnd connection handle. Do not modify!
options What to refresh.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.371. MysqlndUhConnection::refreshServerexample
<?phpclass proxy extends MysqlndUhConnection { public function refreshServer($res, $option) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::refreshServer($res, $option); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");mysqli_refresh($mysqli, 1);?>
The above example will output:
proxy::refreshServer(array ( 0 => NULL, 1 => 1,))proxy::refreshServer returns false
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::restartPSession
Restart a persistent mysqlnd connection
Description
public bool MysqlndUhConnection::restartPSession(mysqlnd_connection connection);
Restart a persistent mysqlnd connection.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.372. MysqlndUhConnection::restartPSessionexample
<?phpclass proxy extends MysqlndUhConnection { public function ping($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::ping($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->ping();?>
The above example will output:
proxy::restartPSession(array ( 0 => NULL,))proxy::restartPSession returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::selectDb
Selects the default database for database queries
Description
public bool MysqlndUhConnection::selectDb(mysqlnd_connection connection,
string database);
Selects the default database for database queries.
Parameters
connection
Mysqlnd connection handle. Do not modify!
database
The database name.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.373. MysqlndUhConnection::selectDbexample
<?phpclass proxy extends MysqlndUhConnection { public function selectDb($res, $database) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::selectDb($res, $database); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->select_db("mysql");?>
The above example will output:
proxy::selectDb(array ( 0 => NULL, 1 => 'mysql',))proxy::selectDb returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_select_db |
mysql_select_db |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::sendClose
Sends a close command to MySQL
Description
public bool MysqlndUhConnection::sendClose(mysqlnd_connection connection);
Sends a close command to MySQL.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.374. MysqlndUhConnection::sendCloseexample
<?phpclass proxy extends MysqlndUhConnection { public function sendClose($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::sendClose($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->close();?>
The above example will output:
proxy::sendClose(array ( 0 => NULL,))proxy::sendClose returns trueproxy::sendClose(array ( 0 => NULL,))proxy::sendClose returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::sendQuery
Sends a query to MySQL
Description
public bool MysqlndUhConnection::sendQuery(mysqlnd_connection connection,
string query);
Sends a query to MySQL.
Parameters
connection
Mysqlnd connection handle. Do not modify!
query The query string.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.375. MysqlndUhConnection::sendQueryexample
<?phpclass proxy extends MysqlndUhConnection { public function sendQuery($res, $query) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::sendQuery($res, $query); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->query("SELECT 1");?>
The above example will output:
proxy::sendQuery(array ( 0 => NULL, 1 => 'SELECT 1',))proxy::sendQuery returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::serverDumpDebugInformation
Dump debugging information into the log for the MySQL server
Description
public bool MysqlndUhConnection::serverDumpDebugInformation(mysqlnd_connection connection);
Dump debugging information into the log for the MySQL server.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.376. MysqlndUhConnection::serverDumpDebugInformationexample
<?phpclass proxy extends MysqlndUhConnection { public function serverDumpDebugInformation($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::serverDumpDebugInformation($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->dump_debug_info();?>
The above example will output:
proxy::serverDumpDebugInformation(array ( 0 => NULL,))proxy::serverDumpDebugInformation returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_dump_debug_info
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::setAutocommit
Turns on or off auto-committing database modifications
Description
public bool MysqlndUhConnection::setAutocommit(mysqlnd_connection connection,
int mode);
Turns on or off auto-committing database modifications
Parameters
connection
Mysqlnd connection handle. Do not modify!
mode Whether to turn on auto-commit or not.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.377. MysqlndUhConnection::setAutocommitexample
<?phpclass proxy extends MysqlndUhConnection { public function setAutocommit($res, $mode) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::setAutocommit($res, $mode); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->autocommit(false);$mysqli->autocommit(true);?>
The above example will output:
proxy::setAutocommit(array ( 0 => NULL, 1 => 0,))proxy::setAutocommit returns trueproxy::setAutocommit(array ( 0 => NULL, 1 => 1,))proxy::setAutocommit returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_autocommit
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::setCharset
Sets the default client character set
Description
public bool MysqlndUhConnection::setCharset(mysqlnd_connection connection,
string charset);
Sets the default client character set.
Parameters
connection
Mysqlnd connection handle. Do not modify!
charset The charset to be set as default.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.378. MysqlndUhConnection::setCharsetexample
<?phpclass proxy extends MysqlndUhConnection { public function setCharset($res, $charset) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::setCharset($res, $charset); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->set_charset("latin1");?>
The above example will output:
proxy::setCharset(array ( 0 => NULL, 1 => 'latin1',))proxy::setCharset returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_set_charset
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::setClientOption
Sets a client option
Description
public bool MysqlndUhConnection::setClientOption(mysqlnd_connection connection,
int option,
int value);
Sets a client option.
Parameters
connection
Mysqlnd connection handle. Do not modify!
option The option to be set.
value Optional option value, if required.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.379. MysqlndUhConnection::setClientOptionexample
<?phpfunction client_option_to_string($option) { static $mapping = array( MYSQLND_UH_MYSQLND_OPTION_OPT_CONNECT_TIMEOUT => "MYSQLND_UH_MYSQLND_OPTION_OPT_CONNECT_TIMEOUT", MYSQLND_UH_MYSQLND_OPTION_OPT_COMPRESS => "MYSQLND_UH_MYSQLND_OPTION_OPT_COMPRESS", MYSQLND_UH_MYSQLND_OPTION_OPT_NAMED_PIPE => "MYSQLND_UH_MYSQLND_OPTION_OPT_NAMED_PIPE", MYSQLND_UH_MYSQLND_OPTION_INIT_COMMAND => "MYSQLND_UH_MYSQLND_OPTION_INIT_COMMAND", MYSQLND_UH_MYSQLND_READ_DEFAULT_FILE => "MYSQLND_UH_MYSQLND_READ_DEFAULT_FILE", MYSQLND_UH_MYSQLND_READ_DEFAULT_GROUP => "MYSQLND_UH_MYSQLND_READ_DEFAULT_GROUP", MYSQLND_UH_MYSQLND_SET_CHARSET_DIR => "MYSQLND_UH_MYSQLND_SET_CHARSET_DIR", MYSQLND_UH_MYSQLND_SET_CHARSET_NAME => "MYSQLND_UH_MYSQLND_SET_CHARSET_NAME", MYSQLND_UH_MYSQLND_OPT_LOCAL_INFILE => "MYSQLND_UH_MYSQLND_OPT_LOCAL_INFILE", MYSQLND_UH_MYSQLND_OPT_PROTOCOL => "MYSQLND_UH_MYSQLND_OPT_PROTOCOL", MYSQLND_UH_MYSQLND_SHARED_MEMORY_BASE_NAME => "MYSQLND_UH_MYSQLND_SHARED_MEMORY_BASE_NAME", MYSQLND_UH_MYSQLND_OPT_READ_TIMEOUT => "MYSQLND_UH_MYSQLND_OPT_READ_TIMEOUT", MYSQLND_UH_MYSQLND_OPT_WRITE_TIMEOUT => "MYSQLND_UH_MYSQLND_OPT_WRITE_TIMEOUT", MYSQLND_UH_MYSQLND_OPT_USE_RESULT => "MYSQLND_UH_MYSQLND_OPT_USE_RESULT", MYSQLND_UH_MYSQLND_OPT_USE_REMOTE_CONNECTION => "MYSQLND_UH_MYSQLND_OPT_USE_REMOTE_CONNECTION", MYSQLND_UH_MYSQLND_OPT_USE_EMBEDDED_CONNECTION => "MYSQLND_UH_MYSQLND_OPT_USE_EMBEDDED_CONNECTION", MYSQLND_UH_MYSQLND_OPT_GUESS_CONNECTION => "MYSQLND_UH_MYSQLND_OPT_GUESS_CONNECTION", MYSQLND_UH_MYSQLND_SET_CLIENT_IP => "MYSQLND_UH_MYSQLND_SET_CLIENT_IP", MYSQLND_UH_MYSQLND_SECURE_AUTH => "MYSQLND_UH_MYSQLND_SECURE_AUTH", MYSQLND_UH_MYSQLND_REPORT_DATA_TRUNCATION => "MYSQLND_UH_MYSQLND_REPORT_DATA_TRUNCATION", MYSQLND_UH_MYSQLND_OPT_RECONNECT => "MYSQLND_UH_MYSQLND_OPT_RECONNECT", MYSQLND_UH_MYSQLND_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLND_UH_MYSQLND_OPT_SSL_VERIFY_SERVER_CERT", MYSQLND_UH_MYSQLND_OPT_NET_CMD_BUFFER_SIZE => "MYSQLND_UH_MYSQLND_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_UH_MYSQLND_OPT_NET_READ_BUFFER_SIZE => "MYSQLND_UH_MYSQLND_OPT_NET_READ_BUFFER_SIZE", MYSQLND_UH_MYSQLND_OPT_SSL_KEY => "MYSQLND_UH_MYSQLND_OPT_SSL_KEY", MYSQLND_UH_MYSQLND_OPT_SSL_CERT => "MYSQLND_UH_MYSQLND_OPT_SSL_CERT", MYSQLND_UH_MYSQLND_OPT_SSL_CA => "MYSQLND_UH_MYSQLND_OPT_SSL_CA", MYSQLND_UH_MYSQLND_OPT_SSL_CAPATH => "MYSQLND_UH_MYSQLND_OPT_SSL_CAPATH", MYSQLND_UH_MYSQLND_OPT_SSL_CIPHER => "MYSQLND_UH_MYSQLND_OPT_SSL_CIPHER", MYSQLND_UH_MYSQLND_OPT_SSL_PASSPHRASE => "MYSQLND_UH_MYSQLND_OPT_SSL_PASSPHRASE", MYSQLND_UH_SERVER_OPTION_PLUGIN_DIR => "MYSQLND_UH_SERVER_OPTION_PLUGIN_DIR", MYSQLND_UH_SERVER_OPTION_DEFAULT_AUTH => "MYSQLND_UH_SERVER_OPTION_DEFAULT_AUTH", MYSQLND_UH_SERVER_OPTION_SET_CLIENT_IP => "MYSQLND_UH_SERVER_OPTION_SET_CLIENT_IP" ); if (version_compare(PHP_VERSION, '5.3.99-dev', '>')) { $mapping[MYSQLND_UH_MYSQLND_OPT_MAX_ALLOWED_PACKET] = "MYSQLND_UH_MYSQLND_OPT_MAX_ALLOWED_PACKET"; $mapping[MYSQLND_UH_MYSQLND_OPT_AUTH_PROTOCOL] = "MYSQLND_UH_MYSQLND_OPT_AUTH_PROTOCOL"; } if (defined("MYSQLND_UH_MYSQLND_OPT_INT_AND_FLOAT_NATIVE")) { /* special mysqlnd build */ $mapping["MYSQLND_UH_MYSQLND_OPT_INT_AND_FLOAT_NATIVE"] = "MYSQLND_UH_MYSQLND_OPT_INT_AND_FLOAT_NATIVE"; } return (isset($mapping[$option])) ? $mapping[$option] : 'unknown';}class proxy extends MysqlndUhConnection { public function setClientOption($res, $option, $value) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); printf("Option '%s' set to %s\n", client_option_to_string($option), var_export($value, true)); $ret = parent::setClientOption($res, $option, $value); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");?>
The above example will output:
proxy::setClientOption(array ( 0 => NULL, 1 => 210, 2 => 3221225472,))Option 'MYSQLND_UH_MYSQLND_OPT_MAX_ALLOWED_PACKET' set to 3221225472proxy::setClientOption returns trueproxy::setClientOption(array ( 0 => NULL, 1 => 211, 2 => 'mysql_native_password',))Option 'MYSQLND_UH_MYSQLND_OPT_AUTH_PROTOCOL' set to 'mysql_native_password'proxy::setClientOption returns trueproxy::setClientOption(array ( 0 => NULL, 1 => 8, 2 => 1,))Option 'MYSQLND_UH_MYSQLND_OPT_LOCAL_INFILE' set to 1proxy::setClientOption returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_real_connect
|
mysqli_options
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::setServerOption
Sets a server option
Description
public void MysqlndUhConnection::setServerOption(mysqlnd_connection connection,
int option);
Sets a server option.
Parameters
connection
Mysqlnd connection handle. Do not modify!
option The option to be set.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.380. MysqlndUhConnection::setServerOptionexample
<?phpfunction server_option_to_string($option) { $ret = 'unknown'; switch ($option) { case MYSQLND_UH_SERVER_OPTION_MULTI_STATEMENTS_ON: $ret = 'MYSQLND_UH_SERVER_OPTION_MULTI_STATEMENTS_ON'; break; case MYSQLND_UH_SERVER_OPTION_MULTI_STATEMENTS_OFF: $ret = 'MYSQLND_UH_SERVER_OPTION_MULTI_STATEMENTS_ON'; break; } return $ret;}class proxy extends MysqlndUhConnection { public function setServerOption($res, $option) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); printf("Option '%s' set\n", server_option_to_string($option)); $ret = parent::setServerOption($res, $option); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->multi_query("SELECT 1; SELECT 2");?>
The above example will output:
proxy::setServerOption(array ( 0 => NULL, 1 => 0,))Option 'MYSQLND_UH_SERVER_OPTION_MULTI_STATEMENTS_ON' setproxy::setServerOption returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_real_connect
|
mysqli_options
|
mysqli_multi_query
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::shutdownServer
The shutdownServer purpose
Description
public void MysqlndUhConnection::shutdownServer(string MYSQLND_UH_RES_MYSQLND_NAME,
string "level");
This function iscurrently not documented; only its argument list is available.
Parameters
MYSQLND_UH_RES_MYSQLND_NAME
"level"Return Values
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::simpleCommand
Sends a basic COM_* command
Description
public bool MysqlndUhConnection::simpleCommand(mysqlnd_connection connection,
int command,
string arg,
int ok_packet,
bool silent,
bool ignore_upsert_status);
Sends a basic COM_* command to MySQL.
Parameters
connection
Mysqlnd connection handle. Do not modify!
command The COM command to be send.
arg Optional COM command arguments.
ok_packet
The OK packet type.
silent Whether mysqlnd may emit errors.
ignore_upsert_status
Whether to ignore UPDATE/INSERT
status.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.381. MysqlndUhConnection::simpleCommandexample
<?phpfunction server_cmd_2_string($command) { $mapping = array( MYSQLND_UH_MYSQLND_COM_SLEEP => "MYSQLND_UH_MYSQLND_COM_SLEEP", MYSQLND_UH_MYSQLND_COM_QUIT => "MYSQLND_UH_MYSQLND_COM_QUIT", MYSQLND_UH_MYSQLND_COM_INIT_DB => "MYSQLND_UH_MYSQLND_COM_INIT_DB", MYSQLND_UH_MYSQLND_COM_QUERY => "MYSQLND_UH_MYSQLND_COM_QUERY", MYSQLND_UH_MYSQLND_COM_FIELD_LIST => "MYSQLND_UH_MYSQLND_COM_FIELD_LIST", MYSQLND_UH_MYSQLND_COM_CREATE_DB => "MYSQLND_UH_MYSQLND_COM_CREATE_DB", MYSQLND_UH_MYSQLND_COM_DROP_DB => "MYSQLND_UH_MYSQLND_COM_DROP_DB", MYSQLND_UH_MYSQLND_COM_REFRESH => "MYSQLND_UH_MYSQLND_COM_REFRESH", MYSQLND_UH_MYSQLND_COM_SHUTDOWN => "MYSQLND_UH_MYSQLND_COM_SHUTDOWN", MYSQLND_UH_MYSQLND_COM_STATISTICS => "MYSQLND_UH_MYSQLND_COM_STATISTICS", MYSQLND_UH_MYSQLND_COM_PROCESS_INFO => "MYSQLND_UH_MYSQLND_COM_PROCESS_INFO", MYSQLND_UH_MYSQLND_COM_CONNECT => "MYSQLND_UH_MYSQLND_COM_CONNECT", MYSQLND_UH_MYSQLND_COM_PROCESS_KILL => "MYSQLND_UH_MYSQLND_COM_PROCESS_KILL", MYSQLND_UH_MYSQLND_COM_DEBUG => "MYSQLND_UH_MYSQLND_COM_DEBUG", MYSQLND_UH_MYSQLND_COM_PING => "MYSQLND_UH_MYSQLND_COM_PING", MYSQLND_UH_MYSQLND_COM_TIME => "MYSQLND_UH_MYSQLND_COM_TIME", MYSQLND_UH_MYSQLND_COM_DELAYED_INSERT => "MYSQLND_UH_MYSQLND_COM_DELAYED_INSERT", MYSQLND_UH_MYSQLND_COM_CHANGE_USER => "MYSQLND_UH_MYSQLND_COM_CHANGE_USER", MYSQLND_UH_MYSQLND_COM_BINLOG_DUMP => "MYSQLND_UH_MYSQLND_COM_BINLOG_DUMP", MYSQLND_UH_MYSQLND_COM_TABLE_DUMP => "MYSQLND_UH_MYSQLND_COM_TABLE_DUMP", MYSQLND_UH_MYSQLND_COM_CONNECT_OUT => "MYSQLND_UH_MYSQLND_COM_CONNECT_OUT", MYSQLND_UH_MYSQLND_COM_REGISTER_SLAVED => "MYSQLND_UH_MYSQLND_COM_REGISTER_SLAVED", MYSQLND_UH_MYSQLND_COM_STMT_PREPARE => "MYSQLND_UH_MYSQLND_COM_STMT_PREPARE", MYSQLND_UH_MYSQLND_COM_STMT_EXECUTE => "MYSQLND_UH_MYSQLND_COM_STMT_EXECUTE", MYSQLND_UH_MYSQLND_COM_STMT_SEND_LONG_DATA => "MYSQLND_UH_MYSQLND_COM_STMT_SEND_LONG_DATA", MYSQLND_UH_MYSQLND_COM_STMT_CLOSE => "MYSQLND_UH_MYSQLND_COM_STMT_CLOSE", MYSQLND_UH_MYSQLND_COM_STMT_RESET => "MYSQLND_UH_MYSQLND_COM_STMT_RESET", MYSQLND_UH_MYSQLND_COM_SET_OPTION => "MYSQLND_UH_MYSQLND_COM_SET_OPTION", MYSQLND_UH_MYSQLND_COM_STMT_FETCH => "MYSQLND_UH_MYSQLND_COM_STMT_FETCH", MYSQLND_UH_MYSQLND_COM_DAEMON => "MYSQLND_UH_MYSQLND_COM_DAEMON", MYSQLND_UH_MYSQLND_COM_END => "MYSQLND_UH_MYSQLND_COM_END", ); return (isset($mapping[$command])) ? $mapping[$command] : 'unknown';}function ok_packet_2_string($ok_packet) { $mapping = array( MYSQLND_UH_MYSQLND_PROT_GREET_PACKET => "MYSQLND_UH_MYSQLND_PROT_GREET_PACKET", MYSQLND_UH_MYSQLND_PROT_AUTH_PACKET => "MYSQLND_UH_MYSQLND_PROT_AUTH_PACKET", MYSQLND_UH_MYSQLND_PROT_OK_PACKET => "MYSQLND_UH_MYSQLND_PROT_OK_PACKET", MYSQLND_UH_MYSQLND_PROT_EOF_PACKET => "MYSQLND_UH_MYSQLND_PROT_EOF_PACKET", MYSQLND_UH_MYSQLND_PROT_CMD_PACKET => "MYSQLND_UH_MYSQLND_PROT_CMD_PACKET", MYSQLND_UH_MYSQLND_PROT_RSET_HEADER_PACKET => "MYSQLND_UH_MYSQLND_PROT_RSET_HEADER_PACKET", MYSQLND_UH_MYSQLND_PROT_RSET_FLD_PACKET => "MYSQLND_UH_MYSQLND_PROT_RSET_FLD_PACKET", MYSQLND_UH_MYSQLND_PROT_ROW_PACKET => "MYSQLND_UH_MYSQLND_PROT_ROW_PACKET", MYSQLND_UH_MYSQLND_PROT_STATS_PACKET => "MYSQLND_UH_MYSQLND_PROT_STATS_PACKET", MYSQLND_UH_MYSQLND_PREPARE_RESP_PACKET => "MYSQLND_UH_MYSQLND_PREPARE_RESP_PACKET", MYSQLND_UH_MYSQLND_CHG_USER_RESP_PACKET => "MYSQLND_UH_MYSQLND_CHG_USER_RESP_PACKET", MYSQLND_UH_MYSQLND_PROT_LAST => "MYSQLND_UH_MYSQLND_PROT_LAST", ); return (isset($mapping[$ok_packet])) ? $mapping[$ok_packet] : 'unknown';}class proxy extends MysqlndUhConnection { public function simpleCommand($conn, $command, $arg, $ok_packet, $silent, $ignore_upsert_status) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); printf("Command '%s'\n", server_cmd_2_string($command)); printf("OK packet '%s'\n", ok_packet_2_string($ok_packet)); $ret = parent::simpleCommand($conn, $command, $arg, $ok_packet, $silent, $ignore_upsert_status); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->query("SELECT 1");?>
The above example will output:
proxy::simpleCommand(array ( 0 => NULL, 1 => 3, 2 => 'SELECT 1', 3 => 13, 4 => false, 5 => false,))Command 'MYSQLND_UH_MYSQLND_COM_QUERY'OK packet 'MYSQLND_UH_MYSQLND_PROT_LAST'proxy::simpleCommand returns true:)proxy::simpleCommand(array ( 0 => NULL, 1 => 1, 2 => '', 3 => 13, 4 => true, 5 => true,))Command 'MYSQLND_UH_MYSQLND_COM_QUIT'OK packet 'MYSQLND_UH_MYSQLND_PROT_LAST'proxy::simpleCommand returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::simpleCommandHandleResponse
Process a response for a basic COM_* command send to the client
Description
public bool MysqlndUhConnection::simpleCommandHandleResponse(mysqlnd_connection connection,
int ok_packet,
bool silent,
int command,
bool ignore_upsert_status);
Process a response for a basic COM_* command send to the client.
Parameters
connection
Mysqlnd connection handle. Do not modify!
ok_packet
The OK packet type.
silent Whether mysqlnd may emit errors.
command The COM command to process results from.
ignore_upsert_status
Whether to ignore UPDATE/INSERT
status.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.382. MysqlndUhConnection::simpleCommandHandleResponseexample
<?phpfunction server_cmd_2_string($command) { $mapping = array( MYSQLND_UH_MYSQLND_COM_SLEEP => "MYSQLND_UH_MYSQLND_COM_SLEEP", MYSQLND_UH_MYSQLND_COM_QUIT => "MYSQLND_UH_MYSQLND_COM_QUIT", MYSQLND_UH_MYSQLND_COM_INIT_DB => "MYSQLND_UH_MYSQLND_COM_INIT_DB", MYSQLND_UH_MYSQLND_COM_QUERY => "MYSQLND_UH_MYSQLND_COM_QUERY", MYSQLND_UH_MYSQLND_COM_FIELD_LIST => "MYSQLND_UH_MYSQLND_COM_FIELD_LIST", MYSQLND_UH_MYSQLND_COM_CREATE_DB => "MYSQLND_UH_MYSQLND_COM_CREATE_DB", MYSQLND_UH_MYSQLND_COM_DROP_DB => "MYSQLND_UH_MYSQLND_COM_DROP_DB", MYSQLND_UH_MYSQLND_COM_REFRESH => "MYSQLND_UH_MYSQLND_COM_REFRESH", MYSQLND_UH_MYSQLND_COM_SHUTDOWN => "MYSQLND_UH_MYSQLND_COM_SHUTDOWN", MYSQLND_UH_MYSQLND_COM_STATISTICS => "MYSQLND_UH_MYSQLND_COM_STATISTICS", MYSQLND_UH_MYSQLND_COM_PROCESS_INFO => "MYSQLND_UH_MYSQLND_COM_PROCESS_INFO", MYSQLND_UH_MYSQLND_COM_CONNECT => "MYSQLND_UH_MYSQLND_COM_CONNECT", MYSQLND_UH_MYSQLND_COM_PROCESS_KILL => "MYSQLND_UH_MYSQLND_COM_PROCESS_KILL", MYSQLND_UH_MYSQLND_COM_DEBUG => "MYSQLND_UH_MYSQLND_COM_DEBUG", MYSQLND_UH_MYSQLND_COM_PING => "MYSQLND_UH_MYSQLND_COM_PING", MYSQLND_UH_MYSQLND_COM_TIME => "MYSQLND_UH_MYSQLND_COM_TIME", MYSQLND_UH_MYSQLND_COM_DELAYED_INSERT => "MYSQLND_UH_MYSQLND_COM_DELAYED_INSERT", MYSQLND_UH_MYSQLND_COM_CHANGE_USER => "MYSQLND_UH_MYSQLND_COM_CHANGE_USER", MYSQLND_UH_MYSQLND_COM_BINLOG_DUMP => "MYSQLND_UH_MYSQLND_COM_BINLOG_DUMP", MYSQLND_UH_MYSQLND_COM_TABLE_DUMP => "MYSQLND_UH_MYSQLND_COM_TABLE_DUMP", MYSQLND_UH_MYSQLND_COM_CONNECT_OUT => "MYSQLND_UH_MYSQLND_COM_CONNECT_OUT", MYSQLND_UH_MYSQLND_COM_REGISTER_SLAVED => "MYSQLND_UH_MYSQLND_COM_REGISTER_SLAVED", MYSQLND_UH_MYSQLND_COM_STMT_PREPARE => "MYSQLND_UH_MYSQLND_COM_STMT_PREPARE", MYSQLND_UH_MYSQLND_COM_STMT_EXECUTE => "MYSQLND_UH_MYSQLND_COM_STMT_EXECUTE", MYSQLND_UH_MYSQLND_COM_STMT_SEND_LONG_DATA => "MYSQLND_UH_MYSQLND_COM_STMT_SEND_LONG_DATA", MYSQLND_UH_MYSQLND_COM_STMT_CLOSE => "MYSQLND_UH_MYSQLND_COM_STMT_CLOSE", MYSQLND_UH_MYSQLND_COM_STMT_RESET => "MYSQLND_UH_MYSQLND_COM_STMT_RESET", MYSQLND_UH_MYSQLND_COM_SET_OPTION => "MYSQLND_UH_MYSQLND_COM_SET_OPTION", MYSQLND_UH_MYSQLND_COM_STMT_FETCH => "MYSQLND_UH_MYSQLND_COM_STMT_FETCH", MYSQLND_UH_MYSQLND_COM_DAEMON => "MYSQLND_UH_MYSQLND_COM_DAEMON", MYSQLND_UH_MYSQLND_COM_END => "MYSQLND_UH_MYSQLND_COM_END", ); return (isset($mapping[$command])) ? $mapping[$command] : 'unknown';}function ok_packet_2_string($ok_packet) { $mapping = array( MYSQLND_UH_MYSQLND_PROT_GREET_PACKET => "MYSQLND_UH_MYSQLND_PROT_GREET_PACKET", MYSQLND_UH_MYSQLND_PROT_AUTH_PACKET => "MYSQLND_UH_MYSQLND_PROT_AUTH_PACKET", MYSQLND_UH_MYSQLND_PROT_OK_PACKET => "MYSQLND_UH_MYSQLND_PROT_OK_PACKET", MYSQLND_UH_MYSQLND_PROT_EOF_PACKET => "MYSQLND_UH_MYSQLND_PROT_EOF_PACKET", MYSQLND_UH_MYSQLND_PROT_CMD_PACKET => "MYSQLND_UH_MYSQLND_PROT_CMD_PACKET", MYSQLND_UH_MYSQLND_PROT_RSET_HEADER_PACKET => "MYSQLND_UH_MYSQLND_PROT_RSET_HEADER_PACKET", MYSQLND_UH_MYSQLND_PROT_RSET_FLD_PACKET => "MYSQLND_UH_MYSQLND_PROT_RSET_FLD_PACKET", MYSQLND_UH_MYSQLND_PROT_ROW_PACKET => "MYSQLND_UH_MYSQLND_PROT_ROW_PACKET", MYSQLND_UH_MYSQLND_PROT_STATS_PACKET => "MYSQLND_UH_MYSQLND_PROT_STATS_PACKET", MYSQLND_UH_MYSQLND_PREPARE_RESP_PACKET => "MYSQLND_UH_MYSQLND_PREPARE_RESP_PACKET", MYSQLND_UH_MYSQLND_CHG_USER_RESP_PACKET => "MYSQLND_UH_MYSQLND_CHG_USER_RESP_PACKET", MYSQLND_UH_MYSQLND_PROT_LAST => "MYSQLND_UH_MYSQLND_PROT_LAST", ); return (isset($mapping[$ok_packet])) ? $mapping[$ok_packet] : 'unknown';}class proxy extends MysqlndUhConnection { public function simpleCommandHandleResponse($conn, $ok_packet, $silent, $command, $ignore_upsert_status) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); printf("Command '%s'\n", server_cmd_2_string($command)); printf("OK packet '%s'\n", ok_packet_2_string($ok_packet)); $ret = parent::simpleCommandHandleResponse($conn, $ok_packet, $silent, $command, $ignore_upsert_status); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysql = mysql_connect("localhost", "root", "");mysql_query("SELECT 1 FROM DUAL", $mysql);?>
The above example will output:
proxy::simpleCommandHandleResponse(array ( 0 => NULL, 1 => 5, 2 => false, 3 => 27, 4 => true,))Command 'MYSQLND_UH_MYSQLND_COM_SET_OPTION'OK packet 'MYSQLND_UH_MYSQLND_PROT_EOF_PACKET'proxy::simpleCommandHandleResponse returns true
See Also
mysqlnd_uh_set_connection_proxy
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::sslSet
Used for establishing secure connections using SSL
Description
public bool MysqlndUhConnection::sslSet(mysqlnd_connection connection,
string key,
string cert,
string ca,
string capath,
string cipher);
Used for establishing secure connections using SSL.
Parameters
connection
Mysqlnd connection handle. Do not modify!
key The path name to the key file.
cert The path name to the certificate file.
ca The path name to the certificate authority file.
capath The pathname to a directory that contains trusted SSL CA certificates in PEM format.
cipher A list of allowable ciphers to use for SSL encryption.
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.383. MysqlndUhConnection::sslSetexample
<?phpclass proxy extends MysqlndUhConnection { public function sslSet($conn, $key, $cert, $ca, $capath, $cipher) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::sslSet($conn, $key, $cert, $ca, $capath, $cipher); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->ssl_set("key", "cert", "ca", "capath", "cipher");?>
The above example will output:
proxy::sslSet(array ( 0 => NULL, 1 => 'key', 2 => 'cert', 3 => 'ca', 4 => 'capath', 5 => 'cipher',))proxy::sslSet returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_ssl_set
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::stmtInit
Initializes a statement and returns a resource for use with mysqli_statement::prepare
Description
public resource MysqlndUhConnection::stmtInit(mysqlnd_connection connection);
Initializes a statement and returns a resource for use with mysqli_statement::prepare.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Resource of type Mysqlnd Prepared Statement (internal only - you must not modify
it!). The documentation may also refer to such resources using the alias name mysqlnd_prepared_statement.
Examples
Example 22.384. MysqlndUhConnection::stmtInitexample
<?phpclass proxy extends MysqlndUhConnection { public function stmtInit($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); var_dump($res); $ret = parent::stmtInit($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); var_dump($ret); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$stmt = $mysqli->prepare("SELECT 1 AS _one FROM DUAL");$stmt->execute();$one = NULL;$stmt->bind_result($one);$stmt->fetch();var_dump($one);?>
The above example will output:
proxy::stmtInit(array ( 0 => NULL,))resource(19) of type (Mysqlnd Connection)proxy::stmtInit returns NULLresource(246) of type (Mysqlnd Prepared Statement (internal only - you must not modify it!))int(1)
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_stmt_init |
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::storeResult
Transfers a result set from the last query
Description
public resource MysqlndUhConnection::storeResult(mysqlnd_connection connection);
Transfers a result set from the last query.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Resource of type Mysqlnd Resultset (internal only - you must not modify it!).
The documentation may also refer to such resources using the alias name mysqlnd_resultset.
Examples
Example 22.385. MysqlndUhConnection::storeResultexample
<?phpclass proxy extends MysqlndUhConnection { public function storeResult($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::storeResult($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); var_dump($ret); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$res = $mysqli->query("SELECT 'Also called buffered result' AS _msg FROM DUAL");var_dump($res->fetch_assoc());$mysqli->real_query("SELECT 'Good morning!' AS _msg FROM DUAL");$res = $mysqli->store_result();var_dump($res->fetch_assoc());?>
The above example will output:
proxy::storeResult(array ( 0 => NULL,))proxy::storeResult returns NULLresource(475) of type (Mysqlnd Resultset (internal only - you must not modify it!))array(1) { ["_msg"]=> string(27) "Also called buffered result"}proxy::storeResult(array ( 0 => NULL,))proxy::storeResult returns NULLresource(730) of type (Mysqlnd Resultset (internal only - you must not modify it!))array(1) { ["_msg"]=> string(13) "Good morning!"}
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_store_result
|
mysqli_real_query
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::txCommit
Commits the current transaction
Description
public bool MysqlndUhConnection::txCommit(mysqlnd_connection connection);
Commits the current transaction.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.386. MysqlndUhConnection::txCommitexample
<?phpclass proxy extends MysqlndUhConnection { public function txCommit($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::txCommit($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->commit();?>
The above example will output:
proxy::txCommit(array ( 0 => NULL,))proxy::txCommit returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_commit
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::txRollback
Rolls back current transaction
Description
public bool MysqlndUhConnection::txRollback(mysqlnd_connection connection);
Rolls back current transaction.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Returns TRUE on success. Otherwise, returns FALSE
Examples
Example 22.387. MysqlndUhConnection::txRollbackexample
<?phpclass proxy extends MysqlndUhConnection { public function txRollback($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::txRollback($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->rollback();?>
The above example will output:
proxy::txRollback(array ( 0 => NULL,))proxy::txRollback returns true
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_commit
|
Copyright 1997-2012 the PHP Documentation Group.
MysqlndUhConnection::useResult
Initiate a result set retrieval
Description
public resource MysqlndUhConnection::useResult(mysqlnd_connection connection);
Initiate a result set retrieval.
Parameters
connection
Mysqlnd connection handle. Do not modify!
Return Values
Resource of type Mysqlnd Resultset (internal only - you must not modify it!).
The documentation may also refer to such resources using the alias name mysqlnd_resultset.
Examples
Example 22.388. MysqlndUhConnection::useResultexample
<?phpclass proxy extends MysqlndUhConnection { public function useResult($res) { printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true)); $ret = parent::useResult($res); printf("%s returns %s\n", __METHOD__, var_export($ret, true)); var_dump($ret); return $ret; }}mysqlnd_uh_set_connection_proxy(new proxy());$mysqli = new mysqli("localhost", "root", "", "test");$mysqli->real_query("SELECT 'Good morning!' AS _msg FROM DUAL");$res = $mysqli->use_result();var_dump($res->fetch_assoc());?>
The above example will output:
proxy::useResult(array ( 0 => NULL,))proxy::useResult returns NULLresource(425) of type (Mysqlnd Resultset (internal only - you must not modify it!))array(1) { ["_msg"]=> string(13) "Good morning!"}
See Also
mysqlnd_uh_set_connection_proxy
|
mysqli_use_result
|
mysqli_real_query
|