MysqlndUhConnection::simpleCommandHandleResponse
(PECL mysqlnd-uh >= 1.0.0-alpha)
MysqlndUhConnection::simpleCommandHandleResponse — Process a response for a basic COM_* command send to the client
Описание
$connection
, int $ok_packet
, bool $silent
, int $command
, bool $ignore_upsert_status
)Process a response for a basic COM_* command send to the client.
Список параметров
-
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.
Возвращаемые значения
Returns TRUE
on success.
Otherwise, returns FALSE
Примеры
Пример #1 MysqlndUhConnection::simpleCommandHandleResponse() example
<?php
function 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);
?>
Результат выполнения данного примера:
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
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- MySQL Drivers and Plugins
- Mysqlnd user handler plugin
- Функция MysqlndUhConnection::changeUser() - Changes the user of the specified mysqlnd database connection
- Функция MysqlndUhConnection::charsetName() - Returns the default character set for the database connection
- Функция MysqlndUhConnection::close() - Closes a previously opened database connection
- Функция MysqlndUhConnection::connect() - Open a new connection to the MySQL server
- Функция MysqlndUhConnection::__construct() - The __construct purpose
- Функция MysqlndUhConnection::endPSession() - End a persistent connection
- MysqlndUhConnection::escapeString
- Функция MysqlndUhConnection::getAffectedRows() - Gets the number of affected rows in a previous MySQL operation
- Функция MysqlndUhConnection::getErrorNumber() - Returns the error code for the most recent function call
- Функция MysqlndUhConnection::getErrorString() - Returns a string description of the last error
- Функция MysqlndUhConnection::getFieldCount() - Returns the number of columns for the most recent query
- Функция MysqlndUhConnection::getHostInformation() - Returns a string representing the type of connection used
- Функция MysqlndUhConnection::getLastInsertId() - Returns the auto generated id used in the last query.
- Функция MysqlndUhConnection::getLastMessage() - Retrieves information about the most recently executed query
- Функция MysqlndUhConnection::getProtocolInformation() - Returns the version of the MySQL protocol used
- Функция MysqlndUhConnection::getServerInformation() - Returns the version of the MySQL server
- Функция MysqlndUhConnection::getServerStatistics() - Gets the current system status
- Функция MysqlndUhConnection::getServerVersion() - Returns the version of the MySQL server as an integer
- Функция MysqlndUhConnection::getSqlstate() - Returns the SQLSTATE error from previous MySQL operation
- Функция MysqlndUhConnection::getStatistics() - Returns statistics about the client connection.
- Функция MysqlndUhConnection::getThreadId() - Returns the thread ID for the current connection
- Функция MysqlndUhConnection::getWarningCount() - Returns the number of warnings from the last query for the given link
- Функция MysqlndUhConnection::init() - Initialize mysqlnd connection
- Функция MysqlndUhConnection::killConnection() - Asks the server to kill a MySQL thread
- Функция MysqlndUhConnection::listFields() - List MySQL table fields
- Функция MysqlndUhConnection::listMethod() - Wrapper for assorted list commands
- Функция MysqlndUhConnection::moreResults() - Check if there are any more query results from a multi query
- Функция MysqlndUhConnection::nextResult() - Prepare next result from multi_query
- Функция MysqlndUhConnection::ping() - Pings a server connection, or tries to reconnect if the connection has gone down
- Функция MysqlndUhConnection::query() - Performs a query on the database
- Функция MysqlndUhConnection::queryReadResultsetHeader() - Read a result set header
- Функция MysqlndUhConnection::reapQuery() - Get result from async query
- Функция MysqlndUhConnection::refreshServer() - Flush or reset tables and caches
- Функция MysqlndUhConnection::restartPSession() - Restart a persistent mysqlnd connection
- Функция MysqlndUhConnection::selectDb() - Selects the default database for database queries
- Функция MysqlndUhConnection::sendClose() - Sends a close command to MySQL
- Функция MysqlndUhConnection::sendQuery() - Sends a query to MySQL
- Функция MysqlndUhConnection::serverDumpDebugInformation() - Dump debugging information into the log for the MySQL server
- Функция MysqlndUhConnection::setAutocommit() - Turns on or off auto-committing database modifications
- Функция MysqlndUhConnection::setCharset() - Sets the default client character set
- Функция MysqlndUhConnection::setClientOption() - Sets a client option
- Функция MysqlndUhConnection::setServerOption() - Sets a server option
- Функция MysqlndUhConnection::shutdownServer() - The shutdownServer purpose
- Функция MysqlndUhConnection::simpleCommand() - Sends a basic COM_* command
- Функция MysqlndUhConnection::simpleCommandHandleResponse() - Process a response for a basic COM_* command send to the client
- Функция MysqlndUhConnection::sslSet() - Used for establishing secure connections using SSL
- Функция MysqlndUhConnection::stmtInit() - Initializes a statement and returns a resource for use with mysqli_statement::prepare
- Функция MysqlndUhConnection::storeResult() - Transfers a result set from the last query
- Функция MysqlndUhConnection::txCommit() - Commits the current transaction
- Функция MysqlndUhConnection::txRollback() - Rolls back current transaction
- Функция MysqlndUhConnection::useResult() - Initiate a result set retrieval
Коментарии
404 Not Found