Oracle 5.0 Reference Manual page 2573

Table of Contents

Advertisement

ext/mysqlnd_cache
ext/mysqlnd_monitor
In this scenario, a cache (ext/mysqlnd_cache) and a monitor (ext/mysqlnd_monitor) plugin are
loaded. Both subclass Connection::query(). Plugin registration happens at
shown previously. PHP calls extensions in alphabetical order by default. Plugins are not aware of each
other and do not set extension dependencies.
By default the plugins call the parent implementation of the query method in their derived version of the
method.
PHP Extension Recap
This is a recap of what happens when using an example plugin, ext/mysqlnd_plugin, which
exposes the
• Any PHP MySQL application tries to establish a connection to 192.168.2.29
• The PHP application will either use ext/mysql,
extensions use
Mysqlnd
ext/mysqlnd_plugin
• The userspace hook changes the connection host IP from 192.168.2.29 to 127.0.0.1 and returns the
connection established by parent::connect().
ext/mysqlnd_plugin
original
mysqlnd
ext/mysqlnd
mysqlnd_plugin
• Whatever PHP MySQL extension had been used by the application, it receives a connection to
127.0.0.1. The PHP MySQL extension itself returns to the PHP application. The circle is closed.
20.7.5.7.5. Getting started building a mysqlnd plugin
Copyright 1997-2012 the PHP Documentation Group. [2230]
It is important to remember that a
The following code shows the basic structure of the MINIT function that will be used in the typical
plugin:
mysqlnd
/* my_php_mysqlnd_plugin.c */
static PHP_MINIT_FUNCTION(mysqlnd_plugin) {
/* globals, ini entries, resources, classes */
/* register mysqlnd plugin */
mysqlnd_plugin_id = mysqlnd_plugin_register();
conn_m = mysqlnd_get_conn_methods();
memcpy(org_conn_m, conn_m,
MySQL Native Driver (Mysqlnd)
mysqlnd_cache.query()
mysqlnd_monitor.query()
C plugin API to PHP:
mysqlnd
to establish the connection to 192.168.2.29.
mysqlnd
calls its connect method, which has been subclassed by ext/mysqlnd_plugin.
calls the userspace hook
performs the equivalent of
method for establishing a connection.
establishes a connection and returns to ext/mysqlnd_plugin.
returns as well.
mysqlnd
or PDO_MYSQL. All three PHP MySQL
ext/mysqli
proxy::connect()
parent::connect(127.0.0.1)
plugin is itself a PHP extension.
2553
1. mysqlnd_cache.query()
2. mysqlnd.query
1. mysqlnd_monitor.query()
2. mysqlnd_cache.query()
3. mysqlnd.query
using the logic
MINIT
registered by the user.
by calling the
ext/

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents