Initial documentation for PECL/mysqlnd_uh. mysqlnd_uh - another ingenuious name - stands for user handler. It lets you hook many mysqlnd connection functions from PHP. PHP based mysqlnd plugins so to say. The docs need review.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@317862 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ulf Wendel 2011-10-07 12:56:30 +00:00
parent fe378fac1c
commit 09e3659aa6
71 changed files with 10326 additions and 0 deletions

View file

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.mysqlnd-uh" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Mysqlnd user handler plugin</title>
<titleabbrev>mysqlnd_uh</titleabbrev>
<preface xml:id="intro.mysqlnd-uh">
&reftitle.intro;
<para>
The mysqlnd user handler plugin (<literal>mysqlnd_uh</literal>)
allows users to set hooks for most internal calls of the
MySQL native driver for PHP
(<literal><link linkend="book.mysqlnd">mysqlnd</link></literal>).
Mysqlnd and its plugins, including PECL/mysqlnd_uh, operate on a layer
beneath the PHP MySQL extensions. A mysqlnd plugin can be considered
as a proxy between the PHP MySQL extensions and the MySQL server
as part of the PHP executable on the client-side. Because the plugins
operates on their own layer below the PHP MySQL extensions,
they can monitor and change application actions without requiring
application changes. If the
PHP MySQL extensions (<link linkend="ref.mysqli">mysqli</link>,
<link linkend="ref.mysql">mysql</link>,
<link linkend="ref.pdo-mysql">PDO_MYSQL</link>) are compiled to
use <literal>mysqlnd</literal> this can be used for:
<itemizedlist>
<listitem>
<para>
Monitoring
</para>
<para>
<itemizedlist>
<listitem>
<para>
Queries run by any of the PHP MySQL extensions
</para>
</listitem>
<listitem>
<para>
Prepared statements run by any of the PHP MySQL extensions
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
<listitem>
<para>
Auditing
</para>
<para>
<itemizedlist>
<listitem>
<para>
Detection of databases uses
</para>
</listitem>
<listitem>
<para>
SQL Injection protection using black-/whitelists
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
<listitem>
<para>
Assorted
</para>
<para>
<itemizedlist>
<listitem>
<para>
Load Balancing connections
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</itemizedlist>
</para>
<para>
As of version PHP 5.3.3 the MySQL native driver for PHP
(<literal>mysqlnd</literal>)
features an internal plugin C API. C plugins, such as the mysqlnd
user handler plugin, can extend the functionality of
<link linkend="book.mysqlnd">mysqlnd</link>. PECL/mysqlnd_uh
makes parts of the internal plugin C API available to the
PHP user for plugin development with PHP.
</para>
<para>
The MySQL native driver for PHP is a C library which ships together with
PHP as of PHP 5.3.0. It serves as a drop-in replacement for the
MySQL Client Library (AKA libmysql/libmysqlclient). As of PHP 5.4.0, mysqlnd is
the compile time default library used by all PHP MySQL extensions.
</para>
<section xml:id="mysqlnd-uh.security">
<title>Security considerations</title>
<para>
PECL/mysqlnd_uh gives users access to MySQL user names, MySQL password
used by any of the PHP MySQL extensions to connect to MySQL.
It allows monitoring of all queries and prepared statements exposing
the statement string to the user. Therefore, the extension should be
installed with care. The <literal>PHP_INI_SYSTEM</literal> configuration setting
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
can be used to prevent users from hooking mysqlnd calls.
</para>
<para>
Code obfuscators and similar technologies are not suitable to prevent
monitoring of mysqlnd library activities if PECL/mysqlnd_uh is made
available and the user can install a proxy, for example,
using <link linkend="ini.auto-prepend-file">auto_prepend_file</link>.
</para>
</section>
<section xml:id="mysqlnd-uh.docs_note">
<title>Documentation note</title>
<para>
Many of the extensions functions are described very briefly.
This is done intentionally to avoid content duplication.
The <link linkend="ref.mysqli">mysqli</link> extension is often
only a thin abstraction layer on top of the MySQL C API, which
the <literal>mysqlnd</literal> library provides. Therefore,
the corresponding <link linkend="ref.mysqli">mysqli</link> documentation
respectively the MySQL reference manual can be consulted
to get more information on a particular function.
</para>
</section>
<section xml:id="mysqlnd-uh.name">
<title>On the name</title>
<para>
The shortcut <literal>mysqlnd_uh</literal> stands for
<literal>mysqlnd user handler</literal>. There may be better names.
However, this was the initial choice when development started.
Meanwhile, non speaking names have almost become a tradition.
</para>
<note>
<para>
The mysqlnd user handler plugin is in alpha status.
Take appropriate care before using it in production environments.
</para>
</note>
</section>
</preface>
&reference.mysqlnd-uh.quickstart;
&reference.mysqlnd-uh.setup;
&reference.mysqlnd-uh.constants;
&reference.mysqlnd-uh.reference;
&reference.mysqlnd-uh.changes;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 317663 $ -->
<chapter xml:id="mysqlnd-uh.changes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title xmlns="http://docbook.org/ns/docbook">Change History</title>
<para>
The Change History lists major changes users need to be aware if upgrading
from one version to another. It is a high level summary of selected changes
that may impact applications or might even break backwards compatibility.
Please, consult the <filename>CHANGES</filename> file contained in the source
distribution for a more complete list of changes. If you are eager to learn
about all changes, even smaller ones that do not make it into the
<filename>CHANGES</filename> file, you may want to monitor PECL commit messages.
To do you, you could, for example, subscribe to the PECL commit message mailing
list.
</para>
<section xml:id="mysqlnd-uh.changes_one_o">
<title xmlns="http://docbook.org/ns/docbook">PECL/mysqlnd_uh 1.0 series</title>
<para>
1.0.1-alpha
<itemizedlist>
<listitem>
<simpara>
Release date: TBD
</simpara>
</listitem>
<listitem>
<simpara>
Motto/theme: bug fix release
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
Feature changes
<itemizedlist>
<listitem>
<simpara>
Support of PHP 5.4.0 or later.
</simpara>
</listitem>
<listitem>
<simpara>
BC break: <literal>MysqlndUhConnection::changeUser()</literal> requires
additional <literal>passwd_len</literal> parameter.
</simpara>
</listitem>
<listitem>
<simpara>
BC break: <literal>MYSQLND_UH_VERSION_STR</literal> renamed to <literal>MYSQLND_UH_VERSION</literal>.
<literal>MYSQLND_UH_VERSION</literal> renamed to <literal>MYSQLND_UH_VERSION_ID</literal>.
</simpara>
</listitem>
<listitem>
<simpara>
BC break: <literal>mysqlnd_uh.enabled</literal> configuration setting renamed to <literal>mysqlnd_uh.enable</literal>.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
1.0.0-alpha
<itemizedlist>
<listitem>
<simpara>
Release date: 08/2010
</simpara>
</listitem>
<listitem>
<simpara>
Motto/theme: Initial release
</simpara>
</listitem>
</itemizedlist>
</para>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="mysqlnd-uh.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
&pecl.info;
<link xlink:href="&url.pecl.package;mysqlnd-uh">&url.pecl.package;mysqlnd-uh</link>
</para>
<para>
PECL/mysqlnd_uh is currently not available on Windows.
The source code of the extension makes use of <literal>C99</literal>
constructs not allowed with PHP Windows builds.
</para>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
&reference.mysqlnd-uh.functions.mysqlnd-uh-convert-to-mysqlnd;
&reference.mysqlnd-uh.functions.mysqlnd-uh-set-connection-proxy;
&reference.mysqlnd-uh.functions.mysqlnd-uh-set-statement-proxy;

View file

@ -0,0 +1,51 @@
&reference.mysqlnd-uh.mysqlnduhconnection.changeuser;
&reference.mysqlnd-uh.mysqlnduhconnection.charsetname;
&reference.mysqlnd-uh.mysqlnduhconnection.close;
&reference.mysqlnd-uh.mysqlnduhconnection.connect;
&reference.mysqlnd-uh.mysqlnduhconnection.construct;
&reference.mysqlnd-uh.mysqlnduhconnection.endpsession;
&reference.mysqlnd-uh.mysqlnduhconnection.escapestring;
&reference.mysqlnd-uh.mysqlnduhconnection.getaffectedrows;
&reference.mysqlnd-uh.mysqlnduhconnection.geterrornumber;
&reference.mysqlnd-uh.mysqlnduhconnection.geterrorstring;
&reference.mysqlnd-uh.mysqlnduhconnection.getfieldcount;
&reference.mysqlnd-uh.mysqlnduhconnection.gethostinformation;
&reference.mysqlnd-uh.mysqlnduhconnection.getlastinsertid;
&reference.mysqlnd-uh.mysqlnduhconnection.getlastmessage;
&reference.mysqlnd-uh.mysqlnduhconnection.getprotocolinformation;
&reference.mysqlnd-uh.mysqlnduhconnection.getserverinformation;
&reference.mysqlnd-uh.mysqlnduhconnection.getserverstatistics;
&reference.mysqlnd-uh.mysqlnduhconnection.getserverversion;
&reference.mysqlnd-uh.mysqlnduhconnection.getsqlstate;
&reference.mysqlnd-uh.mysqlnduhconnection.getstatistics;
&reference.mysqlnd-uh.mysqlnduhconnection.getthreadid;
&reference.mysqlnd-uh.mysqlnduhconnection.getwarningcount;
&reference.mysqlnd-uh.mysqlnduhconnection.init;
&reference.mysqlnd-uh.mysqlnduhconnection.killconnection;
&reference.mysqlnd-uh.mysqlnduhconnection.listfields;
&reference.mysqlnd-uh.mysqlnduhconnection.listmethod;
&reference.mysqlnd-uh.mysqlnduhconnection.moreresults;
&reference.mysqlnd-uh.mysqlnduhconnection.nextresult;
&reference.mysqlnd-uh.mysqlnduhconnection.ping;
&reference.mysqlnd-uh.mysqlnduhconnection.query;
&reference.mysqlnd-uh.mysqlnduhconnection.queryreadresultsetheader;
&reference.mysqlnd-uh.mysqlnduhconnection.reapquery;
&reference.mysqlnd-uh.mysqlnduhconnection.refreshserver;
&reference.mysqlnd-uh.mysqlnduhconnection.restartpsession;
&reference.mysqlnd-uh.mysqlnduhconnection.selectdb;
&reference.mysqlnd-uh.mysqlnduhconnection.sendclose;
&reference.mysqlnd-uh.mysqlnduhconnection.sendquery;
&reference.mysqlnd-uh.mysqlnduhconnection.serverdumpdebuginformation;
&reference.mysqlnd-uh.mysqlnduhconnection.setautocommit;
&reference.mysqlnd-uh.mysqlnduhconnection.setcharset;
&reference.mysqlnd-uh.mysqlnduhconnection.setclientoption;
&reference.mysqlnd-uh.mysqlnduhconnection.setserveroption;
&reference.mysqlnd-uh.mysqlnduhconnection.shutdownserver;
&reference.mysqlnd-uh.mysqlnduhconnection.simplecommand;
&reference.mysqlnd-uh.mysqlnduhconnection.simplecommandhandleresponse;
&reference.mysqlnd-uh.mysqlnduhconnection.sslset;
&reference.mysqlnd-uh.mysqlnduhconnection.stmtinit;
&reference.mysqlnd-uh.mysqlnduhconnection.storeresult;
&reference.mysqlnd-uh.mysqlnduhconnection.txcommit;
&reference.mysqlnd-uh.mysqlnduhconnection.txrollback;
&reference.mysqlnd-uh.mysqlnduhconnection.useresult;

View file

@ -0,0 +1,3 @@
&reference.mysqlnd-uh.mysqlnduhpreparedstatement.construct;
&reference.mysqlnd-uh.mysqlnduhpreparedstatement.execute;
&reference.mysqlnd-uh.mysqlnduhpreparedstatement.prepare;

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysqlnd-uh-convert-to-mysqlnd" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mysqlnd_uh_convert_to_mysqlnd</refname>
<refpurpose>Converts a MySQL connection handle into a mysqlnd connection handle</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mysqlnd_connection</type>
<methodname>mysqlnd_uh_convert_to_mysqlnd</methodname>
<methodparam><type>resource</type><parameter>mysql_connection</parameter></methodparam>
</methodsynopsis>
<para>
Converts a MySQL connection handle into a mysqlnd connection handle.
After conversion you can execute mysqlnd library calls on the connection handle.
This can be used to access mysqlnd functionality not made available
through user space API calls.
</para>
<para>
The function can be disabled with
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>.
If <literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
is set to <literal>FALSE</literal> the function will not install the proxy and
always return <literal>TRUE</literal>. Additionally, an error of the
type <literal>E_WARNING</literal> may be emitted. The error message may
read like <literal>PHP Warning: mysqlnd_uh_convert_to_mysqlnd(): (Mysqlnd User Handler)
The plugin has been disabled by setting the configuration parameter mysqlnd_uh.enable = false.
You are not allowed to call this function [...]</literal>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>MySQL connection handle</parameter></term>
<listitem>
<para>
A MySQL connection handle of type mysql, mysqli or PDO_MySQL.
</para>
<note>
<para>
The MySQL connection handle can be of no other type but <literal>mysqli</literal>
if using <literal>PHP &lt; 5.4.0</literal>.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A mysqlnd connection handle.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>mysqlnd_uh_convert_to_mysqlnd</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* PDO user API gives no access to connection thread id */
$mysql_connection = new PDO("mysql:host=localhost;dbname=test", "root", "");
/* Convert PDO MySQL handle to mysqlnd handle */
$mysqlnd = mysqlnd_uh_convert_to_mysqlnd($mysql_connection);
/* Create Proxy to call mysqlnd connection class methods */
$obj = new MySQLndUHConnection();
/* Call mysqlnd_conn::get_thread_id */
var_dump($obj->getThreadId($mysqlnd));
/* Use SQL to fetch connection thread id */
var_dump($mysql_connection->query("SELECT CONNECTION_ID()")->fetchAll());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(27054)
array(1) {
[0]=>
array(2) {
["CONNECTION_ID()"]=>
string(5) "27054"
[0]=>
string(5) "27054"
}
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysqlnd-uh-set-connection-proxy" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mysqlnd_uh_set_connection_proxy</refname>
<refpurpose>Installs a proxy for mysqlnd connections</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>mysqlnd_uh_set_connection_proxy</methodname>
<methodparam><type>MysqlndUhConnection object</type><parameter role="reference">connection_proxy</parameter></methodparam>
<methodparam choice="opt"><type>mysqli</type><parameter role="reference">mysqli_connection</parameter></methodparam>
</methodsynopsis>
<para>
Installs a proxy object to hook mysqlnd's connection objects methods.
Once installed, the proxy will be used for all MySQL connections
opened with <link linkend="ref.mysqli">mysqli</link>,
<link linkend="ref.mysql">mysql</link> or
<link linkend="ref.pdo-mysql">PDO_MYSQL</link>, assuming that the listed
extensions are compiled to use the <link linkend="book.mysqlnd">mysqlnd</link>
library.
</para>
<para>
The function can be disabled with
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>.
If <literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
is set to <literal>FALSE</literal> the function will not install the proxy and
always return <literal>TRUE</literal>. Additionally, an error of the
type <literal>E_WARNING</literal> may be emitted. The error message may
read like <literal>PHP Warning: mysqlnd_uh_set_connection_proxy(): (Mysqlnd User Handler)
The plugin has been disabled by setting the configuration parameter mysqlnd_uh.enable = false.
The proxy has not been installed [...]</literal>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection_proxy</parameter></term>
<listitem>
<para>
A proxy object of type <literal>MysqlndUhConnection</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mysqli_connection</parameter></term>
<listitem>
<para>
Object of type <literal>mysqli</literal>.
If given, the proxy will be set for this particular connection only.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>mysqlnd_uh_set_connection_proxy</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$mysqli = new mysqli("localhost", "root", "", "test");
$mysqli->query("SELECT 'No proxy installed, yet'");
class proxy extends MysqlndUhConnection {
public function query($res, $query) {
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
$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->query("SELECT 'mysqlnd rocks!'");
$mysql = mysql_connect("localhost", "root", "", "test");
mysql_query("SELECT 'Ahoy Andrey!'", $mysql);
$pdo = new PDO("mysql:host=localhost;dbname=test", "root", "");
$pdo->query("SELECT 'Moin Johannes!'");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::query(array (
0 => NULL,
1 => 'SELECT \'mysqlnd rocks!\'',
))
proxy::query returns true
proxy::query(array (
0 => NULL,
1 => 'SELECT \'Ahoy Andrey!\'',
))
proxy::query returns true
proxy::query(array (
0 => NULL,
1 => 'SELECT \'Moin Johannes!\'',
))
proxy::query returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_statement_proxy</function>
</member>
<member>
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysqlnd-uh-set-statement-proxy" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mysqlnd_uh_set_statement_proxy</refname>
<refpurpose>Installs a proxy for mysqlnd statements</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>mysqlnd_uh_set_statement_proxy</methodname>
<methodparam><type>MysqlndUhStatement object</type><parameter role="reference">statement_proxy</parameter></methodparam>
</methodsynopsis>
<para>
Installs a proxy for mysqlnd statements.
The proxy object will be used for all mysqlnd prepared
statement objects, regardless which PHP MySQL extension
(<link linkend="ref.mysqli">mysqli</link>,
<link linkend="ref.mysql">mysql</link>,
<link linkend="ref.pdo-mysql">PDO_MYSQL</link>)
has created them as long as the extension is compiled
to use the <link linkend="book.mysqlnd">mysqlnd</link>
library.
</para>
<para>
The function can be disabled with
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>.
If <literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
is set to <literal>FALSE</literal> the function will not install the proxy and
always return <literal>TRUE</literal>. Additionally, an error of the
type <literal>E_WARNING</literal> may be emitted. The error message may
read like <literal>PHP Warning: mysqlnd_uh_set_statement_proxy(): (Mysqlnd User Handler)
The plugin has been disabled by setting the configuration parameter mysqlnd_uh.enable = false.
The proxy has not been installed [...]</literal>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>statement_proxy</parameter></term>
<listitem>
<para>
The mysqlnd statement proxy object of type <literal>MysqlndUhStatement</literal>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="mysqlnd-uh.configuration" xmlns="http://docbook.org/ns/docbook">
&reftitle.runtime;
&extension.runtime;
<para>
<table>
<title>Mysqlnd_uh &ConfigureOptions;</title>
<tgroup cols="4">
<thead>
<row>
<entry>&Name;</entry>
<entry>&Default;</entry>
<entry>&Changeable;</entry>
<entry>&Changelog;</entry>
</row>
</thead>
<tbody>
<row>
<entry>mysqlnd_uh.enable</entry>
<entry>1</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
<row>
<entry>mysqlnd_uh.report_wrong_types</entry>
<entry>1</entry>
<entry>PHP_INI_ALL</entry>
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
&ini.descriptions.title;
<para>
<variablelist>
<varlistentry xml:id="ini.mysqlnd-uh.enable">
<term>
<parameter>mysqlnd_uh.enable</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Enables or disables the plugin. If set to disabled, the extension will not
allow users to plug into
<link linkend="book.mysqlnd">mysqlnd</link> to hook
<link linkend="book.mysqlnd">mysqlnd</link> calls.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.mysqlnd-uh.report-wrong-types">
<term>
<parameter>mysqlnd_uh.report_wrong_types</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Wheter to report wrong return value types of user hooks as error
of the type <literal>E_WARNING</literal>. It is strongly recommended
to use this setting for detecting possible issues.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mysqlnduhconnection" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MysqlndUhConnection class</title>
<titleabbrev>MysqlndUhConnection</titleabbrev>
<partintro>
<!-- {{{ MysqlndUhConnection intro -->
<section xml:id="mysqlnduhconnection.intro">
&reftitle.intro;
<para>
</para>
</section>
<!-- }}} -->
<section xml:id="mysqlnduhconnection.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MysqlndUhConnection</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MysqlndUhConnection</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mysqlnduhconnection')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.mysqlnd-uh.entities.mysqlnduhconnection;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.changeuser" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::changeUser</refname>
<refpurpose>Changes the user of the specified mysqlnd database connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::changeUser</methodname>
<methodparam><type>mysqlnd_onnection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
<methodparam><type>bool</type><parameter>silent</parameter></methodparam>
<methodparam><type>integer</type><parameter>passwd_len</parameter></methodparam>
</methodsynopsis>
<para>
Changes the user of the specified mysqlnd database connection
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>user</parameter></term>
<listitem>
<para>
The MySQL user name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
The MySQL password.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>database</parameter></term>
<listitem>
<para>
The MySQL database to change to.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>silent</parameter></term>
<listitem>
<para>
Controls if mysqlnd is allowed to emit errors or not.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>passwd_len</parameter></term>
<listitem>
<para>
Length of the MySQL password.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::changeUser</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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"));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::changeUser(array (
0 => NULL,
1 => 'root',
2 => 'bar',
3 => 'test',
4 => false,
5 => 3,
))
proxy::changeUser returns false
bool(false)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_change_user</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.charsetname" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::charsetName</refname>
<refpurpose>Returns the default character set for the database connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::charsetName</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the default character set for the database connection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The default cahracter set.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::charsetName</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::charsetName(array (
0 => NULL,
))
proxy::charsetName returns 'latin1'
string(6) "latin1"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_character_set_name</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.close" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::close</refname>
<refpurpose>Closes a previously opened database connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::close</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>close_type</parameter></methodparam>
</methodsynopsis>
<para>
Closes a previously opened database connection.
</para>
<note>
<para>
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 <literal>mysqlnd</literal> library functions have never been designed
to be exposed to the user space.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
The connection to be closed. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>close_type</parameter></term>
<listitem>
<para>
Why the connection is to be closed. The value
of <parameter>close_type</parameter> is one of
<constant>MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT</constant>,
<constant>MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT</constant>,
<constant>MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED</constant> or
<constant>MYSQLND_UH_MYSQLND_CLOSE_LAST</constant>. The
latter should never be seen, unless the default
behaviour of the <literal>mysqlnd</literal> library
has been changed by a plugin.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::close</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
function 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::close(array (
0 => NULL,
1 => 0,
))
close_type = MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT
proxy::close returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_close</function>
</member>
<member>
<function>mysql_close</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.connect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::connect</refname>
<refpurpose>Open a new connection to the MySQL server</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::connect</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
<methodparam><type>string</type><parameter>use"</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
<methodparam><type>integer</type><parameter>port</parameter></methodparam>
<methodparam><type>string</type><parameter>socket</parameter></methodparam>
<methodparam><type>integer</type><parameter>"mysql_flags"</parameter></methodparam>
</methodsynopsis>
<para>
Open a new connection to the MySQL server.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>host</parameter></term>
<listitem>
<para>
Can be either a host name or an IP address. Passing the NULL value or
the string &quot;localhost&quot; to this parameter,
the local host is assumed. When possible, pipes will be used
instead of the TCP/IP protocol.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>user</parameter></term>
<listitem>
<para>
The MySQL user name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
If not provided or <literal>NULL</literal>,
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).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>database</parameter></term>
<listitem>
<para>
If provided will specify the default database to be used when performing queries.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<para>
Specifies the port number to attempt to connect to the MySQL server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>socket</parameter></term>
<listitem>
<para>
Specifies the socket or named pipe that should be used.
If <literal>NULL</literal>, mysqlnd will default to
<literal>/tmp/mysql.sock</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mysql_flags</parameter></term>
<listitem>
<para>
Connection options.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::connect</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::connect(array (
0 => NULL,
1 => 'localhost',
2 => 'root',
3 => '',
4 => 'test',
5 => 3306,
6 => NULL,
7 => 131072,
))
proxy::connect returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_connect</function>
</member>
<member>
<function>mysql_connect</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::__construct</refname>
<refpurpose>The __construct purpose</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<methodname>MysqlndUhConnection::__construct</methodname>
<void />
</methodsynopsis>
<para>
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.endpsession" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::endPSession</refname>
<refpurpose>End a persistent connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::endPSession</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
End a persistent connection
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::endPSession</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::endPSession(array (
0 => NULL,
))
proxy::endPSession returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.escapestring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::escapeString</refname>
<refpurpose>
Escapes special characters in a string for use in an SQL statement,
taking into account the current charset of the connection
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::escapeString</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>escape_string</parameter></methodparam>
</methodsynopsis>
<para>
Escapes special characters in a string for use in an SQL statement,
taking into account the current charset of the connection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>MYSQLND_UH_RES_MYSQLND_NAME</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>escape_string</parameter></term>
<listitem>
<para>
The string to be escaped.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The escaped string.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::escapeString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::escapeString(array (
0 => NULL,
1 => 'test0\'test',
))
proxy::escapeString returns 'test0\\\'test'
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_real_escape_string</function>
</member>
<member>
<function>mysql_real_escape_string</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getaffectedrows" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getAffectedRows</refname>
<refpurpose>Gets the number of affected rows in a previous MySQL operation</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getAffectedRows</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Gets the number of affected rows in a previous MySQL operation.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Number of affected rows.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getAffectedRows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getAffectedRows(array (
0 => NULL,
))
proxy::getAffectedRows returns 1
int(1)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_affected_rows</function>
</member>
<member>
<function>mysql_affected_rows</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.geterrornumber" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getErrorNumber</refname>
<refpurpose>Returns the error code for the most recent function call</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getErrorNumber</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the error code for the most recent function call.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Error code for the most recent function call.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<function>MysqlndUhConnection::getErrorNumber</function> is not only executed
after the invocation of a user space API call which maps directly to it but also
called internally.
</para>
<para>
<example>
<title><function>MysqlndUhConnection::getErrorNumber</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
connect...
proxy::getErrorNumber(array (
0 => NULL,
))
proxy::getErrorNumber returns 0
query...
errno...
proxy::getErrorNumber(array (
0 => NULL,
))
proxy::getErrorNumber returns 1064
int(1064)
close...
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>MysqlndUhConnection::getErrorString</function>
</member>
<member>
<function>mysqli_errno</function>
</member>
<member>
<function>mysql_errno</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.geterrorstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getErrorString</refname>
<refpurpose>Returns a string description of the last error</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::getErrorString</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string description of the last error.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Error string for the most recent function call.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<function>MysqlndUhConnection::getErrorString</function> is not only executed
after the invocation of a user space API call which maps directly to it but also
called internally.
</para>
<para>
<example>
<title><function>MysqlndUhConnection::getErrorString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
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...
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>MysqlndUhConnection::getErrorNumber</function>
</member>
<member>
<function>mysqli_error</function>
</member>
<member>
<function>mysql_error</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getfieldcount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getFieldCount</refname>
<refpurpose>Returns the number of columns for the most recent query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getFieldCount</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of columns for the most recent query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Number of columns.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<function>MysqlndUhConnection::getFieldCount</function> is not only executed
after the invocation of a user space API call which maps directly to it but also
called internally.
</para>
<para>
<example>
<title><function>MysqlndUhConnection::getFieldCount</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getFieldCount(array (
0 => NULL,
))
proxy::getFieldCount returns 0
int(0)
proxy::getFieldCount(array (
0 => NULL,
))
proxy::getFieldCount returns 3
proxy::getFieldCount(array (
0 => NULL,
))
proxy::getFieldCount returns 3
int(3)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_field_count</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.gethostinformation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getHostInformation</refname>
<refpurpose>Returns a string representing the type of connection used</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::getHostInformation</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string representing the type of connection used.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Connection description.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getHostInformation</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getHostInformation(array (
0 => NULL,
))
proxy::getHostInformation returns 'Localhost via UNIX socket'
string(25) "Localhost via UNIX socket"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_get_host_info</function>
</member>
<member>
<function>mysql_get_host_info</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getlastinsertid" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getLastInsertId</refname>
<refpurpose>Returns the auto generated id used in the last query.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getLastInsertId</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the auto generated id used in the last query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Last insert id.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getLastInsertId</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getLastInsertId(array (
0 => NULL,
))
proxy::getLastInsertId returns 1
int(1)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_insert_id</function>
</member>
<member>
<function>mysql_insert_id</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getlastmessage" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getLastMessage</refname>
<refpurpose>Retrieves information about the most recently executed query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>MysqlndUhConnection::getLastMessage</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves information about the most recently executed query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Last message. Trying to return a string longer than 511 bytes
will cause an error of the type <literal>E_WARNING</literal> and
result in the string being truncated.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getLastMessage</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getLastMessage(array (
0 => NULL,
))
proxy::getLastMessage returns ''
string(0) ""
proxy::getLastMessage(array (
0 => NULL,
))
proxy::getLastMessage returns ''
string(0) ""
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_info</function>
</member>
<member>
<function>mysql_info</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getprotocolinformation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getProtocolInformation</refname>
<refpurpose>Returns the version of the MySQL protocol used</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::getProtocolInformation</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the version of the MySQL protocol used.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The protocol version.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getProtocolInformation</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getProtocolInformation(array (
0 => NULL,
))
proxy::getProtocolInformation returns 10
int(10)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_get_proto_info</function>
</member>
<member>
<function>mysql_get_proto_info</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getserverinformation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getServerInformation</refname>
<refpurpose>Returns the version of the MySQL server</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::getServerInformation</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the version of the MySQL server.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The server version.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getServerInformation</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getServerInformation(array (
0 => NULL,
))
proxy::getServerInformation returns '5.1.45-debug-log'
string(16) "5.1.45-debug-log"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_get_server_info</function>
</member>
<member>
<function>mysql_get_server_info</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getserverstatistics" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getServerStatistics</refname>
<refpurpose>Gets the current system status</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::getServerStatistics</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Gets the current system status.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The system status message.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getServerStatistics</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
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"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_stat</function>
</member>
<member>
<function>mysql_stat</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getserverversion" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getServerVersion</refname>
<refpurpose>Returns the version of the MySQL server as an integer</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getServerVersion</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the version of the MySQL server as an integer.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The MySQL version.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getServerVersion</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getServerVersion(array (
0 => NULL,
))
proxy::getServerVersion returns 50145
int(50145)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_get_server_version</function>
</member>
<member>
<function>mysql_get_server_version</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getsqlstate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getSqlstate</refname>
<refpurpose>Returns the SQLSTATE error from previous MySQL operation</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MysqlndUhConnection::getSqlstate</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the SQLSTATE error from previous MySQL operation.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The SQLSTATE code.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getSqlstate</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getSqlstate(array (
0 => NULL,
))
proxy::getSqlstate returns '00000'
string(5) "00000"
proxy::getSqlstate(array (
0 => NULL,
))
proxy::getSqlstate returns '42000'
string(5) "42000"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_sql_state</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,600 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getstatistics" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getStatistics</refname>
<refpurpose>Returns statistics about the client connection.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>MysqlndUhConnection::getStatistics</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns statistics about the client connection.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Connection statistics collected by mysqlnd.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getStatistics</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
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"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_get_connection_stats</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getthreadid" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getThreadId</refname>
<refpurpose>Returns the thread ID for the current connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getThreadId</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the thread ID for the current connection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Connection thread id.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getThreadId</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getThreadId(array (
0 => NULL,
))
proxy::getThreadId returns 27646
int(27646)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_thread_id</function>
</member>
<member>
<function>mysql_thread_id</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.getwarningcount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::getWarningCount</refname>
<refpurpose>Returns the number of warnings from the last query for the given link</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>MysqlndUhConnection::getWarningCount</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of warnings from the last query for the given link.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Number of warnings.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::getWarningCount</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::getWarningCount(array (
0 => NULL,
))
proxy::getWarningCount returns 0
int(0)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_warning_count</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.init" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::init</refname>
<refpurpose>Initialize mysqlnd connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::init</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Initialize mysqlnd connection. This is an mysqlnd internal call to initialize
the connection object.
</para>
<note>
<para>
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 <literal>mysqlnd</literal> library functions have never been designed
to be exposed to the user space.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::init</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::init(array (
0 => NULL,
))
proxy::init returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.killconnection" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::killConnection</refname>
<refpurpose>Asks the server to kill a MySQL thread</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::killConnection</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>pid</parameter></methodparam>
</methodsynopsis>
<para>
Asks the server to kill a MySQL thread.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pid</parameter></term>
<listitem>
<para>
Thread Id of the connection to be killed.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::kill</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::killConnection(array (
0 => NULL,
1 => 27650,
))
proxy::killConnection returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_kill</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.listfields" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::listFields</refname>
<refpurpose>List MySQL table fields</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>MysqlndUhConnection::listFields</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table</parameter></methodparam>
<methodparam><type>string</type><parameter>achtung_wild</parameter></methodparam>
</methodsynopsis>
<para>
List MySQL table fields.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>table</parameter></term>
<listitem>
<para>
The name of the table that's being queried.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
Name pattern.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::listFields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::listFields(array (
0 => NULL,
1 => 'test_a',
2 => '',
))
proxy::listFields returns NULL
num_rows = 0
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysql_list_fields</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.listmethod" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::listMethod</refname>
<refpurpose>Wrapper for assorted list commands</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>MysqlndUhConnection::listMethod</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam><type>string</type><parameter>achtung_wild</parameter></methodparam>
<methodparam><type>string</type><parameter>par1</parameter></methodparam>
</methodsynopsis>
<para>
Wrapper for assorted list commands.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
SHOW command to be executed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>achtung_wild</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>par1</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
TODO
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::listMethod</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::listMethod(array (
0 => NULL,
1 => 'SHOW DATABASES',
2 => '',
3 => '',
))
proxy::listMethod returns NULL
num_rows = 6
array(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"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysql_list_dbs</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.moreresults" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::moreResults</refname>
<refpurpose>Check if there are any more query results from a multi query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::moreResults</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Check if there are any more query results from a multi query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::moreResults</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(1) {
["_one"]=>
string(1) "1"
}
----------------------------------------
proxy::moreResults(array (
0 => NULL,
))
proxy::moreResults returns true
proxy::moreResults(array (
0 => NULL,
))
proxy::moreResults returns true
array(1) {
["_two"]=>
string(1) "2"
}
----------------------------------------
proxy::moreResults(array (
0 => NULL,
))
proxy::moreResults returns false
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_more_results</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.nextresult" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::nextResult</refname>
<refpurpose>Prepare next result from multi_query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::nextResult</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Prepare next result from multi_query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::nextResult</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(1) {
["_one"]=>
string(1) "1"
}
----------------------------------------
proxy::nextResult(array (
0 => NULL,
))
proxy::nextResult returns true
array(1) {
["_two"]=>
string(1) "2"
}
----------------------------------------
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_next_result</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.ping" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::ping</refname>
<refpurpose>Pings a server connection, or tries to reconnect if the connection has gone down</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::ping</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Pings a server connection, or tries to reconnect if the connection has gone down.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::ping</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::ping(array (
0 => NULL,
))
proxy::ping returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_ping</function>
</member>
<member>
<function>mysql_ping</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.query" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::query</refname>
<refpurpose>Performs a query on the database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::query</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Performs a query on the database (COM_QUERY).
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The query string.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::query</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::query(array (
0 => NULL,
1 => 'SELECT \'Welcome mysqlnd_uh!\' FROM DUAL',
))
proxy::query returns true
array(1) {
["How about query rewriting?"]=>
string(26) "How about query rewriting?"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_query</function>
</member>
<member>
<function>mysql_query</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.queryreadresultsetheader" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::queryReadResultsetHeader</refname>
<refpurpose>Read a result set header</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::queryReadResultsetHeader</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>mysqlnd_statement</type><parameter>mysqlnd_stmt</parameter></methodparam>
</methodsynopsis>
<para>
Read a result set header.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mysqlnd_stmt</parameter></term>
<listitem>
<para>
Mysqlnd statement handle. Do not modify!
Set to <literal>NULL</literal>, if function
is not used in the context of a prepared statement.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::queryReadResultsetHeader</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::queryReadResultsetHeader(array (
0 => NULL,
1 => NULL,
))
proxy::queryReadResultsetHeader returns true
array(1) {
["Welcome mysqlnd_uh!"]=>
string(19) "Welcome mysqlnd_uh!"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.reapquery" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::reapQuery</refname>
<refpurpose>Get result from async query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::reapQuery</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Get result from async query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::reapQuery</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::reapQuery(array (
0 => NULL,
))
proxy::reapQuery returns true
array(1) {
["one dot one"]=>
string(3) "1.1"
}
proxy::reapQuery(array (
0 => NULL,
))
proxy::reapQuery returns true
array(2) {
["one"]=>
string(1) "1"
["_sleep"]=>
string(1) "0"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_real_async_query</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.refreshserver" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::refreshServer</refname>
<refpurpose>Flush or reset tables and caches</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::refreshServer</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
Flush or reset tables and caches.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
What to refresh.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::refreshServer</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::refreshServer(array (
0 => NULL,
1 => 1,
))
proxy::refreshServer returns false
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.restartpsession" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::restartPSession</refname>
<refpurpose>Restart a persistent mysqlnd connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::restartPSession</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Restart a persistent mysqlnd connection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::restartPSession</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::restartPSession(array (
0 => NULL,
))
proxy::restartPSession returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.selectdb" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::selectDb</refname>
<refpurpose>Selects the default database for database queries</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::selectDb</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
</methodsynopsis>
<para>
Selects the default database for database queries.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>database</parameter></term>
<listitem>
<para>
The database name.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::selectDb</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::selectDb(array (
0 => NULL,
1 => 'mysql',
))
proxy::selectDb returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_select_db</function>
</member>
<member>
<function>mysql_select_db</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.sendclose" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::sendClose</refname>
<refpurpose>Sends a close command to MySQL</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::sendClose</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Sends a close command to MySQL.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::sendClose</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::sendClose(array (
0 => NULL,
))
proxy::sendClose returns true
proxy::sendClose(array (
0 => NULL,
))
proxy::sendClose returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.sendquery" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::sendQuery</refname>
<refpurpose>Sends a query to MySQL</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::sendQuery</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Sends a query to MySQL.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The query string.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::sendQuery</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::sendQuery(array (
0 => NULL,
1 => 'SELECT 1',
))
proxy::sendQuery returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.serverdumpdebuginformation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::serverDumpDebugInformation</refname>
<refpurpose>Dump debugging information into the log for the MySQL server</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::serverDumpDebugInformation</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Dump debugging information into the log for the MySQL server.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::serverDumpDebugInformation</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::serverDumpDebugInformation(array (
0 => NULL,
))
proxy::serverDumpDebugInformation returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_dump_debug_info</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.setautocommit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::setAutocommit</refname>
<refpurpose>Turns on or off auto-commiting database modifications</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::setAutocommit</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
Turns on or off auto-commiting database modifications
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
Whether to turn on auto-commit or not.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::setAutocommit</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::setAutocommit(array (
0 => NULL,
1 => 0,
))
proxy::setAutocommit returns true
proxy::setAutocommit(array (
0 => NULL,
1 => 1,
))
proxy::setAutocommit returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_autocommit</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.setcharset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::setCharset</refname>
<refpurpose>Sets the default client character set</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::setCharset</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>charset</parameter></methodparam>
</methodsynopsis>
<para>
Sets the default client character set.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>charset</parameter></term>
<listitem>
<para>
The charset to be set as default.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::setCharset</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::setCharset(array (
0 => NULL,
1 => 'latin1',
))
proxy::setCharset returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_set_charset</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,199 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.setclientoption" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::setClientOption</refname>
<refpurpose>Sets a client option</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::setClientOption</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>option</parameter></methodparam>
<methodparam><type>integer</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Sets a client option.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
The option to be set.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
Optional option value, if required.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::setClientOption</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
function 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::setClientOption(array (
0 => NULL,
1 => 210,
2 => 3221225472,
))
Option 'MYSQLND_UH_MYSQLND_OPT_MAX_ALLOWED_PACKET' set to 3221225472
proxy::setClientOption returns true
proxy::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 true
proxy::setClientOption(array (
0 => NULL,
1 => 8,
2 => 1,
))
Option 'MYSQLND_UH_MYSQLND_OPT_LOCAL_INFILE' set to 1
proxy::setClientOption returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_real_connect</function>
</member>
<member>
<function>mysqli_options</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.setserveroption" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::setServerOption</refname>
<refpurpose>Sets a server option</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>MysqlndUhConnection::setServerOption</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>option</parameter></methodparam>
</methodsynopsis>
<para>
Sets a server option.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
The option to be set.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::setServerOption</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
function 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::setServerOption(array (
0 => NULL,
1 => 0,
))
Option 'MYSQLND_UH_SERVER_OPTION_MULTI_STATEMENTS_ON' set
proxy::setServerOption returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_real_connect</function>
</member>
<member>
<function>mysqli_options</function>
</member>
<member>
<function>mysqli_multi_query</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.shutdownserver" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::shutdownServer</refname>
<refpurpose>The shutdownServer purpose</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>MysqlndUhConnection::shutdownServer</methodname>
<methodparam><type>string</type><parameter>MYSQLND_UH_RES_MYSQLND_NAME</parameter></methodparam>
<methodparam><type>string</type><parameter>"level"</parameter></methodparam>
</methodsynopsis>
<para>
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>MYSQLND_UH_RES_MYSQLND_NAME</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>"level"</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.simplecommand" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::simpleCommand</refname>
<refpurpose>Sends a basic COM_* command</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::simpleCommand</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>command</parameter></methodparam>
<methodparam><type>string</type><parameter>arg</parameter></methodparam>
<methodparam><type>integer</type><parameter>ok_packet</parameter></methodparam>
<methodparam><type>bool</type><parameter>silent</parameter></methodparam>
<methodparam><type>bool</type><parameter>ignore_upsert_status</parameter></methodparam>
</methodsynopsis>
<para>
Sends a basic COM_* command to MySQL.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>command</parameter></term>
<listitem>
<para>
The COM command to be send.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>arg</parameter></term>
<listitem>
<para>
Optional COM command arguments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ok_packet</parameter></term>
<listitem>
<para>
The OK packet type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>silent</parameter></term>
<listitem>
<para>
Whether mysqlnd may emit errors.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ignore_upsert_status</parameter></term>
<listitem>
<para>
Whether to ignore <literal>UPDATE</literal>/<literal>INSERT</literal> status.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::simpleCommand</function> example</title>
<programlisting role="php">
<![CDATA[
<?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 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
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
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.simplecommandhandleresponse" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::simpleCommandHandleResponse</refname>
<refpurpose>Process a response for a basic COM_* command send to the client</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::simpleCommandHandleResponse</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>integer</type><parameter>ok_packet</parameter></methodparam>
<methodparam><type>bool</type><parameter>silent</parameter></methodparam>
<methodparam><type>integer</type><parameter>command</parameter></methodparam>
<methodparam><type>bool</type><parameter>ignore_upsert_status</parameter></methodparam>
</methodsynopsis>
<para>
Process a response for a basic COM_* command send to the client.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ok_packet</parameter></term>
<listitem>
<para>
The OK packet type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>silent</parameter></term>
<listitem>
<para>
Whether mysqlnd may emit errors.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>command</parameter></term>
<listitem>
<para>
The COM command to process results from.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ignore_upsert_status</parameter></term>
<listitem>
<para>
Whether to ignore <literal>UPDATE</literal>/<literal>INSERT</literal> status.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::simpleCommandHandleResponse</function> example</title>
<programlisting role="php">
<![CDATA[
<?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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
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
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.sslset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::sslSet</refname>
<refpurpose>Used for establishing secure connections using SSL</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::sslSet</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>string</type><parameter>cert</parameter></methodparam>
<methodparam><type>string</type><parameter>ca</parameter></methodparam>
<methodparam><type>string</type><parameter>capath</parameter></methodparam>
<methodparam><type>string</type><parameter>cipher</parameter></methodparam>
</methodsynopsis>
<para>
Used for establishing secure connections using SSL.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The path name to the key file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>cert</parameter></term>
<listitem>
<para>
The path name to the certificate file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ca</parameter></term>
<listitem>
<para>
The path name to the certificate authority file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>capath</parameter></term>
<listitem>
<para>
The pathname to a directory that contains trusted SSL CA certificates in PEM format.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>cipher</parameter></term>
<listitem>
<para>
A list of allowable ciphers to use for SSL encryption.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::sslSet</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class proxy extends MysqlndUhConnection {
public function sslSet($conn, $key, $cert, $ca, $capth, $cipher) {
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
$ret = parent::sslSet($conn, $key, $cert, $ca, $capth, $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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::sslSet(array (
0 => NULL,
1 => 'key',
2 => 'cert',
3 => 'ca',
4 => 'capath',
5 => 'cipher',
))
proxy::sslSet returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_ssl_set</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.stmtinit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::stmtInit</refname>
<refpurpose>Initializes a statement and returns a resource for use with mysqli_statement::prepare</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>resource</type><methodname>MysqlndUhConnection::stmtInit</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Initializes a statement and returns a resource for use with mysqli_statement::prepare.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Resource of type <literal>Mysqlnd Prepared Statement (internal only - you must not modify it!)</literal>.
The documentation may also refer to such resources using the alias name
<literal>mysqlnd_prepared_statement</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::stmtInit</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::stmtInit(array (
0 => NULL,
))
resource(19) of type (Mysqlnd Connection)
proxy::stmtInit returns NULL
resource(246) of type (Mysqlnd Prepared Statement (internal only - you must not modify it!))
int(1)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_stmt_init</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.storeresult" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::storeResult</refname>
<refpurpose>Transfers a result set from the last query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>resource</type><methodname>MysqlndUhConnection::storeResult</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Transfers a result set from the last query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Resource of type <literal>Mysqlnd Resultset (internal only - you must not modify it!)</literal>.
The documentation may also refer to such resources using the alias name
<literal>mysqlnd_resultset</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::storeResult</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::storeResult(array (
0 => NULL,
))
proxy::storeResult returns NULL
resource(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 NULL
resource(730) of type (Mysqlnd Resultset (internal only - you must not modify it!))
array(1) {
["_msg"]=>
string(13) "Good morning!"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_store_result</function>
</member>
<member>
<function>mysqli_real_query</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.txcommit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::txCommit</refname>
<refpurpose>Commits the current transaction</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::txCommit</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Commits the current transaction.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::txCommit</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::txCommit(array (
0 => NULL,
))
proxy::txCommit returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_commit</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.txrollback" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::txRollback</refname>
<refpurpose>Rolls back current transaction</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::txRollback</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Rolls back current transaction.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::txRollback</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::txRollback(array (
0 => NULL,
))
proxy::txRollback returns true
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_commit</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.useresult" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::useResult</refname>
<refpurpose>Initiate a result set retrieval</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>resource</type><methodname>MysqlndUhConnection::useResult</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Initiate a result set retrieval.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Resource of type <literal>Mysqlnd Resultset (internal only - you must not modify it!)</literal>.
The documentation may also refer to such resources using the alias name
<literal>mysqlnd_resultset</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::useResult</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class 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());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::useResult(array (
0 => NULL,
))
proxy::useResult returns NULL
resource(425) of type (Mysqlnd Resultset (internal only - you must not modify it!))
array(1) {
["_msg"]=>
string(13) "Good morning!"
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_use_result</function>
</member>
<member>
<function>mysqli_real_query</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mysqlnduhpreparedstatement" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MysqlndUhPreparedStatement class</title>
<titleabbrev>MysqlndUhPreparedStatement</titleabbrev>
<partintro>
<!-- {{{ MysqlndUhPreparedStatement intro -->
<section xml:id="mysqlnduhpreparedstatement.intro">
&reftitle.intro;
<para>
</para>
</section>
<!-- }}} -->
<section xml:id="mysqlnduhpreparedstatement.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MysqlndUhPreparedStatement</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MysqlndUhPreparedStatement</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mysqlnduhpreparedstatement')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.mysqlnd-uh.entities.mysqlnduhpreparedstatement;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhpreparedstatement.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhPreparedStatement::__construct</refname>
<refpurpose>The __construct purpose</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<methodname>MysqlndUhPreparedStatement::__construct</methodname>
<void />
</methodsynopsis>
<para>
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhpreparedstatement.execute" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhPreparedStatement::execute</refname>
<refpurpose>Executes a prepared Query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhPreparedStatement::execute</methodname>
<methodparam><type>mysqlnd_prepared_statement</type><parameter>statement</parameter></methodparam>
</methodsynopsis>
<para>
Executes a prepared Query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>statement</parameter></term>
<listitem>
<para>
Mysqlnd prepared statement handle. Do not modify!
Resource of type <literal>Mysqlnd Prepared Statement (internal only - you must not modify it!)</literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhPreparedStatement::execute</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class stmt_proxy extends MysqlndUhPreparedStatement {
public function execute($res) {
printf("%s(", __METHOD__);
var_dump($res);
printf(")\n");
$ret = parent::execute($res);
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
var_dump($ret);
return $ret;
}
}
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
$mysqli = new mysqli("localhost", "root", "", "test");
$stmt = $mysqli->prepare("SELECT 'Labskaus' AS _msg FROM DUAL");
$stmt->execute();
$msg = NULL;
$stmt->bind_result($msg);
$stmt->fetch();
var_dump($msg);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
stmt_proxy::execute(resource(256) of type (Mysqlnd Prepared Statement (internal only - you must not modify it!))
)
stmt_proxy::execute returns true
bool(true)
string(8) "Labskaus"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_statement_proxy</function>
</member>
<member>
<function>mysqli_stmt_execute</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhpreparedstatement.prepare" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhPreparedStatement::prepare</refname>
<refpurpose>Prepare an SQL statement for execution</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhPreparedStatement::prepare</methodname>
<methodparam><type>mysqlnd_prepared_statement</type><parameter>statement</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Prepare an SQL statement for execution.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>statement</parameter></term>
<listitem>
<para>
Mysqlnd prepared statement handle. Do not modify!
Resource of type <literal>Mysqlnd Prepared Statement (internal only - you must not modify it!)</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The query to be prepared.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <literal>TRUE</literal> on success.
Otherwise, returns <literal>FALSE</literal>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhPreparedStatement::prepare</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class stmt_proxy extends MysqlndUhPreparedStatement {
public function prepare($res, $query) {
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
$query = "SELECT 'No more you-know-what-I-mean for lunch, please' AS _msg FROM DUAL";
$ret = parent::prepare($res, $query);
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
var_dump($ret);
return $ret;
}
}
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
$mysqli = new mysqli("localhost", "root", "", "test");
$stmt = $mysqli->prepare("SELECT 'Labskaus' AS _msg FROM DUAL");
$stmt->execute();
$msg = NULL;
$stmt->bind_result($msg);
$stmt->fetch();
var_dump($msg);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
stmt_proxy::prepare(array (
0 => NULL,
1 => 'SELECT \'Labskaus\' AS _msg FROM DUAL',
))
stmt_proxy::prepare returns true
bool(true)
string(46) "No more you-know-what-I-mean for lunch, please"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_statement_proxy</function>
</member>
<member>
<function>mysqli_stmt_prepare</function>
</member>
<member>
<function>mysqli_prepare</function>
</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,475 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 317722 $ -->
<chapter xml:id="mysqlnd-uh.quickstart" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Quickstart and Examples</title>
<para>
The mysqlnd user handler plugin can be understood as a client-side proxy
for all PHP MySQL extensions (<link linkend="ref.mysqli">mysqli</link>,
<link linkend="ref.mysql">mysql</link>,
<link linkend="ref.pdo-mysql">PDO_MYSQL</link>), if they are compiled to
use the <link linkend="book.mysqlnd">mysqlnd</link> library. The
extensions use the <literal>mysqlnd</literal> library internally, at the C
level, to communicate with the MySQL server. PECL/mysqlnd_uh
allows it to hook many <literal>mysqlnd</literal> calls. Therefore,
most activities of the PHP MySQL extensions can be monitored.
</para>
<para>
Because monitoring happens at the level of the library, at a layer below the
application, it is possible to monitor applications without changing them.
</para>
<para>
<table>
<title>PECL/mysqlnd_uh as a client-side proxy</title>
<tgroup cols="1">
<thead>
<row>
<entry align="center">Any <literal>PHP 5.3.3 or later</literal> application using MySQL</entry>
</row>
</thead>
<tbody>
<row>
<entry align="center">using any of</entry>
</row>
<row>
<entrytbl cols='3'>
<tbody>
<row>
<entry><link linkend="ref.mysql">mysql</link></entry>
<entry><link linkend="ref.mysqli">mysqli</link></entry>
<entry><link linkend="ref.pdo-mysql">PDO_MySQL</link></entry>
</row>
</tbody>
</entrytbl>
</row>
<row>
<entry align="center">compiled to use</entry>
</row>
<row>
<entry align="center"><link linkend="book.mysqlnd">mysqlnd</link> library</entry>
</row>
<row>
<entry align="center">PECL/mysqlnd_uh</entry>
</row>
<row>
<entry align="center">communicates with</entry>
</row>
<row>
<entry align="center">MySQL Server</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
On the C level, the <literal>mysqlnd</literal> library is structured in modules
or classes. The extension hooks almost all methods of the <literal>mysqlnd</literal>
internal <literal>connection</literal> class and exposes them through the
user space class <literal>MysqlndUhConnection</literal>. Some few methods of
the mysqlnd internal <literal>statement</literal> class are made available
to the PHP user with the class <literal>MysqlndUhPreparedStatement</literal>.
By subclassing the classes <literal>MysqlndUhConnection</literal> and
<literal>MysqlndUhPreparedStatement</literal> users get access to
<literal>mysqlnd</literal> internal function calls.
</para>
<note>
<para>
None of the <literal>mysqlnd</literal> internal function calls has been designed
to ever by exposed to the PHP user. Manipulating their activities may
cause PHP to crash or leak memory. Often, this is not considered a bug. Please,
keep in mind that you are accessing C library functions through
PHP which are expected to take certain actions, which you may not be able to
emulate in user space. Therefore, it is strongly recommended to always call
the parent method implementation when subclassing <literal>MysqlndUhConnection</literal>
or <literal>MysqlndUhPreparedStatement</literal>. To prevent the worst
case, the extension performs some sanity checks. Please, see also
<link linkend="mysqlnd-uh.configuration">Mysqlnd_uh &ConfigureOptions;</link>.
</para>
</note>
<section xml:id="mysqlnd-uh.quickstart.configuration">
<title>Setup</title>
<para>
The plugin is implemented as a PHP extension.
Please, follow the
<link linkend="mysqlnd-uh.installation">installation instructions</link> to
install the
<link xlink:href="&url.pecl.package;mysqlnd_ms">PECL/mysqlnd_uh</link> extension.
Then, load the extension into PHP and activate the plugin in the PHP configuration
file using the PHP configuration directive named
<link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link>.
The below example shows the default settings of the extension.
</para>
<para>
<example>
<title>Enabling the plugin (php.ini)</title>
<programlisting role="ini">
<![CDATA[
mysqlnd_uh.enable=1
mysqlnd_uh.report_wrong_types=1
]]>
</programlisting>
</example>
</para>
</section>
<section xml:id="mysqlnd-uh.quickstart.how_it_works">
<title>How it works</title>
<para>
<note>
<para>
You can skip the following and move on to the examples for now, if you
are not interested in the inner workings. Please, get back to the
background information and read it carefully, if you plan to use
PECL/mysqlnd_uh intensively in the future.
</para>
</note>
</para>
<para>
Two classes are provided by the extension: <literal>MysqlndUhConnection</literal>
and <literal>MysqlndUhPreparedStatement</literal>. The first one lets
you access almost all methods of the <literal>mysqlnd</literal>
internal <literal>connection</literal> class. The latter exposes some, selected
methods of the <literal>mysqlnd</literal> internal <literal>statement</literal> class.
For example, <function>MysqlndUhConnection::connect</function> maps to
the <literal>mysqlnd</literal> library C function
<literal>mysqlnd_conn__connect</literal>.
</para>
<para>
As a mysqlnd plugin, the PECL/mysqlnd_uh extensions replaces <literal>mysqlnd</literal>
library C functions with its own functions. Whenever a
PHP MySQL extension compiled to use <literal>mysqlnd</literal>, calls
a mysqlnd function, the functions installed by the plugin are executed
instead of the original <literal>mysqlnd</literal> ones. If, for example,
<function>mysqli_connect</function> invokes <literal>mysqlnd_conn__connect</literal>,
the connect function installed by PECL/mysqlnd_uh will be called.
The functions installed by PECL/mysqlnd_uh are the methods of the built-in classes.
</para>
<para>
The built-in PHP classes and their methods do nothing but call their
<literal>mysqlnd</literal> C library counterparts, to behave exaclty
like the original <literal>mysqlnd</literal> function they replace.
The code below illustrates in pseudo-code what the extension does.
</para>
<para>
<example>
<title>Pseudo-code: what a built-in class does</title>
<programlisting>
<![CDATA[
class MysqlndUhConnection {
public function connect(($conn, $host, $user, $passwd, $db, $port, $socket, $mysql_flags) {
MYSQLND* c_mysqlnd_connection = convert_from_php_to_c($conn);
...
return call_c_function(mysqlnd_conn__connect(c_mysqlnd_connection, ...));
}
}
]]>
</programlisting>
</example>
</para>
<para>
The build-in classes behave like a transparent proxy. It is possible for
you to replace the proxy with your own. This is done by subclassing
<literal>MysqlndUhConnection</literal> or
<literal>MysqlndUhPreparedStatement</literal> to extend the functionality
of the proxy, followed by registering a new proxy object.
Proxy objects are installed by
<link linkend="function.mysqlnd-uh-set-connection-proxy"><function>mysqlnd_uh_set_connection_proxy</function></link>
and
<link linkend="function.mysqlnd-uh-set-statement-proxy"><function>mysqlnd_uh_set_statement_proxy</function></link>.
</para>
<para>
<example>
<title>Installing a proxy</title>
<programlisting role="php">
<![CDATA[
<?php
class 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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::connect(array (
0 => NULL,
1 => 'localhost',
2 => 'root',
3 => '',
4 => 'test',
5 => 3306,
6 => NULL,
7 => 131072,
))
proxy::connect returns true
]]>
</screen>
</example>
</para>
</section>
<section xml:id="mysqlnd-uh.quickstart.proxy_installation">
<title>Installing a proxy</title>
<para>
The extension provides two built-in classes: <literal>MysqlndUhConnection</literal>
and <literal>MysqlndUhPreparedStatement</literal>. The classes are used
for hooking <literal>mysqlnd</literal> library calls. Their methods correspond
to <literal>mysqlnd</literal> internal functions. By default they act like
a transparent proxy and do nothing but call their <literal>mysqlnd</literal> counterparts.
By subclassing the classes you can install your own proxy to monitor <literal>mysqlnd</literal>.
</para>
<para>
Please, see <link linkend="mysqlnd-uh.quickstart.how_it_works">How it works</link>
for details. However, to get started you do not need to look at the details.
Copy the patterns shown in the quickstart instead.
</para>
<para>
Connections proxies are objects of the type <literal>MysqlndUhConnection</literal>.
Connection proxy objects are installed by
<link linkend="function.mysqlnd-uh-set-connection-proxy"><function>mysqlnd_uh_set_connection_proxy</function></link>.
If you install the built-in class <literal>MysqlndUhConnection</literal>
as a proxy, nothing happens. It behaves like a transparent proxy.
</para>
<para>
<example>
<title>Proxy registration, mysqlnd_uh.enable=1</title>
<programlisting role="php">
<![CDATA[
<?php
mysqlnd_uh_set_connection_proxy(new MysqlndUhConnection());
$mysqli = new mysqli("localhost", "root", "", "test");
?>
]]>
</programlisting>
</example>
</para>
<para>
The <literal>PHP_INI_SYSTEM</literal> configuration setting
<literal><link linkend="ini.mysqlnd-uh.enable">mysqlnd_uh.enable</link></literal>
setting controls whether a proxy may be set. If disabled, the extension
will throw errors of type <literal>E_WARNING</literal>
</para>
<para>
<example>
<title>Proxy installation disabled</title>
<programlisting role="ini">
<![CDATA[
mysqlnd_uh.enable=0
]]>
</programlisting>
<programlisting role="php">
<![CDATA[
<?php
mysqlnd_uh_set_connection_proxy(new MysqlndUhConnection());
$mysqli = new mysqli("localhost", "root", "", "test");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PHP Warning: MysqlndUhConnection::__construct(): (Mysqlnd User Handler) The plugin has been disabled by setting the configuration parameter mysqlnd_uh.enabled = false. You must not use any of the base classes in %s on line %d
PHP Warning: mysqlnd_uh_set_connection_proxy(): (Mysqlnd User Handler) The plugin has been disabled by setting the configuration parameter mysqlnd_uh.enable = false. The proxy has not been installed in %s on line %d
]]>
</screen>
</example>
</para>
<para>
To monitor <literal>mysqlnd</literal> you have to write your own
proxy object subclassing <literal>MysqlndUhConnection</literal>.
Please, see the function reference for a the list of methods that
can be subclassed. Alternatively, you can use reflection to inspect
the built-in <literal>MysqlndUhConnection</literal>.
</para>
<para>
Create a new class <literal>proxy</literal>. Derive it from the
built-in class <literal>MysqlndUhConnection</literal>.
Replace the
<link linkend="mysqlnduhconnection.connect"><function>MysqlndUhConnection::connect</function></link>.
method. Print out the host parameter value passed to the method.
Make sure that you call the parent implementation of the <literal>connect</literal>
method. Failing to do so may give unexpected and undesired results, including
memory leaks and crashes.
</para>
<para>
Register your proxy and open three connections using the PHP MySQL
extensions <link linkend="ref.mysqli">mysqli</link>,
<link linkend="ref.mysql">mysql</link>,
<link linkend="ref.pdo-mysql">PDO_MYSQL</link>. If the extensions have been
compiled to use the <literal>mysqlnd</literal> library, the
<literal>proxy::connect</literal> method will be called three times, once
for each connection opened.
</para>
<para>
<example>
<title>Connection proxy</title>
<programlisting role="php">
<![CDATA[
<?php
class proxy extends MysqlndUhConnection {
public function connect($res, $host, $user, $passwd, $db, $port, $socket, $mysql_flags) {
printf("Connection opened to '%s'\n", $host);
/* Always call the parent implementation! */
return parent::connect($res, $host, $user, $passwd, $db, $port, $socket, $mysql_flags);
}
}
mysqlnd_uh_set_connection_proxy(new proxy());
$mysqli = new mysqli("localhost", "root", "", "test");
$mysql = mysql_connect("localhost", "root", "");
$pdo = new PDO("mysql:host=localhost;dbname=test", "root", "");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Connection opened to 'localhost'
Connection opened to 'localhost'
Connection opened to 'localhost'
]]>
</screen>
</example>
</para>
<para>
The use of prepared statement proxies follows the same pattern: create a
proxy object of the type <literal>MysqlndUhPreparedStatement</literal>
and install the proxy using
<link linkend="function.mysqlnd-uh-set-statement-proxy"><function>mysqlnd_uh_set_statement_proxy</function></link>.
</para>
<para>
<example>
<title>Prepared statement proxy</title>
<programlisting role="php">
<![CDATA[
<?php
class stmt_proxy extends MysqlndUhPreparedStatement {
public function prepare($res, $query) {
printf("%s(%s)\n", __METHOD__, $query);
return parent::prepare($res, $query);
}
}
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
$mysqli = new mysqli("localhost", "root", "", "test");
$stmt = $mysqli->prepare("SELECT 'mysqlnd hacking made easy' AS _msg FROM DUAL");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
stmt_proxy::prepare(SELECT 'mysqlnd hacking made easy' AS _msg FROM DUAL)
]]>
</screen>
</example>
</para>
</section>
<section xml:id="mysqlnd-uh.quickstart.query_monitoring">
<title>Basic query monitoring</title>
<para>
Basic monitoring of a query statement is easy with PECL/mysqlnd_uh.
Combined with <function>debug_print_backtrace</function> it can become a powerful
tool, for example, to find the origin of certain statement. This may
be desired when searching for slow queries but also after database
refactorings to find code still accessing deprecated databases or
tables. The latter may be a complicated matter to do otherwise, if
the application uses auto-generated queries.
</para>
<para>
<example>
<title>Basic Monitoring</title>
<programlisting role="php">
<![CDATA[
<?php
class conn_proxy extends MysqlndUhConnection {
public function query($res, $query) {
debug_print_backtrace();
return parent::query($res, $query);
}
}
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");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
#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]
]]>
</screen>
</example>
</para>
<para>
For basic query monitoring you should install a connection and a prepared statement
proxy. The connection proxy should subclass <function>MysqlndUhConnection::query</function>.
All database queries not using native prepared statements will call this method.
In the example the <literal>query</literal> function is invoked by a PDO call.
By default, <literal>PDO_MySQL</literal> is using prepared statement emulation.
</para>
<para>
All native prepared statements are prepared with the <literal>prepare</literal>
method of <literal>mysqlnd</literal> exported through
<function>MysqlndUhPreparedStatement::prepare</function>. Subclass
<literal>MysqlndUhPreparedStatement</literal> and overwrite <literal>prepare</literal>
for native prepared statement monitoring.
</para>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="ref.mysqlnd-uh" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Mysqlnd_uh &Functions;</title>
&reference.mysqlnd-uh.entities.functions;
&reference.mysqlnd-uh.entities.mysqlnduhconnection;
&reference.mysqlnd-uh.entities.mysqlnduhpreparedstatement;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="mysqlnd-uh.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
<section xml:id="mysqlnd-uh.requirements">
&reftitle.required;
<para>
<literal>PHP 5.3.3</literal> or later.
It is recommended to use <literal>PHP 5.4.0</literal> or later
to get access to the latest mysqlnd features.
</para>
<para>
The <literal>mysqlnd_uh</literal> user handler
plugin supports all PHP applications and all available PHP MySQL extensions
(<link linkend="ref.mysqli">mysqli</link>,
<link linkend="ref.mysql">mysql</link>,
<link linkend="ref.pdo-mysql">PDO_MYSQL</link>).
The PHP MySQL extension must be configured to use
<link linkend="book.mysqlnd">mysqlnd</link> in order to be able
to use the <literal>mysqlnd_uh</literal> plugin for
<link linkend="book.mysqlnd">mysqlnd</link>.
</para>
<para>
The alpha versions makes use of some <link linkend="ref.mysqli">mysqli</link> features.
You must enable <link linkend="ref.mysqli">mysqli</link> to compile the plugin.
This requirement may be removed in the future. Note, that this requirement
does not restrict you to use the plugin only with <literal>mysqli</literal>.
You can use the plugin to monitor <literal>mysql</literal>, <literal>mysqli</literal>
and <literal>PDO_MYSQL</literal>.
</para>
</section>
&reference.mysqlnd-uh.configure;
&reference.mysqlnd-uh.ini;
<section xml:id="mysqlnd-uh.resources">
&reftitle.resources;
&no.resource;
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!--
Do NOT translate this file
-->
<versions>
<!-- Functions -->
<function name='mysqlnd_uh_set_connection_proxy' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnd_uh_set_statement_proxy' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnd_uh_convert_to_mysqlnd' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<!-- Methods -->
<function name='mysqlnduhconnection::__construct' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::query' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::init' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::connect' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::escapestring' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::setcharset' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::sendquery' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::reapquery' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::useresult' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::storeresult' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::nextresult' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::moreresults' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::stmtinit' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::shutdownserver' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::refreshserver' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::ping' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::killconnection' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::selectdb' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::serverdumpdebuginformation' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::changeuser' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::geterrornumber' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::geterrorstring' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getsqlstate' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getthreadid' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getstatistics' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getserverversion' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getserverinformation' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getserverstatistics' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::gethostinformation' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getprotocolinformation' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getlastmessage' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::charsetname' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::listfields' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::listmethod' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getlastinsertid' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getaffectedrows' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getwarningcount' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::getfieldcount' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::setserveroption' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::setclientoption' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::close' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::queryreadresultsetheader' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::simplecommand' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::simplecommandhandleresponse' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::restartpsession' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::endpsession' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::sendclose' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::sslset' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhconnection::setAutocommit' from='PECL mysqlnd-uh &gt;= 1.0.1-alpha, PHP &gt;= 5.4.0'/>
<function name='mysqlnduhconnection::txCommit' from='PECL mysqlnd-uh &gt;= 1.0.1-alpha, PHP &gt;= 5.4.0'/>
<function name='mysqlnduhconnection::txRollback' from='PECL mysqlnd-uh &gt;= 1.0.1-alpha, PHP &gt;= 5.4.0'/>
<function name='mysqlnduhpreparedstatement::__construct' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhpreparedstatement::execute' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
<function name='mysqlnduhpreparedstatement::prepare' from='PECL mysqlnd-uh &gt;= 1.0.0-alpha'/>
</versions>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->