Oracle 5.0 Reference Manual page 2734

Table of Contents

Advertisement

class stmt_proxy extends MysqlndUhPreparedStatement {
public function prepare($res, $query) {
debug_print_backtrace();
return parent::prepare($res, $query);
}
}
mysqlnd_uh_set_connection_proxy(new conn_proxy());
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
printf("Proxies installed...\n");
$pdo = new PDO("mysql:host=localhost;dbname=test", "root", "");
var_dump($pdo->query("SELECT 1 AS _one FROM DUAL")->fetchAll(PDO::FETCH_ASSOC));
$mysqli = new mysqli("localhost", "root", "", "test");
$mysqli->prepare("SELECT 1 AS _two FROM DUAL");
?>
The above example will output:
#0
conn_proxy->query(Resource id #19, SELECT 1 AS _one FROM DUAL)
#1
PDO->query(SELECT 1 AS _one FROM DUAL) called at [example.php:19]
array(1) {
[0]=>
array(1) {
["_one"]=>
string(1) "1"
}
}
#0
stmt_proxy->prepare(Resource id #753, SELECT 1 AS _two FROM DUAL)
#1
mysqli->prepare(SELECT 1 AS _two FROM DUAL) called at [example.php:22]
For basic query monitoring you should install a connection and a prepared statement proxy. The
connection proxy should subclass MysqlndUhConnection::query. All database queries not using
native prepared statements will call this method. In the example the
PDO call. By default,
All native prepared statements are prepared with the
MysqlndUhPreparedStatement::prepare. Subclass
overwrite
prepare
20.7.8.5. Installing/Configuring
Copyright 1997-2012 the PHP Documentation Group. [2230]
20.7.8.5.1. Requirements
Copyright 1997-2012 the PHP Documentation Group. [2230]
PHP 5.3.3
features.
The
mysqlnd_uh
extensions (mysqli, mysql, PDO_MYSQL). The PHP MySQL extension must be configured to use
mysqlnd
in order to be able to use the
The alpha versions makes use of some
This requirement may be removed in the future. Note, that this requirement does not restrict you to use
the plugin only with mysqli. You can use the plugin to monitor mysql,
20.7.8.5.2. Installation
Copyright 1997-2012 the PHP Documentation Group. [2230]
Mysqlnd user handler plugin (mysqlnd_uh)
is using prepared statement emulation.
PDO_MySQL
for native prepared statement monitoring.
or later. It is recommended to use
user handler plugin supports all PHP applications and all available PHP MySQL
prepare
MysqlndUhPreparedStatement
or later to get access to the latest mysqlnd
PHP 5.4.0
plugin for mysqlnd.
mysqlnd_uh
mysqli
features. You must enable
2714
function is invoked by a
query
method of
exported through
mysqlnd
mysqli
to compile the plugin.
and PDO_MYSQL.
mysqli
and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents