Fixed bug #52529 (PDO+Mysqlnd MYSQL_ATTR_COMPRESS undefined)

Documented missing constants for PDO_MYSQL
 * PDO::MYSQL_ATTR_COMPRESS
 * PDO::MYSQL_ATTR_FOUND_ROWS
 * PDO::MYSQL_ATTR_IGNORE_SPACE

And some small clarifications about which ones are available using mysqlnd.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@304538 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kalle Sommer Nielsen 2010-10-20 07:24:37 +00:00
parent e8289cd5f6
commit d5acc59852
2 changed files with 193 additions and 156 deletions

View file

@ -1,155 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="mysqlnd.overview" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Overview</title>
<para>
MySQL Native Driver is a replacement for the MySQL Client Library
(libmysql). MySQL Native Driver is part of the official PHP sources as
of PHP 5.3.0.
</para>
<para>
The MySQL database extensions MySQL extension,
<literal>mysqli</literal> and PDO MYSQL all communicate with the MySQL
server. In the past, this was done by the extension using the services
provided by the MySQL Client Library. The extensions were compiled
against the MySQL Client Library in order to use its client-server
protocol.
</para>
<para>
With MySQL Native Driver there is now an alternative, as the MySQL
database extensions can be compiled to use MySQL Native Driver instead
of the MySQL Client Library.
</para>
<para>
MySQL Native Driver is written in C as a PHP extension.
</para>
<para>
<emphasis role="bold">What it is not</emphasis>
</para>
<para>
Although MySQL Native Driver is written as a PHP extension, it is
important to note that it does not provide a new API to the PHP
programmer. The programmer APIs for MySQL database connectivity are
provided by the MySQL extension, <literal>mysqli</literal> and PDO
MYSQL. These extensions can now use the services of MySQL Native
Driver to communicate with the MySQL Server. Therefore, you should not
think of MySQL Native Driver as an API.
</para>
<para>
<emphasis role="bold">Why use it?</emphasis>
</para>
<para>
Using the MySQL Native Driver offers a number of advantages over using
the MySQL Client Library.
</para>
<para>
The older MySQL Client Library was written by MySQL AB (now Oracle
Corporation) and so was released under the MySQL license. This
ultimately led to MySQL support being disabled by default in PHP.
However, the MySQL Native Driver has been developed as part of the PHP
project, and is therefore released under the PHP license. This removes
licensing issues that have been problematic in the past.
</para>
<para>
Also, in the past, you needed to build the MySQL database extensions
against a copy of the MySQL Client Library. This typically meant you
needed to have MySQL installed on a machine where you were building
the PHP source code. Also, when your PHP application was running, the
MySQL database extensions would call down to the MySQL Client library
file at run time, so the file needed to be installed on your system.
With MySQL Native Driver that is no longer the case as it is included
as part of the standard distribution. So you do not need MySQL
installed in order to build PHP or run PHP database applications.
</para>
<para>
Because MySQL Native Driver is written as a PHP extension, it is
tightly coupled to the workings of PHP. This leads to gains in
efficiency, especially when it comes to memory usage, as the driver
uses the PHP memory management system. It also supports the PHP memory
limit. Using MySQL Native Driver leads to comparable or better
performance than using MySQL Client Library, it always ensures the
most efficient use of memory. One example of the memory efficiency is
the fact that when using the MySQL Client Library, each row is stored
in memory twice, whereas with the MySQL Native Driver each row is only
stored once in memory.
</para>
<para>
<emphasis role="bold">Special features</emphasis>
</para>
<para>
MySQL Native Driver also provides some special features not available
when the MySQL database extensions use MySQL Client Library. These
special features are listed below:
</para>
<itemizedlist>
<listitem>
<para>
Improved persistent connections
</para>
</listitem>
<listitem>
<para>
The special function <function>mysqli_fetch_all</function>
</para>
</listitem>
<listitem>
<para>
Performance statistics calls:
<function>mysqli_get_cache_stats</function>,
<function>mysqli_get_client_stats</function>,
<function>mysqli_get_connection_stats</function>
</para>
</listitem>
</itemizedlist>
<para>
The performance statistics facility can prove to be very useful in
identifying performance bottlenecks.
</para>
<para>
MySQL Native Driver also allows for persistent connections when used
with the <literal>mysqli</literal> extension.
</para>
<para>
<emphasis role="bold">SSL Support</emphasis>
</para>
<para>
MySQL Native Driver has supported SSL since PHP version 5.3.3
</para>
<para>
<emphasis role="bold">Compressed Protocol Support</emphasis>
</para>
<para>
As of PHP 5.3.2 MySQL Native Driver supports the compressed client
server protocol. MySQL Native Driver did not support this in 5.3.0 and
5.3.1. Extensions such as <literal>ext/mysql</literal>,
<literal>ext/mysqli</literal>, <literal>PDO_MYSQL</literal>, that are
configured to use MySQL Native Driver, can also take advantage of this
feature.
</para>
<para>
<emphasis role="bold">Named Pipes Support</emphasis>
</para>
<para>
Named pipes support for Windows was added in PHP version 5.3.4.
</para>
</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
-->
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="mysqlnd.overview" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Overview</title>
<para>
MySQL Native Driver is a replacement for the MySQL Client Library
(libmysql). MySQL Native Driver is part of the official PHP sources as
of PHP 5.3.0.
</para>
<para>
The MySQL database extensions MySQL extension,
<literal>mysqli</literal> and PDO MYSQL all communicate with the MySQL
server. In the past, this was done by the extension using the services
provided by the MySQL Client Library. The extensions were compiled
against the MySQL Client Library in order to use its client-server
protocol.
</para>
<para>
With MySQL Native Driver there is now an alternative, as the MySQL
database extensions can be compiled to use MySQL Native Driver instead
of the MySQL Client Library.
</para>
<para>
MySQL Native Driver is written in C as a PHP extension.
</para>
<para>
<emphasis role="bold">What it is not</emphasis>
</para>
<para>
Although MySQL Native Driver is written as a PHP extension, it is
important to note that it does not provide a new API to the PHP
programmer. The programmer APIs for MySQL database connectivity are
provided by the MySQL extension, <literal>mysqli</literal> and PDO
MYSQL. These extensions can now use the services of MySQL Native
Driver to communicate with the MySQL Server. Therefore, you should not
think of MySQL Native Driver as an API.
</para>
<para>
<emphasis role="bold">Why use it?</emphasis>
</para>
<para>
Using the MySQL Native Driver offers a number of advantages over using
the MySQL Client Library.
</para>
<para>
The older MySQL Client Library was written by MySQL AB (now Oracle
Corporation) and so was released under the MySQL license. This
ultimately led to MySQL support being disabled by default in PHP.
However, the MySQL Native Driver has been developed as part of the PHP
project, and is therefore released under the PHP license. This removes
licensing issues that have been problematic in the past.
</para>
<para>
Also, in the past, you needed to build the MySQL database extensions
against a copy of the MySQL Client Library. This typically meant you
needed to have MySQL installed on a machine where you were building
the PHP source code. Also, when your PHP application was running, the
MySQL database extensions would call down to the MySQL Client library
file at run time, so the file needed to be installed on your system.
With MySQL Native Driver that is no longer the case as it is included
as part of the standard distribution. So you do not need MySQL
installed in order to build PHP or run PHP database applications.
</para>
<para>
Because MySQL Native Driver is written as a PHP extension, it is
tightly coupled to the workings of PHP. This leads to gains in
efficiency, especially when it comes to memory usage, as the driver
uses the PHP memory management system. It also supports the PHP memory
limit. Using MySQL Native Driver leads to comparable or better
performance than using MySQL Client Library, it always ensures the
most efficient use of memory. One example of the memory efficiency is
the fact that when using the MySQL Client Library, each row is stored
in memory twice, whereas with the MySQL Native Driver each row is only
stored once in memory.
</para>
<para>
<emphasis role="bold">Special features</emphasis>
</para>
<para>
MySQL Native Driver also provides some special features not available
when the MySQL database extensions use MySQL Client Library. These
special features are listed below:
</para>
<itemizedlist>
<listitem>
<para>
Improved persistent connections
</para>
</listitem>
<listitem>
<para>
The special function <function>mysqli_fetch_all</function>
</para>
</listitem>
<listitem>
<para>
Performance statistics calls:
<function>mysqli_get_cache_stats</function>,
<function>mysqli_get_client_stats</function>,
<function>mysqli_get_connection_stats</function>
</para>
</listitem>
</itemizedlist>
<para>
The performance statistics facility can prove to be very useful in
identifying performance bottlenecks.
</para>
<para>
MySQL Native Driver also allows for persistent connections when used
with the <literal>mysqli</literal> extension.
</para>
<para>
<emphasis role="bold">SSL Support</emphasis>
</para>
<para>
MySQL Native Driver has supported SSL since PHP version 5.3.3
</para>
<para>
<emphasis role="bold">Compressed Protocol Support</emphasis>
</para>
<para>
As of PHP 5.3.2 MySQL Native Driver supports the compressed client
server protocol. MySQL Native Driver did not support this in 5.3.0 and
5.3.1. Extensions such as <literal>ext/mysql</literal>,
<literal>ext/mysqli</literal>, that are configured to use MySQL Native Driver,
can also take advantage of this feature. Note that <literal>PDO_MYSQL</literal>
does <emphasis>NOT</emphasis> support compression when used together with mysqlnd.
</para>
<para>
<emphasis role="bold">Named Pipes Support</emphasis>
</para>
<para>
Named pipes support for Windows was added in PHP version 5.3.4.
</para>
</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

@ -92,7 +92,8 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
</term>
<listitem>
<para>
Maximum buffer size. Defaults to 1 MiB.
Maximum buffer size. Defaults to 1 MiB. This constant is not supported when
compiled against mysqlnd.
</para>
</listitem>
</varlistentry>
@ -107,6 +108,42 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::MYSQL_ATTR_FOUND_ROWS</constant>
(<type>integer</type>)
</term>
<listitem>
<para>
Return the number of found (matched) rows, not the
number of changed rows.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::MYSQL_ATTR_IGNORE_SPACE</constant>
(<type>integer</type>)
</term>
<listitem>
<para>
Permit spaces after function names. Makes all functions
names reserved words.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::MYSQL_ATTR_COMPRESS</constant>
(<type>integer</type>)
</term>
<listitem>
<para>
Enable network communication compression. This is not supported when
compiled against mysqlnd.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>