Fix whitespace and put missing &refsect.description; entities

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@226677 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2007-01-07 19:51:00 +00:00
parent 3362c2dfd1
commit 615c0b3826
32 changed files with 1565 additions and 1622 deletions

View file

@ -1,49 +1,48 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-beginTransaction">
<refnamediv>
<refname>PDO::beginTransaction</refname>
<refpurpose>
Initiates a transaction
</refpurpose>
</refnamediv>
<!-- $Revision: 1.6 $ -->
<refentry id="function.PDO-beginTransaction">
<refnamediv>
<refname>PDO::beginTransaction</refname>
<refpurpose>
Initiates a transaction
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::beginTransaction</methodname>
<void/>
</methodsynopsis>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::beginTransaction</methodname>
<void/>
</methodsynopsis>
<para>
Turns off autocommit mode. While autocommit mode is turned off, changes
made to the database via the PDO object instance are not committed until
you end the transaction by calling <function>PDO::commit</function>.
Calling <function>PDO::rollback</function> will roll back all changes to
the database and return the connection to autocommit mode.
</para>
<para>
Some databases, including MySQL, automatically issue an implicit
COMMIT when a database definition language (DDL) statement such as
DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
COMMIT will prevent you from rolling back any other changes within the
transaction boundary.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Roll back a transaction</title>
<para>
Turns off autocommit mode. While autocommit mode is turned off, changes
made to the database via the PDO object instance are not committed until
you end the transaction by calling <function>PDO::commit</function>.
Calling <function>PDO::rollback</function> will roll back all changes to
the database and return the connection to autocommit mode.
The following example begins a transaction and issues two statements
that modify the database before rolling back the changes. On MySQL,
however, the DROP TABLE statement automatically commits the
transaction so that none of the changes in the transaction are rolled
back.
</para>
<para>
Some databases, including MySQL, automatically issue an implicit
COMMIT when a database definition language (DDL) statement such as
DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
COMMIT will prevent you from rolling back any other changes within the
transaction boundary.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Roll back a transaction</title>
<para>
The following example begins a transaction and issues two statements
that modify the database before rolling back the changes. On MySQL,
however, the DROP TABLE statement automatically commits the
transaction so that none of the changes in the transaction are rolled
back.
</para>
<programlisting role='php'>
<programlisting role='php'>
<![CDATA[
<?php
/* Begin a transaction, turning off autocommit */
@ -60,22 +59,22 @@ $dbh->rollBack();
/* Database connection is now back in autocommit mode */
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::commit</function></member>
<member><function>PDO::rollBack</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::commit</function></member>
<member><function>PDO::rollBack</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,32 +1,31 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-commit">
<refnamediv>
<refname>PDO::commit</refname>
<refpurpose>
Commits a transaction
</refpurpose>
</refnamediv>
<!-- $Revision: 1.4 $ -->
<refentry id="function.PDO-commit">
<refnamediv>
<refname>PDO::commit</refname>
<refpurpose>
Commits a transaction
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::commit</methodname>
<void/>
</methodsynopsis>
<para>
Commits a transaction, returning the database connection to autocommit
mode until the next call to <function>PDO::beginTransaction</function>
starts a new transaction.
</para>
</refsect1>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::commit</methodname>
<void/>
</methodsynopsis>
<para>
Commits a transaction, returning the database connection to autocommit
mode until the next call to <function>PDO::beginTransaction</function>
starts a new transaction.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Commit a transaction</title>
<programlisting role='php'>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Commit a transaction</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Begin a transaction, turning off autocommit */
@ -41,23 +40,23 @@ $dbh->commit();
/* Database connection is now back in autocommit mode */
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::beginTransaction</function></member>
<member><function>PDO::rollBack</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::beginTransaction</function></member>
<member><function>PDO::rollBack</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,132 +1,132 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.16 $ -->
<refentry id="function.PDO-construct">
<refnamediv>
<refname>PDO::__construct</refname>
<refpurpose>
Creates a PDO instance representing a connection to a database
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>PDO</type><methodname>PDO::__construct</methodname>
<methodparam><type>string</type><parameter>dsn</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>driver_options</parameter></methodparam>
</methodsynopsis>
<para>
Creates a PDO instance to represent a connection to the requested
database.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry><term>dsn</term>
<listitem>
<para>
The Data Source Name, or DSN, contains the information required to
connect to the database.
</para>
<para>
In general, a DSN consists of the PDO driver name, followed by a colon,
followed by the PDO driver-specific connection syntax. Further
information is available from the <link linkend="pdo.drivers">PDO
driver-specific documentation</link>.
</para>
<para>
The <parameter>dsn</parameter> parameter supports three
different methods of specifying the arguments required to create
a database connection:
</para>
<para>
<variablelist>
<varlistentry><term>Driver invocation</term>
<listitem>
<para>
<parameter>dsn</parameter> contains the full DSN.
</para>
</listitem>
</varlistentry>
<varlistentry><term>URI invocation</term>
<listitem>
<para>
<parameter>dsn</parameter> consists of <userinput>uri:</userinput>
followed by a URI that defines the location of a file containing
the DSN string. The URI can specify a local file or a remote URL.
</para>
<para><userinput>uri:file:///path/to/dsnfile</userinput></para>
</listitem>
</varlistentry>
<varlistentry><term>Aliasing</term>
<listitem>
<para>
<parameter>dsn</parameter> consists of a name
<parameter>name</parameter> that maps to
<literal>pdo.dsn.<parameter>name</parameter></literal> in &php.ini;
defining the DSN string.
</para>
<note>
<para>
The alias must be defined in &php.ini;, and not &htaccess; or &httpd.conf;
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry><term>username</term>
<listitem>
<para>
The user name for the DSN string. This parameter is optional for
some PDO drivers.
</para>
</listitem>
</varlistentry>
<varlistentry><term>password</term>
<listitem>
<para>
The password for the DSN string. This parameter is optional for
some PDO drivers.
</para>
</listitem>
</varlistentry>
<varlistentry><term>driver_options</term>
<listitem>
<para>
A key=&gt;value array of driver-specific connection options.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<!-- $Revision: 1.17 $ -->
<refentry id="function.PDO-construct">
<refnamediv>
<refname>PDO::__construct</refname>
<refpurpose>
Creates a PDO instance representing a connection to a database
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>PDO</type><methodname>PDO::__construct</methodname>
<methodparam><type>string</type><parameter>dsn</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>driver_options</parameter></methodparam>
</methodsynopsis>
<para>
Creates a PDO instance to represent a connection to the requested
database.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry><term>dsn</term>
<listitem>
<para>
The Data Source Name, or DSN, contains the information required to
connect to the database.
</para>
<para>
In general, a DSN consists of the PDO driver name, followed by a colon,
followed by the PDO driver-specific connection syntax. Further
information is available from the <link linkend="pdo.drivers">PDO
driver-specific documentation</link>.
</para>
<para>
The <parameter>dsn</parameter> parameter supports three
different methods of specifying the arguments required to create
a database connection:
</para>
<para>
<variablelist>
<varlistentry><term>Driver invocation</term>
<listitem>
<para>
<parameter>dsn</parameter> contains the full DSN.
</para>
</listitem>
</varlistentry>
<varlistentry><term>URI invocation</term>
<listitem>
<para>
<parameter>dsn</parameter> consists of <userinput>uri:</userinput>
followed by a URI that defines the location of a file containing
the DSN string. The URI can specify a local file or a remote URL.
</para>
<para><userinput>uri:file:///path/to/dsnfile</userinput></para>
</listitem>
</varlistentry>
<varlistentry><term>Aliasing</term>
<listitem>
<para>
<parameter>dsn</parameter> consists of a name
<parameter>name</parameter> that maps to
<literal>pdo.dsn.<parameter>name</parameter></literal> in &php.ini;
defining the DSN string.
</para>
<note>
<para>
The alias must be defined in &php.ini;, and not &htaccess; or &httpd.conf;
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry><term>username</term>
<listitem>
<para>
The user name for the DSN string. This parameter is optional for
some PDO drivers.
</para>
</listitem>
</varlistentry>
<varlistentry><term>password</term>
<listitem>
<para>
The password for the DSN string. This parameter is optional for
some PDO drivers.
</para>
</listitem>
</varlistentry>
<varlistentry><term>driver_options</term>
<listitem>
<para>
A key=&gt;value array of driver-specific connection options.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a PDO object on success.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a PDO object on success.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
<function>PDO::construct</function> throws a PDOException if the attempt
to connect to the requested database fails.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
<function>PDO::construct</function> throws a PDOException if the attempt
to connect to the requested database fails.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Create a PDO instance via driver invocation</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Create a PDO instance via driver invocation</title>
<programlisting role="php">
<![CDATA[
<?php
/* Connect to an ODBC database using driver invocation */
@ -142,26 +142,26 @@ try {
?>
]]>
</programlisting>
</example>
<example><title>Create a PDO instance via URI invocation</title>
<para>
The following example assumes that the file
<filename>/usr/local/dbconnect</filename> exists with file permissions
that enable PHP to read the file. The file contains the PDO DSN to
connect to a DB2 database through the PDO_ODBC driver:
</para>
<screen>
</programlisting>
</example>
<example><title>Create a PDO instance via URI invocation</title>
<para>
The following example assumes that the file
<filename>/usr/local/dbconnect</filename> exists with file permissions
that enable PHP to read the file. The file contains the PDO DSN to
connect to a DB2 database through the PDO_ODBC driver:
</para>
<screen>
<![CDATA[
odbc:DSN=SAMPLE;UID=john;PWD=mypass
]]>
</screen>
<para>
The PHP script can then create a database connection by simply
passing the <literal>uri:</literal> parameter and pointing to
the file URI:
</para>
<programlisting role="php">
</screen>
<para>
The PHP script can then create a database connection by simply
passing the <literal>uri:</literal> parameter and pointing to
the file URI:
</para>
<programlisting role="php">
<![CDATA[
<?php
/* Connect to an ODBC database using driver invocation */
@ -177,19 +177,19 @@ try {
?>
]]>
</programlisting>
</example>
<example><title>Create a PDO instance using an alias</title>
<para>
The following example assumes that &php.ini; contains the following
entry to enable a connection to a MySQL database using only the
alias <literal>mydb</literal>:
<programlisting role="ini">
</programlisting>
</example>
<example><title>Create a PDO instance using an alias</title>
<para>
The following example assumes that &php.ini; contains the following
entry to enable a connection to a MySQL database using only the
alias <literal>mydb</literal>:
<programlisting role="ini">
[PDO]
pdo.dsn.mydb="mysql:dbname=testdb;host=localhost"
</programlisting>
</para>
<programlisting role="php">
</programlisting>
</para>
<programlisting role="php">
<![CDATA[
<?php
/* Connect to an ODBC database using an alias */
@ -199,17 +199,17 @@ $password = '';
try {
$dbh = new PDO($dsn, $user, $password);
}catch (PDOException $e) {
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,51 +1,50 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-errorCode">
<refnamediv>
<refname>PDO::errorCode</refname>
<refpurpose>
Fetch the SQLSTATE associated with the last operation on the database handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>PDO::errorCode</methodname>
<void/>
</methodsynopsis>
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDO-errorCode">
<refnamediv>
<refname>PDO::errorCode</refname>
<refpurpose>
Fetch the SQLSTATE associated with the last operation on the database handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>PDO::errorCode</methodname>
<void/>
</methodsynopsis>
</refsect1>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a SQLSTATE, a five-character alphanumeric identifier defined in
the ANSI SQL-92 standard. Briefly, an SQLSTATE consists of a
two-character class value followed by a three-character subclass value. A
class value of 01 indicates a warning and is accompanied by a return code
of SQL_SUCCESS_WITH_INFO. Class values other than '01', except for the
class 'IM', indicate an error. The class 'IM' is specific to warnings
and errors that derive from the implementation of PDO (or perhaps ODBC,
if you're using the ODBC driver) itself. The subclass value '000' in any
class indicates that there is no subclass for that SQLSTATE.
</para>
<para>
<function>PDO::errorCode</function> only retrieves error codes for operations
performed directly on the database handle. If you create a PDOStatement
object through <function>PDO::prepare</function> or
<function>PDO::query</function> and invoke an error on the statement
handle, <function>PDO::errorCode</function> will not reflect that error.
You must call <function>PDOStatement::errorCode</function> to return the error
code for an operation performed on a particular statement handle.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a SQLSTATE, a five-character alphanumeric identifier defined in
the ANSI SQL-92 standard. Briefly, an SQLSTATE consists of a
two-character class value followed by a three-character subclass value. A
class value of 01 indicates a warning and is accompanied by a return code
of SQL_SUCCESS_WITH_INFO. Class values other than '01', except for the
class 'IM', indicate an error. The class 'IM' is specific to warnings
and errors that derive from the implementation of PDO (or perhaps ODBC,
if you're using the ODBC driver) itself. The subclass value '000' in any
class indicates that there is no subclass for that SQLSTATE.
</para>
<para>
<function>PDO::errorCode</function> only retrieves error codes for operations
performed directly on the database handle. If you create a PDOStatement
object through <function>PDO::prepare</function> or
<function>PDO::query</function> and invoke an error on the statement
handle, <function>PDO::errorCode</function> will not reflect that error.
You must call <function>PDOStatement::errorCode</function> to return the error
code for an operation performed on a particular statement handle.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Retrieving a SQLSTATE code</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Retrieving a SQLSTATE code</title>
<programlisting role="php">
<![CDATA[
<?php
/* Provoke an error -- the BONES table does not exist */
@ -55,29 +54,29 @@ echo "\nPDO::errorCode(): ";
print $dbh->errorCode();
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDO::errorCode(): 42S02
]]>
</screen>
</example>
</para>
</refsect1>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorCode</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorCode</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,72 +1,71 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-errorInfo">
<refnamediv>
<refname>PDO::errorInfo</refname>
<refpurpose>
Fetch extended error information associated with the last operation on the database handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDO::errorInfo</methodname>
<void/>
</methodsynopsis>
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDO-errorInfo">
<refnamediv>
<refname>PDO::errorInfo</refname>
<refpurpose>
Fetch extended error information associated with the last operation on the database handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDO::errorInfo</methodname>
<void/>
</methodsynopsis>
</refsect1>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDO::errorInfo</function> returns an array of error information
about the last operation performed by this database handle. The array
consists of the following fields:
<informaltable>
<tgroup cols='2'>
<thead>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDO::errorInfo</function> returns an array of error information
about the last operation performed by this database handle. The array
consists of the following fields:
<informaltable>
<tgroup cols='2'>
<thead>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
<para>
<function>PDO::errorInfo</function> only retrieves error information for
operations performed directly on the database handle. If you create a
PDOStatement object through <function>PDO::prepare</function> or
<function>PDO::query</function> and invoke an error on the statement
handle, <function>PDO::errorInfo</function> will not reflect the error
from the statement handle. You must call
<function>PDOStatement::errorInfo</function> to return the error
information for an operation performed on a particular statement handle.
</para>
</refsect1>
<para>
<function>PDO::errorInfo</function> only retrieves error information for
operations performed directly on the database handle. If you create a
PDOStatement object through <function>PDO::prepare</function> or
<function>PDO::query</function> and invoke an error on the statement
handle, <function>PDO::errorInfo</function> will not reflect the error
from the statement handle. You must call
<function>PDOStatement::errorInfo</function> to return the error
information for an operation performed on a particular statement handle.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database</title>
<programlisting role="php">
<![CDATA[
<?php
/* Provoke an error -- the BONES table does not exist */
@ -76,9 +75,9 @@ echo "\nPDO::errorInfo():\n";
print_r($err->errorInfo());
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDO::errorInfo():
Array
@ -88,24 +87,24 @@ Array
[2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an undefined name. SQLSTATE=42704
)
]]>
</screen>
</example>
</para>
</refsect1>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDOStatement::errorCode</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDOStatement::errorCode</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.9 $ -->
<refentry id="function.PDO-exec">
<refnamediv>
<refname>PDO::exec</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.9 $ -->
<refentry id="function.PDO-getAttribute">
<refnamediv>
<refname>PDO::getAttribute</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.PDO-getAvailableDrivers">
<refnamediv>
<refname>PDO::getAvailableDrivers</refname>

View file

@ -1,104 +1,72 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.10 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-lastInsertId">
<refnamediv>
<refname>PDO::lastInsertId</refname>
<refpurpose>
Returns the ID of the last inserted row or sequence value
</refpurpose>
</refnamediv>
<refsect1 role="description">
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>PDO::lastInsertId</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<!-- $Revision: 1.11 $ -->
<refentry id="function.PDO-lastInsertId">
<refnamediv>
<refname>PDO::lastInsertId</refname>
<refpurpose>
Returns the ID of the last inserted row or sequence value
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>PDO::lastInsertId</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
Returns the ID of the last inserted row, or the last value from a
sequence object, depending on the underlying driver. For example,
<function>PDO_PGSQL</function> requires you to specify the name of
a sequence object for the <parameter>name</parameter> parameter.
</para>
<note>
<para>
This method may not return a meaningful or consistent result across
different PDO drivers, because the underlying database may not even
support the notion of auto-increment fields or sequences.
</para>
</note>
</refsect1>
<para>
Returns the ID of the last inserted row, or the last value from a
sequence object, depending on the underlying driver. For example,
<function>PDO_PGSQL</function> requires you to specify the name of
a sequence object for the <parameter>name</parameter> parameter.
</para>
<note>
<para>
This method may not return a meaningful or consistent result across
different PDO drivers, because the underlying database may not even
support the notion of auto-increment fields or sequences.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
Name of the sequence object from which the ID should be returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If a sequence name was not specified for the <parameter>name</parameter>
parameter, <function>PDOStatement::lastInsertId</function> returns a
string representing the row ID of the last row that was inserted into
the database.
</para>
<para>
If a sequence name was specified for the <parameter>name</parameter>
parameter, <function>PDOStatement::lastInsertId</function> returns a
string representing the last value retrieved from the specified sequence
object.
</para>
<para>
If the PDO driver does not support this capability,
<function>PDO::lastInsertID</function> triggers an
<literal>IM001</literal> SQLSTATE.
</para>
</refsect1>
<!-- Use when examples exist
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Retrieving the last insert ID</title>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The following example demonstrates how to use the
<function>PDO::lastInsertID</function> method to retrieve the row
identifier for the last row that has been inserted into the database.
Name of the sequence object from which the ID should be returned.
</para>
<programlisting role="php">
<![CDATA[
<?php
if ($anexample === true) {
echo 'Use the PEAR Coding Standards';
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Use the PEAR Coding Standards
]]>
</screen>
</example>
</para>
</refsect1>
-->
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
</refentry>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If a sequence name was not specified for the <parameter>name</parameter>
parameter, <function>PDOStatement::lastInsertId</function> returns a
string representing the row ID of the last row that was inserted into
the database.
</para>
<para>
If a sequence name was specified for the <parameter>name</parameter>
parameter, <function>PDOStatement::lastInsertId</function> returns a
string representing the last value retrieved from the specified sequence
object.
</para>
<para>
If the PDO driver does not support this capability,
<function>PDO::lastInsertID</function> triggers an
<literal>IM001</literal> SQLSTATE.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,97 +1,96 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.11 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-prepare">
<refnamediv>
<refname>PDO::prepare</refname>
<refpurpose>
Prepares a statement for execution and returns a statement object
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>PDOStatement</type><methodname>PDO::prepare</methodname>
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>driver_options</parameter></methodparam>
</methodsynopsis>
<!-- $Revision: 1.12 $ -->
<refentry id="function.PDO-prepare">
<refnamediv>
<refname>PDO::prepare</refname>
<refpurpose>
Prepares a statement for execution and returns a statement object
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>PDOStatement</type><methodname>PDO::prepare</methodname>
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>driver_options</parameter></methodparam>
</methodsynopsis>
<para>
Prepares an SQL statement to be executed by the
<function>PDOStatement::execute</function> method. The SQL statement can
contain zero or more named (:name) or question mark (?) parameter markers
for which real values will be substituted when the statement is executed.
You cannot use both named and question mark parameter markers within the same
SQL statement; pick one or the other parameter style.
</para>
<para>
You must include a unique parameter marker for each value you wish to pass
in to the statement when you call <function>PDOStatement::execute</function>.
You cannot use a named parameter marker of the same name twice in a prepared
statement. You cannot bind multiple values to a single named parameter in,
for example, the IN() clause of an SQL statement.
</para>
<para>
Calling <function>PDO::prepare</function> and
<function>PDOStatement::execute</function> for statements that will be
issued multiple times with different parameter values optimizes the
performance of your application by allowing the driver to negotiate
client and/or server side caching of the query plan and meta information,
and helps to prevent SQL injection attacks by eliminating the need to
manually quote the parameters.
</para>
<para>
PDO will emulate prepared statements/bound parameters for drivers that do
not natively support them, and can also rewrite named or question mark
style parameter markers to something more appropriate, if the driver
supports one style but not the other.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>statement</parameter></term>
<listitem>
<para>
This must be a valid SQL statement for the target database server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>driver_options</parameter></term>
<listitem>
<para>
This array holds one or more key=&gt;value pairs to set
attribute values for the PDOStatement object that this method
returns. You would most commonly use this to set the
<literal>PDO::ATTR_CURSOR</literal> value to
<literal>PDO::CURSOR_SCROLL</literal> to request a scrollable cursor.
Some drivers have driver specific options that may be set at
prepare-time.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<para>
Prepares an SQL statement to be executed by the
<function>PDOStatement::execute</function> method. The SQL statement can
contain zero or more named (:name) or question mark (?) parameter markers
for which real values will be substituted when the statement is executed.
You cannot use both named and question mark parameter markers within the same
SQL statement; pick one or the other parameter style.
</para>
<para>
You must include a unique parameter marker for each value you wish to pass
in to the statement when you call <function>PDOStatement::execute</function>.
You cannot use a named parameter marker of the same name twice in a prepared
statement. You cannot bind multiple values to a single named parameter in,
for example, the IN() clause of an SQL statement.
</para>
<para>
Calling <function>PDO::prepare</function> and
<function>PDOStatement::execute</function> for statements that will be
issued multiple times with different parameter values optimizes the
performance of your application by allowing the driver to negotiate
client and/or server side caching of the query plan and meta information,
and helps to prevent SQL injection attacks by eliminating the need to
manually quote the parameters.
</para>
<para>
PDO will emulate prepared statements/bound parameters for drivers that do
not natively support them, and can also rewrite named or question mark
style parameter markers to something more appropriate, if the driver
supports one style but not the other.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>statement</parameter></term>
<listitem>
<para>
This must be a valid SQL statement for the target database server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>driver_options</parameter></term>
<listitem>
<para>
This array holds one or more key=&gt;value pairs to set
attribute values for the PDOStatement object that this method
returns. You would most commonly use this to set the
<literal>PDO::ATTR_CURSOR</literal> value to
<literal>PDO::CURSOR_SCROLL</literal> to request a scrollable cursor.
Some drivers have driver specific options that may be set at
prepare-time.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If the database server successfully prepares the statement,
<function>PDO::prepare</function> returns a PDOStatement object.
If the database server cannot successfully prepare the statement,
<function>PDO::prepare</function> returns &false;.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If the database server successfully prepares the statement,
<function>PDO::prepare</function> returns a PDOStatement object.
If the database server cannot successfully prepare the statement,
<function>PDO::prepare</function> returns &false;.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Prepare an SQL statement with named parameters</title>
<programlisting role='php'>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Prepare an SQL statement with named parameters</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by passing an array of values */
@ -105,11 +104,11 @@ $sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();
?>
]]>
</programlisting>
</example>
<example>
<title>Prepare an SQL statement with question mark parameters</title>
<programlisting role='php'>
</programlisting>
</example>
<example>
<title>Prepare an SQL statement with question mark parameters</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by passing an array of values */
@ -122,22 +121,22 @@ $sth->execute(array(175, 'yellow'));
$yellow = $sth->fetchAll();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::exec</function></member>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::execute</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::exec</function></member>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::execute</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDO-query">
<refnamediv>
<refname>PDO::query</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDO-quote">
<refnamediv>
<refname>PDO::quote</refname>

View file

@ -1,51 +1,50 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-rollBack">
<refnamediv>
<refname>PDO::rollBack</refname>
<refpurpose>
Rolls back a transaction
</refpurpose>
</refnamediv>
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDO-rollBack">
<refnamediv>
<refname>PDO::rollBack</refname>
<refpurpose>
Rolls back a transaction
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::rollBack</methodname>
<void/>
</methodsynopsis>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::rollBack</methodname>
<void/>
</methodsynopsis>
<para>
Rolls back the current transaction, as initiated by
<function>PDO::beginTransaction</function>. It is an error to call this
method if no transaction is active.
</para>
<para>
If the database was set to autocommit mode, this function will restore
autocommit mode after it has rolled back the transaction.
</para>
<para>
Some databases, including MySQL, automatically issue an implicit
COMMIT when a database definition language (DDL) statement such as
DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
COMMIT will prevent you from rolling back any other changes within the
transaction boundary.
</para>
</refsect1>
<para>
Rolls back the current transaction, as initiated by
<function>PDO::beginTransaction</function>. It is an error to call this
method if no transaction is active.
</para>
<para>
If the database was set to autocommit mode, this function will restore
autocommit mode after it has rolled back the transaction.
</para>
<para>
Some databases, including MySQL, automatically issue an implicit
COMMIT when a database definition language (DDL) statement such as
DROP TABLE or CREATE TABLE is issued within a transaction. The implicit
COMMIT will prevent you from rolling back any other changes within the
transaction boundary.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Roll back a transaction</title>
<para>
<example><title>Roll back a transaction</title>
<para>
The following example begins a transaction and issues two statements
that modify the database before rolling back the changes. On MySQL,
however, the DROP TABLE statement automatically commits the
transaction so that none of the changes in the transaction are rolled
back.
</para>
<programlisting role='php'>
The following example begins a transaction and issues two statements
that modify the database before rolling back the changes. On MySQL,
however, the DROP TABLE statement automatically commits the
transaction so that none of the changes in the transaction are rolled
back.
</para>
<programlisting role='php'>
<![CDATA[
<?php
/* Begin a transaction, turning off autocommit */
@ -62,23 +61,23 @@ $dbh->rollBack();
/* Database connection is now back in autocommit mode */
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::beginTransaction</function></member>
<member><function>PDO::commit</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::beginTransaction</function></member>
<member><function>PDO::commit</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,84 +1,83 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-setAttribute">
<refnamediv>
<refname>PDO::setAttribute</refname>
<refpurpose>
Set an attribute
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>PDO::setAttribute</methodname>
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDO-setAttribute">
<refnamediv>
<refname>PDO::setAttribute</refname>
<refpurpose>
Set an attribute
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDO::setAttribute</methodname>
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Sets an attribute on the database handle. Some of the available generic
attributes are listed below; some drivers may make use of
additional driver specific attributes.
<para>
Sets an attribute on the database handle. Some of the available generic
attributes are listed below; some drivers may make use of
additional driver specific attributes.
<itemizedlist>
<listitem><para>
<literal>PDO::ATTR_CASE</literal>: Force column names to a specific case.
<itemizedlist>
<listitem><para>
<literal>PDO::ATTR_CASE</literal>: Force column names to a specific case.
<itemizedlist>
<listitem><para>
<literal>PDO::CASE_LOWER</literal>: Force column names to lower case.
</para></listitem>
<listitem><para>
<literal>PDO::CASE_NATURAL</literal>: Leave column names as returned by
the database driver.
</para></listitem>
<listitem><para>
<literal>PDO::CASE_UPPER</literal>: Force column names to upper case.
</para></listitem>
</itemizedlist>
<literal>PDO::CASE_LOWER</literal>: Force column names to lower case.
</para></listitem>
<listitem><para><literal>PDO::ATTR_ERRMODE</literal>: Error reporting.
<itemizedlist>
<listitem><para><literal>PDO::ERRMODE_SILENT</literal>:
Just set error codes.</para></listitem>
<listitem><para><literal>PDO::ERRMODE_WARNING</literal>:
Raise <link linkend="e-warning">E_WARNING</link>.</para></listitem>
<listitem><para><literal>PDO::ERRMODE_EXCEPTION</literal>:
Throw <link linkend="language.exceptions">exceptions</link>.</para></listitem>
</itemizedlist>
<listitem><para>
<literal>PDO::CASE_NATURAL</literal>: Leave column names as returned by
the database driver.
</para></listitem>
<listitem><para><literal>PDO::ATTR_ORACLE_NULLS</literal>
(available with all drivers, not just Oracle):
Conversion of NULL and empty strings.
<itemizedlist>
<listitem><para><literal>PDO::NULL_NATURAL</literal>:
No conversion.</para></listitem>
<listitem><para><literal>PDO::NULL_EMPTY_STRING</literal>:
Empty string is converted to &null;.</para></listitem>
<listitem><para><literal>PDO::NULL_TO_STRING</literal>:
NULL is converted to an empty string.</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para><literal>PDO::ATTR_STRINGIFY_FETCHES</literal>:
Convert numeric values to strings when fetching.
Requires <type>bool</type>.
</para></listitem>
<listitem><para><literal>PDO::ATTR_STATEMENT_CLASS</literal>:
Set user-supplied statement class derived from PDOStatement.
Cannot be used with persistent PDO instances.
Requires <literal>array(string classname, array(mixed constructor_args))</literal>.
</para></listitem>
<listitem><para><literal>PDO::ATTR_AUTOCOMMIT</literal>
(available in OCI, Firebird and MySQL):
Whether to autocommit every single statement.
</para></listitem>
<listitem><para><literal>PDO::MYSQL_ATTR_USE_BUFFERED_QUERY</literal>
(available in MySQL):
Use buffered queries.
<listitem><para>
<literal>PDO::CASE_UPPER</literal>: Force column names to upper case.
</para></listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
</para></listitem>
<listitem><para><literal>PDO::ATTR_ERRMODE</literal>: Error reporting.
<itemizedlist>
<listitem><para><literal>PDO::ERRMODE_SILENT</literal>:
Just set error codes.</para></listitem>
<listitem><para><literal>PDO::ERRMODE_WARNING</literal>:
Raise <link linkend="e-warning">E_WARNING</link>.</para></listitem>
<listitem><para><literal>PDO::ERRMODE_EXCEPTION</literal>:
Throw <link linkend="language.exceptions">exceptions</link>.</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para><literal>PDO::ATTR_ORACLE_NULLS</literal>
(available with all drivers, not just Oracle):
Conversion of NULL and empty strings.
<itemizedlist>
<listitem><para><literal>PDO::NULL_NATURAL</literal>:
No conversion.</para></listitem>
<listitem><para><literal>PDO::NULL_EMPTY_STRING</literal>:
Empty string is converted to &null;.</para></listitem>
<listitem><para><literal>PDO::NULL_TO_STRING</literal>:
NULL is converted to an empty string.</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para><literal>PDO::ATTR_STRINGIFY_FETCHES</literal>:
Convert numeric values to strings when fetching.
Requires <type>bool</type>.
</para></listitem>
<listitem><para><literal>PDO::ATTR_STATEMENT_CLASS</literal>:
Set user-supplied statement class derived from PDOStatement.
Cannot be used with persistent PDO instances.
Requires <literal>array(string classname, array(mixed constructor_args))</literal>.
</para></listitem>
<listitem><para><literal>PDO::ATTR_AUTOCOMMIT</literal>
(available in OCI, Firebird and MySQL):
Whether to autocommit every single statement.
</para></listitem>
<listitem><para><literal>PDO::MYSQL_ATTR_USE_BUFFERED_QUERY</literal>
(available in MySQL):
Use buffered queries.
</para></listitem>
</itemizedlist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,86 +1,85 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.8 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-bindColumn">
<refnamediv>
<refname>PDOStatement::bindColumn</refname>
<refpurpose>
Bind a column to a PHP variable
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindColumn</methodname>
<methodparam><type>mixed</type><parameter>column</parameter></methodparam>
<methodparam><type>mixed</type><parameter role="reference">param</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>type</parameter></methodparam>
</methodsynopsis>
<!-- $Revision: 1.9 $ -->
<refentry id="function.PDOStatement-bindColumn">
<refnamediv>
<refname>PDOStatement::bindColumn</refname>
<refpurpose>
Bind a column to a PHP variable
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindColumn</methodname>
<methodparam><type>mixed</type><parameter>column</parameter></methodparam>
<methodparam><type>mixed</type><parameter role="reference">param</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>type</parameter></methodparam>
</methodsynopsis>
<para>
<function>PDOStatement::bindColumn</function> arranges to have a
particular variable bound to a given column in the result-set from a
query. Each call to <function>PDOStatement::fetch</function> or
<function>PDOStatement::fetchAll</function> will update all the variables
that are bound to columns.
</para>
<note>
<para>
Since information about the columns is not always available to PDO until
the statement is executed, portable applications should call this
function <emphasis>after</emphasis> <function>PDO::execute</function>.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>column</parameter></term>
<listitem>
<para>
Number of the column (1-indexed) or name of the column in the result set.
If using the column name, be aware that the name should match the
case of the column, as returned by the driver.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>param</parameter></term>
<listitem>
<para>
Name of the PHP variable to which the column will be bound.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>
Data type of the parameter, specified by the PDO::PARAM_* constants.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Binding result set output to PHP variables</title>
<para>
<function>PDOStatement::bindColumn</function> arranges to have a
particular variable bound to a given column in the result-set from a
query. Each call to <function>PDOStatement::fetch</function> or
<function>PDOStatement::fetchAll</function> will update all the variables
that are bound to columns.
Binding columns in the result set to PHP variables is an effective
way to make the data contained in each row immediately available to
your application. The following example demonstrates how PDO allows
you to bind and retrieve columns with a variety of options and with
intelligent defaults.
</para>
<note>
<para>
Since information about the columns is not always available to PDO until
the statement is executed, portable applications should call this
function <emphasis>after</emphasis> <function>PDO::execute</function>.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>column</parameter></term>
<listitem>
<para>
Number of the column (1-indexed) or name of the column in the result set.
If using the column name, be aware that the name should match the
case of the column, as returned by the driver.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>param</parameter></term>
<listitem>
<para>
Name of the PHP variable to which the column will be bound.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>
Data type of the parameter, specified by the PDO::PARAM_* constants.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Binding result set output to PHP variables</title>
<para>
Binding columns in the result set to PHP variables is an effective
way to make the data contained in each row immediately available to
your application. The following example demonstrates how PDO allows
you to bind and retrieve columns with a variety of options and with
intelligent defaults.
</para>
<programlisting role="php">
<![CDATA[
<programlisting role="php">
<![CDATA[
<?php
function readData($dbh) {
$sql = 'SELECT name, colour, calories FROM fruit';
@ -107,35 +106,35 @@ function readData($dbh) {
readData($dbh);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
</programlisting>
&example.outputs;
<screen>
<![CDATA[
apple red 150
banana yellow 175
kiwi green 75
orange orange 150
mango red 200
strawberry red 25
]]>
</screen>
</example>
</para>
</refsect1>
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDOStatement::execute</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDOStatement::execute</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,101 +1,100 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.11 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-bindParam">
<refnamediv>
<refname>PDOStatement::bindParam</refname>
<refpurpose>
Binds a parameter to the specified variable name
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindParam</methodname>
<methodparam><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam><type>mixed</type><parameter role="reference">variable</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>data_type</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>driver_options</parameter></methodparam>
</methodsynopsis>
<para>
Binds a PHP variable to a corresponding named or question mark placeholder
in the SQL statement that was use to prepare the statement. Unlike
<function>PDOStatement::bindValue</function>, the variable is bound as a
reference and will only be evaluated at the time that
<function>PDOStatement::execute</function> is called.
</para>
<para>
Most parameters are input parameters, that is, parameters that are used
in a read-only fashion to build up the query. Some drivers support the
invocation of stored procedures that return data as output parameters,
and some also as input/output parameters that both send in data and are
updated to receive it.
</para>
<!-- $Revision: 1.12 $ -->
<refentry id="function.PDOStatement-bindParam">
<refnamediv>
<refname>PDOStatement::bindParam</refname>
<refpurpose>
Binds a parameter to the specified variable name
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindParam</methodname>
<methodparam><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam><type>mixed</type><parameter role="reference">variable</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>data_type</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>driver_options</parameter></methodparam>
</methodsynopsis>
<para>
Binds a PHP variable to a corresponding named or question mark placeholder
in the SQL statement that was use to prepare the statement. Unlike
<function>PDOStatement::bindValue</function>, the variable is bound as a
reference and will only be evaluated at the time that
<function>PDOStatement::execute</function> is called.
</para>
<para>
Most parameters are input parameters, that is, parameters that are used
in a read-only fashion to build up the query. Some drivers support the
invocation of stored procedures that return data as output parameters,
and some also as input/output parameters that both send in data and are
updated to receive it.
</para>
</refsect1>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>parameter</parameter></term>
<listitem>
<para>
Parameter identifier. For a prepared statement using named
placeholders, this will be a parameter name of the form
<varname>:name</varname>. For a prepared statement using
question mark placeholders, this will be the 1-indexed position of
the parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>variable</parameter></term>
<listitem>
<para>
Name of the PHP variable to bind to the SQL statement parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data_type</parameter></term>
<listitem>
<para>
Explicit data type for the parameter using the PDO::PARAM_*
constants. To return an INOUT parameter from a stored procedure,
use the bitwise OR operator to set the PDO::PARAM_INPUT_OUTPUT bits
for the <parameter>data_type</parameter> parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>length</parameter></term>
<listitem>
<para>
Length of the data type. To indicate that a parameter is an OUT
parameter from a stored procedure, you must explicitly set the
length.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>driver_options</parameter></term>
<listitem>
<para>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>parameter</parameter></term>
<listitem>
<para>
Parameter identifier. For a prepared statement using named
placeholders, this will be a parameter name of the form
<varname>:name</varname>. For a prepared statement using
question mark placeholders, this will be the 1-indexed position of
the parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>variable</parameter></term>
<listitem>
<para>
Name of the PHP variable to bind to the SQL statement parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data_type</parameter></term>
<listitem>
<para>
Explicit data type for the parameter using the PDO::PARAM_*
constants. To return an INOUT parameter from a stored procedure,
use the bitwise OR operator to set the PDO::PARAM_INPUT_OUTPUT bits
for the <parameter>data_type</parameter> parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>length</parameter></term>
<listitem>
<para>
Length of the data type. To indicate that a parameter is an OUT
parameter from a stored procedure, you must explicitly set the
length.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>driver_options</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example><title>Execute a prepared statement with named placeholders</title>
<programlisting role='php'>
<refsect1 role="examples">
&reftitle.examples;
<example><title>Execute a prepared statement with named placeholders</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -109,11 +108,11 @@ $sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example><title>Execute a prepared statement with question mark placeholders</title>
<programlisting role='php'>
<example><title>Execute a prepared statement with question mark placeholders</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -127,12 +126,12 @@ $sth->bindParam(2, $colour, PDO::PARAM_STR, 12);
$sth->execute();
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<!--
<example><title>Pass a NULL value into a prepared statement</title>
<programlisting role='php'>
<example><title>Pass a NULL value into a prepared statement</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -149,11 +148,11 @@ $sth->bindParam(':colour', $colour, PDO::PARAM_NULL);
$sth->execute();
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
-->
<example><title>Call a stored procedure with an INOUT parameter</title>
<programlisting role='php'>
<example><title>Call a stored procedure with an INOUT parameter</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Call a stored procedure with an INOUT parameter */
@ -164,23 +163,23 @@ $sth->execute();
print("After pureeing fruit, the colour is: $colour");
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
</refsect1>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::prepare</function></member>
<member><function>PDOStatement::execute</function></member>
<member><function>PDOStatement::bindValue</function></member>
</simplelist>
</para>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::prepare</function></member>
<member><function>PDOStatement::execute</function></member>
<member><function>PDOStatement::bindValue</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,68 +1,67 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-bindValue">
<refnamediv>
<refname>PDOStatement::bindValue</refname>
<refpurpose>
Binds a value to a parameter
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindValue</methodname>
<methodparam><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>data_type</parameter></methodparam>
</methodsynopsis>
<para>
Binds a value to a corresponding named or question mark placeholder
in the SQL statement that was use to prepare the statement.
</para>
</refsect1>
<!-- $Revision: 1.4 $ -->
<refentry id="function.PDOStatement-bindValue">
<refnamediv>
<refname>PDOStatement::bindValue</refname>
<refpurpose>
Binds a value to a parameter
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindValue</methodname>
<methodparam><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>data_type</parameter></methodparam>
</methodsynopsis>
<para>
Binds a value to a corresponding named or question mark placeholder
in the SQL statement that was use to prepare the statement.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>parameter</parameter></term>
<listitem>
<para>
Parameter identifier. For a prepared statement using named
placeholders, this will be a parameter name of the form
<varname>:name</varname>. For a prepared statement using
question mark placeholders, this will be the 1-indexed position of
the parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value to bind to the parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data_type</parameter></term>
<listitem>
<para>
Explicit data type for the parameter using the PDO::PARAM_*
constants.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>parameter</parameter></term>
<listitem>
<para>
Parameter identifier. For a prepared statement using named
placeholders, this will be a parameter name of the form
<varname>:name</varname>. For a prepared statement using
question mark placeholders, this will be the 1-indexed position of
the parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value to bind to the parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data_type</parameter></term>
<listitem>
<para>
Explicit data type for the parameter using the PDO::PARAM_*
constants.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example><title>Execute a prepared statement with named placeholders</title>
<programlisting role='php'>
<refsect1 role="examples">
&reftitle.examples;
<example><title>Execute a prepared statement with named placeholders</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -76,11 +75,11 @@ $sth->bindValue(':colour', $colour, PDO::PARAM_STR);
$sth->execute();
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example><title>Execute a prepared statement with question mark placeholders</title>
<programlisting role='php'>
<example><title>Execute a prepared statement with question mark placeholders</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -94,24 +93,24 @@ $sth->bindValue(2, $colour, PDO::PARAM_STR);
$sth->execute();
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
</refsect1>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::prepare</function></member>
<member><function>PDOStatement::execute</function></member>
<member><function>PDOStatement::bindParam</function></member>
</simplelist>
</para>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::prepare</function></member>
<member><function>PDOStatement::execute</function></member>
<member><function>PDOStatement::bindParam</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.8 $ -->
<refentry id="function.PDOStatement-closeCursor">
<refnamediv>
<refname>PDOStatement::closeCursor</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.3 $ -->
<refentry id="function.PDOStatement-columnCount">
<refnamediv>
<refname>PDOStatement::columnCount</refname>

View file

@ -1,35 +1,34 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.6 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-errorCode">
<refnamediv>
<refname>PDOStatement::errorCode</refname>
<refpurpose>
Fetch the SQLSTATE associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>PDOStatement::errorCode</methodname>
<void/>
</methodsynopsis>
</refsect1>
<!-- $Revision: 1.7 $ -->
<refentry id="function.PDOStatement-errorCode">
<refnamediv>
<refname>PDOStatement::errorCode</refname>
<refpurpose>
Fetch the SQLSTATE associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>PDOStatement::errorCode</methodname>
<void/>
</methodsynopsis>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Identical to <function>PDO::errorCode</function>, except that
<function>PDOStatement::errorCode</function> only retrieves error codes
for operations performed with PDOStatement objects.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Identical to <function>PDO::errorCode</function>, except that
<function>PDOStatement::errorCode</function> only retrieves error codes
for operations performed with PDOStatement objects.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Retrieving a SQLSTATE code</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Retrieving a SQLSTATE code</title>
<programlisting role="php">
<![CDATA[
<?php
/* Provoke an error -- the BONES table does not exist */
@ -40,29 +39,29 @@ echo "\nPDOStatement::errorCode(): ";
print $err->errorCode();
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDOStatement::errorCode(): 42S02
]]>
</screen>
</example>
</para>
</refsect1>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,61 +1,60 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-errorInfo">
<refnamediv>
<refname>PDOStatement::errorInfo</refname>
<refpurpose>
Fetch extended error information associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDOStatement::errorInfo</methodname>
<void/>
</methodsynopsis>
<!-- $Revision: 1.6 $ -->
<refentry id="function.PDOStatement-errorInfo">
<refnamediv>
<refname>PDOStatement::errorInfo</refname>
<refpurpose>
Fetch extended error information associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDOStatement::errorInfo</methodname>
<void/>
</methodsynopsis>
</refsect1>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::errorInfo</function> returns an array of
error information about the last operation performed by this
statement handle. The array consists of the following fields:
<informaltable>
<tgroup cols='2'>
<thead>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::errorInfo</function> returns an array of
error information about the last operation performed by this
statement handle. The array consists of the following fields:
<informaltable>
<tgroup cols='2'>
<thead>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database</title>
<programlisting role="php">
<![CDATA[
<?php
/* Provoke an error -- the BONES table does not exist */
@ -67,9 +66,9 @@ $arr = $sth->errorInfo();
print_r($arr);
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDOStatement::errorInfo():
Array
@ -79,24 +78,24 @@ Array
[2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an undefined name. SQLSTATE=42704
)
]]>
</screen>
</example>
</para>
</screen>
</example>
</para>
</refsect1>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorCode</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorCode</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,64 +1,63 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.10 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-execute">
<refnamediv>
<refname>PDOStatement::execute</refname>
<refpurpose>
Executes a prepared statement
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::execute</methodname>
<methodparam choice="opt"><type>array</type><parameter>input_parameters</parameter></methodparam>
</methodsynopsis>
<para>
Execute the prepared statement. If the prepared statement included
parameter markers, you must either:
<itemizedlist>
<listitem><para>call <function>PDOStatement::bindParam</function> to bind PHP variables
to the parameter markers: bound variables pass their value as input and receive the
output value, if any, of their associated parameter markers</para></listitem>
<listitem><para>or pass an array of input-only parameter values</para></listitem>
</itemizedlist>
</para>
</refsect1>
<!-- $Revision: 1.11 $ -->
<refentry id="function.PDOStatement-execute">
<refnamediv>
<refname>PDOStatement::execute</refname>
<refpurpose>
Executes a prepared statement
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::execute</methodname>
<methodparam choice="opt"><type>array</type><parameter>input_parameters</parameter></methodparam>
</methodsynopsis>
<para>
Execute the prepared statement. If the prepared statement included
parameter markers, you must either:
<itemizedlist>
<listitem><para>call <function>PDOStatement::bindParam</function> to bind PHP variables
to the parameter markers: bound variables pass their value as input and receive the
output value, if any, of their associated parameter markers</para></listitem>
<listitem><para>or pass an array of input-only parameter values</para></listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>input_parameters</parameter></term>
<listitem>
<para>
An array of values with as many elements as there are bound
parameters in the SQL statement being executed.
</para>
<para>
You cannot bind multiple values to a single parameter; for example,
you cannot bind two values to a single named parameter in an IN()
clause.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>input_parameters</parameter></term>
<listitem>
<para>
An array of values with as many elements as there are bound
parameters in the SQL statement being executed.
</para>
<para>
You cannot bind multiple values to a single parameter; for example,
you cannot bind two values to a single named parameter in an IN()
clause.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example><title>Execute a prepared statement with bound variables</title>
<programlisting role='php'>
<refsect1 role="examples">
&reftitle.examples;
<example><title>Execute a prepared statement with bound variables</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -72,11 +71,11 @@ $sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example><title>Execute a prepared statement with an array of insert values (named parameters)</title>
<programlisting role='php'>
<example><title>Execute a prepared statement with an array of insert values (named parameters)</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by passing an array of insert values */
@ -88,11 +87,11 @@ $sth = $dbh->prepare('SELECT name, colour, calories
$sth->execute(array(':calories' => $calories, ':colour' => $colour));
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example><title>Execute a prepared statement with an array of insert values (placeholders)</title>
<programlisting role='php'>
<example><title>Execute a prepared statement with an array of insert values (placeholders)</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by passing an array of insert values */
@ -104,12 +103,12 @@ $sth = $dbh->prepare('SELECT name, colour, calories
$sth->execute(array($calories, $colour));
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example><title>Execute a prepared statement with question mark placeholders</title>
<programlisting role='php'>
<example><title>Execute a prepared statement with question mark placeholders</title>
<programlisting role='php'>
<![CDATA[
<?php
/* Execute a prepared statement by binding PHP variables */
@ -123,24 +122,24 @@ $sth->bindParam(2, $colour, PDO::PARAM_STR, 12);
$sth->execute();
?>
]]>
</programlisting>
</example>
</refsect1>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::prepare</function></member>
<member><function>PDOStatement::bindParam</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
</simplelist>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::prepare</function></member>
<member><function>PDOStatement::bindParam</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,129 +1,133 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.11 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-fetch">
<refnamediv>
<refname>PDOStatement::fetch</refname>
<refpurpose>
Fetches the next row from a result set
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>PDOStatement::fetch</methodname>
<methodparam choice="opt"><type>int</type><parameter>fetch_style</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cursor_orientation</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cursor_offset</parameter></methodparam>
</methodsynopsis>
<!-- $Revision: 1.12 $ -->
<refentry id="function.PDOStatement-fetch">
<refnamediv>
<refname>PDOStatement::fetch</refname>
<refpurpose>
Fetches the next row from a result set
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>PDOStatement::fetch</methodname>
<methodparam choice="opt"><type>int</type><parameter>fetch_style</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cursor_orientation</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cursor_offset</parameter></methodparam>
</methodsynopsis>
<para>
Fetches a row from a result set associated with a PDOStatement object. The
<parameter>fetch_style</parameter> parameter determines how PDO returns
the row.
</para>
</refsect1>
<para>
Fetches a row from a result set associated with a PDOStatement object. The
<parameter>fetch_style</parameter> parameter determines how PDO returns
the row.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fetch_style</parameter></term>
<listitem>
<para>
Controls how the next row will be returned to the caller. This value
must be one of the <literal>PDO::FETCH_*</literal> constants,
defaulting to <literal>PDO::FETCH_BOTH</literal>.
<itemizedlist>
<listitem><para>
<literal>PDO::FETCH_ASSOC</literal>: returns an array indexed by column
name as returned in your result set
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_BOTH</literal> (default): returns an array indexed by
both column name and 0-indexed column number as returned in your
result set
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_BOUND</literal>: returns &true; and assigns the
values of the columns in your result set to the PHP variables to which
they were bound with the <function>PDOStatement::bindParam</function>
method
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_CLASS</literal>: returns a new instance of the
requested class, mapping the columns of the result set to named
properties in the class. If <parameter>fetch_style</parameter>
includes PDO::FETCH_CLASSTYPE (e.g. <literal>PDO::FETCH_CLASS |
PDO::FETCH_CLASSTYPE</literal>) then the name of the class is
determined from a value of the first column.
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_INTO</literal>: updates an existing instance
of the requested class, mapping the columns of the result set to
named properties in the class
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_LAZY</literal>: combines
<literal>PDO::FETCH_BOTH</literal> and <literal>PDO::FETCH_OBJ</literal>,
creating the object variable names as they are accessed
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_NUM</literal>: returns an array indexed by column
number as returned in your result set, starting at column 0
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_OBJ</literal>: returns an anonymous object with
property names that correspond to the column names returned in your
result set
</para></listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>cursor_orientation</parameter></term>
<listitem>
<para>
For a PDOStatement object representing a scrollable cursor, this
value determines which row will be returned to the caller. This value
must be one of the <literal>PDO::FETCH_ORI_*</literal> constants,
defaulting to <literal>PDO::FETCH_ORI_NEXT</literal>. To request a
scrollable cursor for your PDOStatement object, you must set the
<literal>PDO::ATTR_CURSOR</literal> attribute to
<literal>PDO::CURSOR_SCROLL</literal> when you prepare the SQL
statement with <function>PDO::prepare</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
For a PDOStatement object representing a scrollable cursor for which
the <literal>cursor_orientation</literal> parameter is set to
<literal>PDO::FETCH_ORI_ABS</literal>, this value specifies the
absolute number of the row in the result set that shall be fetched.
</para>
<para>
For a PDOStatement object representing a scrollable cursor for which
the <literal>cursor_orientation</literal> parameter is set to
<literal>PDO::FETCH_ORI_REL</literal>, this value specifies the
row to fetch relative to the cursor position before
<function>PDOStatement::fetch</function> was called.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fetch_style</parameter></term>
<listitem>
<para>
Controls how the next row will be returned to the caller. This value
must be one of the <literal>PDO::FETCH_*</literal> constants,
defaulting to <literal>PDO::FETCH_BOTH</literal>.
<itemizedlist>
<listitem><para>
<literal>PDO::FETCH_ASSOC</literal>: returns an array indexed by column
name as returned in your result set
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_BOTH</literal> (default): returns an array indexed by
both column name and 0-indexed column number as returned in your
result set
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_BOUND</literal>: returns &true; and assigns the
values of the columns in your result set to the PHP variables to which
they were bound with the <function>PDOStatement::bindParam</function>
method
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_CLASS</literal>: returns a new instance of the
requested class, mapping the columns of the result set to named
properties in the class. If <parameter>fetch_style</parameter>
includes PDO::FETCH_CLASSTYPE (e.g. <literal>PDO::FETCH_CLASS |
PDO::FETCH_CLASSTYPE</literal>) then the name of the class is
determined from a value of the first column.
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_INTO</literal>: updates an existing instance
of the requested class, mapping the columns of the result set to
named properties in the class
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_LAZY</literal>: combines
<literal>PDO::FETCH_BOTH</literal> and <literal>PDO::FETCH_OBJ</literal>,
creating the object variable names as they are accessed
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_NUM</literal>: returns an array indexed by column
number as returned in your result set, starting at column 0
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_OBJ</literal>: returns an anonymous object with
property names that correspond to the column names returned in your
result set
</para></listitem>
<listitem><para>
<literal>PDO::FETCH_SERIALIZE</literal>: returns an anonymous object with
property names that correspond to the column names returned in your
result set
</para></listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>cursor_orientation</parameter></term>
<listitem>
<para>
For a PDOStatement object representing a scrollable cursor, this
value determines which row will be returned to the caller. This value
must be one of the <literal>PDO::FETCH_ORI_*</literal> constants,
defaulting to <literal>PDO::FETCH_ORI_NEXT</literal>. To request a
scrollable cursor for your PDOStatement object, you must set the
<literal>PDO::ATTR_CURSOR</literal> attribute to
<literal>PDO::CURSOR_SCROLL</literal> when you prepare the SQL
statement with <function>PDO::prepare</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
For a PDOStatement object representing a scrollable cursor for which
the <literal>cursor_orientation</literal> parameter is set to
<literal>PDO::FETCH_ORI_ABS</literal>, this value specifies the
absolute number of the row in the result set that shall be fetched.
</para>
<para>
For a PDOStatement object representing a scrollable cursor for which
the <literal>cursor_orientation</literal> parameter is set to
<literal>PDO::FETCH_ORI_REL</literal>, this value specifies the
row to fetch relative to the cursor position before
<function>PDOStatement::fetch</function> was called.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Fetching rows using different fetch styles</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Fetching rows using different fetch styles</title>
<programlisting role="php">
<![CDATA[
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
@ -155,9 +159,9 @@ print $result->NAME;
print("\n");
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDO::FETCH_ASSOC: Return next row as an array indexed by column name
Array
@ -185,10 +189,10 @@ PDORow Object
PDO::FETCH_OBJ: Return next row as an anonymous object with column names as properties
kiwi
]]>
</screen>
</example>
<example><title>Fetching rows with a scrollable cursor</title>
<programlisting role="php">
</screen>
</example>
<example><title>Fetching rows with a scrollable cursor</title>
<programlisting role="php">
<![CDATA[
<?php
function readDataForwards($dbh) {
@ -230,9 +234,9 @@ print "Reading backwards:\n";
readDataBackwards($conn);
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Reading forwards:
21 10 5
@ -244,25 +248,25 @@ Reading backwards:
16 0 5
21 10 5
]]>
</screen>
</example>
</screen>
</example>
</para>
</refsect1>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
<member><function>PDOStatement::prepare</function></member>
<member><function>PDOStatement::setFetchMode</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::fetchAll</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
<member><function>PDOStatement::prepare</function></member>
<member><function>PDOStatement::setFetchMode</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,90 +1,89 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.10 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-fetchAll">
<refnamediv>
<refname>PDOStatement::fetchAll</refname>
<refpurpose>
Returns an array containing all of the result set rows
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDOStatement::fetchAll</methodname>
<methodparam choice="opt"><type>int</type><parameter>fetch_style</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>column_index</parameter></methodparam>
</methodsynopsis>
<!-- $Revision: 1.11 $ -->
<refentry id="function.PDOStatement-fetchAll">
<refnamediv>
<refname>PDOStatement::fetchAll</refname>
<refpurpose>
Returns an array containing all of the result set rows
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDOStatement::fetchAll</methodname>
<methodparam choice="opt"><type>int</type><parameter>fetch_style</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>column_index</parameter></methodparam>
</methodsynopsis>
</refsect1>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fetch_style</parameter></term>
<listitem>
<para>
Controls the contents of the returned array as documented in
<function>PDOStatement::fetch</function>. Defaults to
<literal>PDO::FETCH_BOTH</literal>.
</para>
<para>
To return an array consisting of all values of a single column from
the result set, specify <literal>PDO::FETCH_COLUMN</literal>. You
can specify which column you want with the
<parameter>column-index</parameter> parameter.
</para>
<para>
To fetch only the unique values of a single column from the result set,
bitwise-OR <literal>PDO::FETCH_COLUMN</literal> with
<literal>PDO::FETCH_UNIQUE</literal>.
</para>
<para>
To return an associative array grouped by the values of a specified
column, bitwise-OR <literal>PDO::FETCH_COLUMN</literal> with
<literal>PDO::FETCH_GROUP</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>column_index</parameter></term>
<listitem>
<para>
Returns the indicated 0-indexed column when the value of
<parameter>fetch_style</parameter> is
<literal>PDO::FETCH_COLUMN</literal>. Defaults to <literal>0</literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fetch_style</parameter></term>
<listitem>
<para>
Controls the contents of the returned array as documented in
<function>PDOStatement::fetch</function>. Defaults to
<literal>PDO::FETCH_BOTH</literal>.
</para>
<para>
To return an array consisting of all values of a single column from
the result set, specify <literal>PDO::FETCH_COLUMN</literal>. You
can specify which column you want with the
<parameter>column-index</parameter> parameter.
</para>
<para>
To fetch only the unique values of a single column from the result set,
bitwise-OR <literal>PDO::FETCH_COLUMN</literal> with
<literal>PDO::FETCH_UNIQUE</literal>.
</para>
<para>
To return an associative array grouped by the values of a specified
column, bitwise-OR <literal>PDO::FETCH_COLUMN</literal> with
<literal>PDO::FETCH_GROUP</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>column_index</parameter></term>
<listitem>
<para>
Returns the indicated 0-indexed column when the value of
<parameter>fetch_style</parameter> is
<literal>PDO::FETCH_COLUMN</literal>. Defaults to <literal>0</literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::fetchAll</function> returns an array containing
all of the remaining rows in the result set. The array represents each
row as either an array of column values or an object with properties
corresponding to each column name.
</para>
<para>
Using this method to fetch large result sets will result in a heavy
demand on system and possibly network resources. Rather than retrieving
all of the data and manipulating it in PHP, consider using the database
server to manipulate the result sets. For example, use the WHERE and
SORT BY clauses in SQL to restrict results before retrieving and
processing them with PHP.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::fetchAll</function> returns an array containing
all of the remaining rows in the result set. The array represents each
row as either an array of column values or an object with properties
corresponding to each column name.
</para>
<para>
Using this method to fetch large result sets will result in a heavy
demand on system and possibly network resources. Rather than retrieving
all of the data and manipulating it in PHP, consider using the database
server to manipulate the result sets. For example, use the WHERE and
SORT BY clauses in SQL to restrict results before retrieving and
processing them with PHP.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Fetch all remaining rows in a result set</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Fetch all remaining rows in a result set</title>
<programlisting role="php">
<![CDATA[
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
@ -96,9 +95,9 @@ $result = $sth->fetchAll();
print_r($result);
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Fetch all of the remaining rows in the result set:
Array
@ -121,15 +120,15 @@ Array
)
]]>
</screen>
</example>
<example><title>Fetching all values of a single column from a result set</title>
<para>
The following example demonstrates how to return all of the values of a
single column from a result set, even though the SQL statement itself
may return multiple columns per row.
</para>
<programlisting role="php">
</screen>
</example>
<example><title>Fetching all values of a single column from a result set</title>
<para>
The following example demonstrates how to return all of the values of a
single column from a result set, even though the SQL statement itself
may return multiple columns per row.
</para>
<programlisting role="php">
<![CDATA[
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
@ -140,9 +139,9 @@ $result = $sth->fetchAll(PDO::FETCH_COLUMN, 0);
var_dump($result);
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array(3)
(
@ -154,18 +153,18 @@ Array(3)
string(10) => watermelon
)
]]>
</screen>
</example>
<example><title>Grouping all values by a single column</title>
<para>
The following example demonstrates how to return an associative array
grouped by the values of the specified column in the result set. The
array contains three keys: values <literal>apple</literal> and
<literal>pear</literal> are returned as arrays that contain two
different colours, while <literal>watermelon</literal> is
returned as an array that contains only one colour.
</para>
<programlisting role="php">
</screen>
</example>
<example><title>Grouping all values by a single column</title>
<para>
The following example demonstrates how to return an associative array
grouped by the values of the specified column in the result set. The
array contains three keys: values <literal>apple</literal> and
<literal>pear</literal> are returned as arrays that contain two
different colours, while <literal>watermelon</literal> is
returned as an array that contains only one colour.
</para>
<programlisting role="php">
<![CDATA[
<?php
$insert = $dbh->prepare("INSERT INTO fruit(name, colour) VALUES (?, ?)");
@ -179,9 +178,9 @@ $sth->execute();
var_dump($sth->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP));
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(3) {
["apple"]=>
@ -206,25 +205,25 @@ array(3) {
}
]]>
</screen>
</example>
</screen>
</example>
</para>
</refsect1>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
<member><function>PDOStatement::prepare</function></member>
<member><function>PDOStatement::setFetchMode</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::query</function></member>
<member><function>PDOStatement::fetch</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
<member><function>PDOStatement::prepare</function></member>
<member><function>PDOStatement::setFetchMode</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.PDOStatement-fetchColumn">
<refnamediv>
<refname>PDOStatement::fetchColumn</refname>
@ -16,10 +15,10 @@
<methodparam choice="opt"><type>int</type><parameter>column_number</parameter></methodparam>
</methodsynopsis>
<para>
Returns a single column from the next row of a result set or &false; if
there are no more rows.
</para>
<para>
Returns a single column from the next row of a result set or &false; if
there are no more rows.
</para>
</refsect1>
<refsect1 role="parameters">

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.PDOStatement-fetchObject">
<refnamediv>
<refname>PDOStatement::fetchObject</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.PDOStatement-getAttribute">
<refnamediv>
<refname>PDOStatement::getAttribute</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.PDOStatement-getColumnMeta">
<refnamediv>
<refname>PDOStatement::getColumnMeta</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.PDOStatement-nextRowset">
<refnamediv>
<refname>PDOStatement::nextRowset</refname>

View file

@ -1,43 +1,42 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.9 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDOStatement-rowCount">
<refnamediv>
<refname>PDOStatement::rowCount</refname>
<refpurpose>
Returns the number of rows affected by the last SQL statement
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>PDOStatement::rowCount</methodname>
<void/>
</methodsynopsis>
<!-- $Revision: 1.10 $ -->
<refentry id="function.PDOStatement-rowCount">
<refnamediv>
<refname>PDOStatement::rowCount</refname>
<refpurpose>
Returns the number of rows affected by the last SQL statement
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>PDOStatement::rowCount</methodname>
<void/>
</methodsynopsis>
<para>
<function>PDOStatement::rowCount</function> returns the number of
rows affected by the last DELETE, INSERT, or UPDATE statement
executed by the corresponding <literal>PDOStatement</literal> object.
</para>
<para>
If the last SQL statement executed by the associated
<literal>PDOStatement</literal> was a SELECT statement, some databases
may return the number of rows returned by that statement. However, this
behaviour is not guaranteed for all databases and should not be relied
on for portable applications.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Return the number of deleted rows</title>
<para>
<function>PDOStatement::rowCount</function> returns the number of
rows affected by the last DELETE, INSERT, or UPDATE statement
executed by the corresponding <literal>PDOStatement</literal> object.
rows affected by a DELETE, INSERT, or UPDATE statement.
</para>
<para>
If the last SQL statement executed by the associated
<literal>PDOStatement</literal> was a SELECT statement, some databases
may return the number of rows returned by that statement. However, this
behaviour is not guaranteed for all databases and should not be relied
on for portable applications.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Return the number of deleted rows</title>
<para>
<function>PDOStatement::rowCount</function> returns the number of
rows affected by a DELETE, INSERT, or UPDATE statement.
</para>
<programlisting role="php">
<programlisting role="php">
<![CDATA[
<?php
/* Delete all rows from the FRUIT table */
@ -50,43 +49,43 @@ $count = $del->rowCount();
print("Deleted $count rows.\n");
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Deleted 9 rows.
]]>
</screen>
</example>
<example>
<title>Counting rows returned by a SELECT statement</title>
<para>
For most databases, <function>PDOStatement::rowCount</function> does not
return the number of rows affected by a SELECT statement. Instead, use
<function>PDO::query</function> to issue a SELECT COUNT(*) statement
with the same predicates as your intended SELECT statement, then use
<function>PDOStatement::fetchColumn</function> to retrieve the number
of rows that will be returned. Your application can then perform the
correct action.
</para>
<programlisting role="php">
</screen>
</example>
<example>
<title>Counting rows returned by a SELECT statement</title>
<para>
For most databases, <function>PDOStatement::rowCount</function> does not
return the number of rows affected by a SELECT statement. Instead, use
<function>PDO::query</function> to issue a SELECT COUNT(*) statement
with the same predicates as your intended SELECT statement, then use
<function>PDOStatement::fetchColumn</function> to retrieve the number
of rows that will be returned. Your application can then perform the
correct action.
</para>
<programlisting role="php">
<![CDATA[
<?php
$sql = "SELECT COUNT(*) FROM fruit WHERE calories > 100";
if ($res = $conn->query($sql)) {
/* Check the number of rows that match the SELECT statement */
if ($res->fetchColumn() > 0) {
if ($res->fetchColumn() > 0) {
/* Issue the real SELECT statement and work with the results */
$sql = "SELECT name FROM fruit WHERE calories > 100";
foreach ($conn->query($sql) as $row) {
print "Name: " . $row['NAME'] . "\n";
foreach ($conn->query($sql) as $row) {
print "Name: " . $row['NAME'] . "\n";
}
}
/* No rows matched -- do something else */
else {
print "No rows matched the query.";
else {
print "No rows matched the query.";
}
}
@ -94,32 +93,32 @@ $res = null;
$conn = null;
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
apple
banana
orange
pear
]]>
</screen>
</example>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDOStatement::columnCount</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
<member><function>PDOStatement::query</function></member>
</simplelist>
</para>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDOStatement::columnCount</function></member>
<member><function>PDOStatement::fetchColumn</function></member>
<member><function>PDOStatement::query</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.PDOStatement-setAttribute">
<refnamediv>
<refname>PDOStatement::setAttribute</refname>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.PDOStatement-setFetchMode">
<refnamediv>
<refname>PDOStatement::setFetchMode</refname>