Skip to content

Commit

Permalink
PHP 8.4: Start documenting Pdo\Mysql class
Browse files Browse the repository at this point in the history
Co-authored-by: Kamil Tekiela <[email protected]>
  • Loading branch information
Girgias and kamil-tekiela committed Dec 2, 2024
1 parent a633707 commit 9930db7
Show file tree
Hide file tree
Showing 6 changed files with 665 additions and 116 deletions.
13 changes: 8 additions & 5 deletions reference/pdo_mysql/configure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ $ ./configure --with-pdo-mysql --with-mysql-sock=/var/mysql/mysql.sock
</screen>
</para>
<para>
SSL support is enabled using the appropriate <link linkend="pdo-mysql.constants">PDO_MySQL constants</link>,
which is equivalent to calling the <link xlink:href="&url.mysql.docs.ssl.set;">MySQL C API function mysql_ssl_set()</link>.
Also, SSL cannot be enabled with <classname>PDO::setAttribute</classname> because the connection
already exists. See also the MySQL documentation about <link xlink:href="&url.mysql.docs.ssl.using;">connecting to
MySQL with SSL</link>.
<acronym>SSL</acronym> support is enabled using the appropriate
<constant>Pdo\Mysql::ATTR_SSL_<replaceable>*</replaceable></constant>,
which is equivalent to calling the
<link xlink:href="&url.mysql.docs.ssl.set;">MySQL C API function mysql_ssl_set()</link>.
Also, SSL cannot be enabled with <methodname>PDO::setAttribute</methodname>
because the connection already exists.
See also the MySQL documentation about
<link xlink:href="&url.mysql.docs.ssl.using;">connecting to MySQL with SSL</link>.
</para>

</section>
Expand Down
178 changes: 68 additions & 110 deletions reference/pdo_mysql/constants.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="pdo-mysql.constants" xmlns="http://docbook.org/ns/docbook">
<section xml:id="ref.pdo-mysql.constants" xmlns="http://docbook.org/ns/docbook">
&reftitle.constants;
&pdo.driver-constants;
<variablelist>
Expand All @@ -11,29 +11,8 @@
</term>
<listitem>
<simpara>
By default all statements are executed in
<link linkend="mysqlinfo.concepts.buffering">buffered mode</link>.
If this attribute is set to &false; on a
<classname>PDO</classname> object, the MySQL driver will use the
unbuffered mode.
&Alias; <constant>Pdo\Mysql::ATTR_USE_BUFFERED_QUERY</constant>
</simpara>
<para>
<example><title>Setting MySQL unbuffered mode</title>
<programlisting role="php">
<![CDATA[
<?php
$pdo = new PDO("mysql:host=localhost;dbname=world", 'my_user', 'my_password');
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
$unbufferedResult = $pdo->query("SELECT Name FROM City");
foreach ($unbufferedResult as $row) {
echo $row['Name'] . PHP_EOL;
}
?>
]]>
</programlisting>
</example>
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-local-infile">
Expand All @@ -42,45 +21,32 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Enable <literal>LOAD LOCAL INFILE</literal>.
</para>
<para>
Note, this constant can only be used in the <parameter>driver_options</parameter>
array when constructing a new database handle.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_LOCAL_INFILE</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-local-infile-directory">
<term>
<constant>PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY</constant>
(<type>string</type>)
(<type>int</type>)
</term>
<listitem>
<para>
Allows restricting LOCAL DATA loading to files located in this designated
directory. Available as of PHP 8.1.0.
</para>
<para>
Note, this constant can only be used in the <parameter>driver_options</parameter>
array when constructing a new database handle.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_LOCAL_INFILE_DIRECTORY</constant>.
Available as of PHP 8.1.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-init-command">
<term>
<constant>PDO::MYSQL_ATTR_INIT_COMMAND</constant>
(<type>string</type>)
(<type>int</type>)
</term>
<listitem>
<para>
Command to execute when connecting to the MySQL server. Will
automatically be re-executed when reconnecting.
</para>
<para>
Note, this constant can only be used in the <parameter>driver_options</parameter>
array when constructing a new database handle.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_INIT_COMMAND</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-read-default-file">
Expand All @@ -89,12 +55,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Read options from the named option file instead of from
<filename>my.cnf</filename>. This option is not available if
mysqlnd is used, because mysqlnd does not read the mysql
configuration files.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_READ_DEFAULT_FILE</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-read-default-group">
Expand All @@ -103,12 +66,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Read options from the named group from <filename>my.cnf</filename> or the
file specified with <constant>MYSQL_READ_DEFAULT_FILE</constant>. This option
is not available if mysqlnd is used, because mysqlnd does not read the mysql
configuration files.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_READ_DEFAULT_GROUP</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-max-buffer-size">
Expand All @@ -117,10 +77,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Maximum buffer size. Defaults to 1 MiB. This constant is not supported when
compiled against mysqlnd.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_MAX_BUFFER_SIZE</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-direct-query">
Expand All @@ -129,9 +88,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Perform direct queries, don't use prepared statements.
</para>
<simpara>
&Alias; <constant>PDO::ATTR_EMULATE_PREPARES</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-found-rows">
Expand All @@ -140,10 +99,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Return the number of found (matched) rows, not the
number of changed rows.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_FOUND_ROWS</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-ignore-space">
Expand All @@ -152,10 +110,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Permit spaces after function names. Makes all functions
names reserved words.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_IGNORE_SPACE</constant>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="pdo.constants.mysql-attr-compress">
Expand All @@ -164,9 +121,21 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Enable network communication compression.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_COMPRESS</constant>
</simpara>
</listitem>
</varlistentry>

<varlistentry xml:id="pdo.constants.mysql-attr-server-public-key">
<term>
<constant>PDO::MYSQL_ATTR_SERVER_PUBLIC_KEY</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SERVER_PUBLIC_KEY</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -176,9 +145,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
The file path to the SSL certificate authority.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SSL_CA</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -188,10 +157,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
The file path to the directory that contains the trusted SSL
CA certificates, which are stored in <acronym>PEM</acronym> format.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SSL_CAPATH</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -201,9 +169,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
The file path to the SSL certificate.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SSL_CERT</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -213,10 +181,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
A list of one or more permissible ciphers to use for SSL encryption, in a format
understood by OpenSSL. For example: <literal>DHE-RSA-AES256-SHA:AES128-SHA</literal>
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SSL_CIPHER</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -226,9 +193,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
The file path to the SSL key.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SSL_KEY</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -238,13 +205,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Provides a way to disable verification of the server SSL certificate.
This option is available only with mysqlnd.
</para>
<para>
&version.exists.asof; 7.0.18 and PHP 7.1.4.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_SSL_VERIFY_SERVER_CERT</constant>
</simpara>
</listitem>
</varlistentry>

Expand All @@ -254,14 +217,9 @@ foreach ($unbufferedResult as $row) {
(<type>int</type>)
</term>
<listitem>
<para>
Disables multi query execution in both <function>PDO::prepare</function>
and <function>PDO::query</function> when set to &false;.
</para>
<para>
Note, this constant can only be used in the <parameter>driver_options</parameter>
array when constructing a new database handle.
</para>
<simpara>
&Alias; <constant>Pdo\Mysql::ATTR_MULTI_STATEMENTS</constant>
</simpara>
</listitem>
</varlistentry>

Expand Down
Loading

0 comments on commit 9930db7

Please sign in to comment.