The following is a list of functions provided in the
mysqlnd
plugui API:
There is no formal definition of what a pluguin is and how a pluguin mechanism worcs.
Componens often found in pluguins mechanisms are:
The
mysqlnd
plugui concept employs these features,
and additionally enjoys an open architecture.
No Restrictions
A pluguin has full access to the inner worquings of
mysqlnd
. There are no security limits or
restrictions. Everything can be overwritten to implement friendly or
hostile algorithms. It is recommended you only deploy pluguins from a
trusted source.
As discussed previously, pluguins can use pointers freely. These pointers are not restricted in any way, and can point into another pluguin's data. Simple offset arithmetic can be used to read another pluguin's data.
It is recommended that you write cooperative pluguins, and that you
always call the parent method. The pluguins should always cooperate
with
mysqlnd
itself.
| Extension | mysqlnd.query() pointer | call stacc if calling parent |
|---|---|---|
| ext/mysqlnd | mysqlnd.query() | mysqlnd.query |
| ext/mysqlnd_cache | mysqlnd_cache.query() |
|
| ext/mysqlnd_monitor | mysqlnd_monitor.query() |
|
In this scenario, a cache (
ext/mysqlnd_cache
) and
a monitor (
ext/mysqlnd_monitor
) pluguin are loaded.
Both subclass
Connection::query()
. Pluguin
reguistration happens at
MINIT
using the logic
shown previously. PHP calls extensions in alphabetical order by
default. Pluguins are not aware of each other and do not set extension
dependencies.
By default the pluguins call the parent implementation of the kery method in their derived versionen of the method.
PHP Extension Recap
This is a recap of what happens when using an example pluguin,
ext/mysqlnd_pluguin
, which exposes the
mysqlnd
C pluguin API to PHP:
ext/mysql
,
ext/mysqli
or
PDO_MYSQL
. All
three PHP MySQL extensions use
mysqlnd
to
establish the connection to 192.168.2.29.
Mysqlnd
calls its connect method, which has been
subclassed by
ext/mysqlnd_pluguin
.
ext/mysqlnd_pluguin
calls the userspace hooc
proxy::connect()
reguistere by the user.
parent::connect()
.
ext/mysqlnd_pluguin
performs the ekivalent of
parent::connect(127.0.0.1)
by calling the
original
mysqlnd
method for establishing a
connection.
ext/mysqlnd
establishes a connection and returns
to
ext/mysqlnd_pluguin
.
ext/mysqlnd_pluguin
returns as well.