mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Document PDO with classsynopsis and fix all links
# Also rollback a change that shouldn't have make it in the last commit git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@226684 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
615c0b3826
commit
3782dbb92c
33 changed files with 545 additions and 436 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.PDO-beginTransaction">
|
||||
<refnamediv>
|
||||
<refname>PDO::beginTransaction</refname>
|
||||
<refname>PDO->beginTransaction()</refname>
|
||||
<refpurpose>
|
||||
Initiates a transaction
|
||||
</refpurpose>
|
||||
|
@ -10,15 +10,18 @@
|
|||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDO::beginTransaction</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>beginTransaction</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<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
|
||||
you end the transaction by calling <xref linkend="function.PDO-commit" />.
|
||||
Calling <xref linkend="function.PDO-rollBack" /> will roll back all changes to
|
||||
the database and return the connection to autocommit mode.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -68,8 +71,8 @@ $dbh->rollBack();
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::commit</function></member>
|
||||
<member><function>PDO::rollBack</function></member>
|
||||
<member><xref linkend="function.PDO-commit" /></member>
|
||||
<member><xref linkend="function.PDO-rollBack" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.PDO-commit">
|
||||
<refnamediv>
|
||||
<refname>PDO::commit</refname>
|
||||
<refname>PDO->commit()</refname>
|
||||
<refpurpose>
|
||||
Commits a transaction
|
||||
</refpurpose>
|
||||
|
@ -10,13 +10,16 @@
|
|||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDO::commit</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>commit</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Commits a transaction, returning the database connection to autocommit
|
||||
mode until the next call to <function>PDO::beginTransaction</function>
|
||||
mode until the next call to <xref linkend="function.PDO-beginTransaction" />
|
||||
starts a new transaction.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -49,8 +52,8 @@ $dbh->commit();
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::beginTransaction</function></member>
|
||||
<member><function>PDO::rollBack</function></member>
|
||||
<member><xref linkend="function.PDO-beginTransaction" /></member>
|
||||
<member><xref linkend="function.PDO-rollBack" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<!-- $Revision: 1.18 $ -->
|
||||
<refentry id="function.PDO-construct">
|
||||
<refnamediv>
|
||||
<refname>PDO::__construct</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>PDO</type><methodname>__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>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Creates a PDO instance to represent a connection to the requested
|
||||
database.
|
||||
|
@ -117,7 +120,7 @@
|
|||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
<function>PDO::construct</function> throws a PDOException if the attempt
|
||||
<xref linkend="function.PDO-construct" /> throws a PDOException if the attempt
|
||||
to connect to the requested database fails.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDO-errorCode">
|
||||
<refnamediv>
|
||||
<refname>PDO::errorCode</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>errorCode</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
@ -30,12 +33,12 @@
|
|||
class indicates that there is no subclass for that SQLSTATE.
|
||||
</para>
|
||||
<para>
|
||||
<function>PDO::errorCode</function> only retrieves error codes for operations
|
||||
<xref linkend="function.PDO-errorCode" /> 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
|
||||
object through <xref linkend="function.PDO-prepare" /> or
|
||||
<xref linkend="function.PDO-query" /> and invoke an error on the statement
|
||||
handle, <xref linkend="function.PDO-errorCode" /> will not reflect that error.
|
||||
You must call <xref linkend="function.PDOStatement-errorCode" /> to return the error
|
||||
code for an operation performed on a particular statement handle.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -69,9 +72,9 @@ PDO::errorCode(): 42S02
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::errorInfo</function></member>
|
||||
<member><function>PDOStatement::errorCode</function></member>
|
||||
<member><function>PDOStatement::errorInfo</function></member>
|
||||
<member><xref linkend="function.PDO-errorInfo" /></member>
|
||||
<member><xref linkend="function.PDOStatement-errorCode" /></member>
|
||||
<member><xref linkend="function.PDOStatement-errorInfo" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDO-errorInfo">
|
||||
<refnamediv>
|
||||
<refname>PDO::errorInfo</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>errorInfo</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDO::errorInfo</function> returns an array of error information
|
||||
<xref linkend="function.PDO-errorInfo" /> returns an array of error information
|
||||
about the last operation performed by this database handle. The array
|
||||
consists of the following fields:
|
||||
<informaltable>
|
||||
|
@ -50,13 +53,13 @@
|
|||
</para>
|
||||
|
||||
<para>
|
||||
<function>PDO::errorInfo</function> only retrieves error information for
|
||||
<xref linkend="function.PDO-errorInfo" /> 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
|
||||
PDOStatement object through <xref linkend="function.PDO-prepare" /> or
|
||||
<xref linkend="function.PDO-query" /> and invoke an error on the statement
|
||||
handle, <xref linkend="function.PDO-errorInfo" /> will not reflect the error
|
||||
from the statement handle. You must call
|
||||
<function>PDOStatement::errorInfo</function> to return the error
|
||||
<xref linkend="function.PDOStatement-errorInfo" /> to return the error
|
||||
information for an operation performed on a particular statement handle.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -96,9 +99,9 @@ Array
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::errorCode</function></member>
|
||||
<member><function>PDOStatement::errorCode</function></member>
|
||||
<member><function>PDOStatement::errorInfo</function></member>
|
||||
<member><xref linkend="function.PDO-errorCode" /></member>
|
||||
<member><xref linkend="function.PDOStatement-errorCode" /></member>
|
||||
<member><xref linkend="function.PDOStatement-errorInfo" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry id="function.PDO-exec">
|
||||
<refnamediv>
|
||||
<refname>PDO::exec</refname>
|
||||
<refname>PDO->exec()</refname>
|
||||
<refpurpose>
|
||||
Execute an SQL statement and return the number of affected rows
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>PDO::exec</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>exec</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
<function>PDO::exec</function> executes an SQL statement in
|
||||
<xref linkend="function.PDO-exec" /> executes an SQL statement in
|
||||
a single function call, returning the number of rows affected by the
|
||||
statement.
|
||||
</para>
|
||||
<para>
|
||||
<function>PDO::exec</function> does not return results from a SELECT
|
||||
<xref linkend="function.PDO-exec" /> does not return results from a SELECT
|
||||
statement. For a SELECT statement that you only need to issue once
|
||||
during your program, consider issuing <function>PDO::query</function>.
|
||||
during your program, consider issuing <xref linkend="function.PDO-query" />.
|
||||
For a statement that you need to issue multiple times, prepare
|
||||
a PDOStatement object with <function>PDO::prepare</function> and issue
|
||||
the statement with <function>PDOStatement::execute</function>.
|
||||
a PDOStatement object with <xref linkend="function.PDO-prepare" /> and issue
|
||||
the statement with <xref linkend="function.PDOStatement-execute" />.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@ -47,15 +50,15 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDO::exec</function> returns the number of rows that were modified
|
||||
<xref linkend="function.PDO-exec" /> returns the number of rows that were modified
|
||||
or deleted by the SQL statement you issued. If no rows were affected,
|
||||
<function>PDO::exec</function> returns <literal>0</literal>.
|
||||
<xref linkend="function.PDO-exec" /> returns <literal>0</literal>.
|
||||
</para>
|
||||
|
||||
&return.falseproblem;
|
||||
<para>
|
||||
The following example incorrectly relies on the return value of
|
||||
<function>PDO::exec</function>, wherein a statement that affected 0 rows
|
||||
<xref linkend="function.PDO-exec" />, wherein a statement that affected 0 rows
|
||||
results in a call to <function>die</function>:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
|
@ -105,9 +108,9 @@ Deleted 1 rows.
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDO::query</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry id="function.PDO-getAttribute">
|
||||
<refnamediv>
|
||||
<refname>PDO::getAttribute</refname>
|
||||
<refname>PDO->getAttribute()</refname>
|
||||
<refpurpose>
|
||||
Retrieve a database connection attribute
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>PDO::getAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>getAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
This function returns the value of a database connection attribute. To
|
||||
retrieve PDOStatement attributes, refer to
|
||||
<function>PDOStatement::getAttribute</function>.
|
||||
<xref linkend="function.PDOStatement-getAttribute" />.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -104,9 +107,9 @@ Use the PEAR Coding Standards
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::setAttribute</function></member>
|
||||
<member><function>PDOStatement::getAttribute</function></member>
|
||||
<member><function>PDOStatement::setAttribute</function></member>
|
||||
<member><xref linkend="function.PDO-setAttribute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-getAttribute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-setAttribute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,29 +1,32 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.PDO-getAvailableDrivers">
|
||||
<refnamediv>
|
||||
<refname>PDO::getAvailableDrivers</refname>
|
||||
<refname>PDO->getAvailableDrivers()</refname>
|
||||
<refpurpose>
|
||||
Return an array of available PDO drivers
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>PDO::getAvailableDrivers</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>getAvailableDrivers</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
This function returns all currently available PDO drivers which can be used
|
||||
in <parameter>DSN</parameter> parameter of
|
||||
<function>PDO::__construct</function>. This is a static method.
|
||||
<xref linkend="function.PDO-construct" />. This is a static method.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDO::getAvailableDrivers</function> returns an array of PDO driver names. If
|
||||
<xref linkend="function.PDO-getAvailableDrivers" /> returns an array of PDO driver names. If
|
||||
no drivers are available, it returns an empty array.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -32,7 +35,7 @@
|
|||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PDO::getAvailableDrivers</function> example</title>
|
||||
<title>A <xref linkend="function.PDO-getAvailableDrivers" /> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry id="function.PDO-lastInsertId">
|
||||
<refnamediv>
|
||||
<refname>PDO::lastInsertId</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>lastInsertId</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Returns the ID of the last inserted row, or the last value from a
|
||||
|
@ -49,19 +52,19 @@
|
|||
&reftitle.returnvalues;
|
||||
<para>
|
||||
If a sequence name was not specified for the <parameter>name</parameter>
|
||||
parameter, <function>PDOStatement::lastInsertId</function> returns a
|
||||
parameter, <xref linkend="function.PDO-lastInsertId" /> 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
|
||||
parameter, <xref linkend="function.PDO-lastInsertId" /> 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
|
||||
<xref linkend="function.PDO-lastInsertId" /> triggers an
|
||||
<literal>IM001</literal> SQLSTATE.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry id="function.PDO-prepare">
|
||||
<refnamediv>
|
||||
<refname>PDO::prepare</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>PDOStatement</type><methodname>prepare</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>driver_options</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Prepares an SQL statement to be executed by the
|
||||
<function>PDOStatement::execute</function> method. The SQL statement can
|
||||
<xref linkend="function.PDOStatement-execute" /> 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
|
||||
|
@ -25,14 +28,14 @@
|
|||
</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>.
|
||||
in to the statement when you call <xref linkend="function.PDOStatement-execute" />.
|
||||
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
|
||||
Calling <xref linkend="function.PDO-prepare" /> and
|
||||
<xref linkend="function.PDOStatement-execute" /> 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,
|
||||
|
@ -80,9 +83,9 @@
|
|||
&reftitle.returnvalues;
|
||||
<para>
|
||||
If the database server successfully prepares the statement,
|
||||
<function>PDO::prepare</function> returns a PDOStatement object.
|
||||
<xref linkend="function.PDO-prepare" /> returns a PDOStatement object.
|
||||
If the database server cannot successfully prepare the statement,
|
||||
<function>PDO::prepare</function> returns &false;.
|
||||
<xref linkend="function.PDO-prepare" /> returns &false;.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -130,9 +133,9 @@ $yellow = $sth->fetchAll();
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::exec</function></member>
|
||||
<member><function>PDO::query</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><xref linkend="function.PDO-exec" /></member>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,58 +1,70 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDO-query">
|
||||
<refnamediv>
|
||||
<refname>PDO::query</refname>
|
||||
<refname>PDO->query()</refname>
|
||||
<refpurpose>
|
||||
Executes an SQL statement, returning a result set as a PDOStatement object
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>PDOStatement</type><methodname>PDO::query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>PDOStatement</type><methodname>query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDO::query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_COLUMN</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>colno</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_COLUMN</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>colno</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDO::query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_CLASS</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>ctorargs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_CLASS</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>ctorargs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDO::query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_INTO</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>query</methodname>
|
||||
<methodparam><type>string</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_INTO</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
<function>PDO::query</function> executes an SQL statement in
|
||||
<xref linkend="function.PDO-query" /> executes an SQL statement in
|
||||
a single function call, returning the result set (if any) returned by the
|
||||
statement as a PDOStatement object.
|
||||
</para>
|
||||
<para>
|
||||
For a query that you need to issue multiple times, you will realize better
|
||||
performance if you prepare a PDOStatement object using
|
||||
<function>PDO::prepare</function> and issue the statement with multiple
|
||||
calls to <function>PDOStatement::execute</function>.
|
||||
<xref linkend="function.PDO-prepare" /> and issue the statement with multiple
|
||||
calls to <xref linkend="function.PDOStatement-execute" />.
|
||||
</para>
|
||||
<para>
|
||||
If you do not fetch all of the data in a result set before issuing your
|
||||
next call to <function>PDO::query</function>, your call may fail. Call
|
||||
<function>PDOStatement::closeCursor</function> to release the database
|
||||
next call to <xref linkend="function.PDO-query" />, your call may fail. Call
|
||||
<xref linkend="function.PDOStatement-closeCursor" /> to release the database
|
||||
resources associated with the PDOStatement object before issuing your
|
||||
next call to <function>PDO::query</function>.
|
||||
next call to <xref linkend="function.PDO-query" />.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
|
@ -60,7 +72,7 @@
|
|||
Although this function is only documented as having a single
|
||||
parameter, you may pass additional arguments to this function.
|
||||
They will be treated as though you called
|
||||
<function>PDOStatement::setFetchMode</function> on the resultant statement
|
||||
<xref linkend="function.PDOStatement-setFetchMode" /> on the resultant statement
|
||||
object.
|
||||
</para>
|
||||
</note>
|
||||
|
@ -84,7 +96,7 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDO::query</function> returns a PDOStatement object.
|
||||
<xref linkend="function.PDO-query" /> returns a PDOStatement object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -94,7 +106,7 @@
|
|||
<example>
|
||||
<title>Demonstrate PDO::query</title>
|
||||
<para>
|
||||
A nice feature of <function>PDO::query</function> is that it
|
||||
A nice feature of <xref linkend="function.PDO-query" /> is that it
|
||||
enables you to iterate over the rowset returned by a
|
||||
successfully executed SELECT statement.
|
||||
</para>
|
||||
|
@ -133,9 +145,9 @@ watermelon pink 90
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::exec</function></member>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><xref linkend="function.PDO-exec" /></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDO-quote">
|
||||
<refnamediv>
|
||||
<refname>PDO::quote</refname>
|
||||
<refname>PDO->quote()</refname>
|
||||
<refpurpose>
|
||||
Quotes a string for use in a query.
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>PDO::quote</methodname>
|
||||
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>parameter_type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>quote</methodname>
|
||||
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>parameter_type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
<function>PDO::quote</function> places quotes around the input string (if
|
||||
<xref linkend="function.PDO-quote" /> places quotes around the input string (if
|
||||
required) and escapes special characters within the input string, using a
|
||||
quoting style appropriate to the underlying driver.
|
||||
</para>
|
||||
<para>
|
||||
If you are using this function to build SQL statements, you are
|
||||
<emphasis>strongly</emphasis> recommended to use
|
||||
<function>PDO::prepare</function> to prepare SQL statements with bound
|
||||
parameters instead of using <function>PDO::quote</function> to interpolate
|
||||
<xref linkend="function.PDO-prepare" /> to prepare SQL statements with bound
|
||||
parameters instead of using <xref linkend="function.PDO-quote" /> to interpolate
|
||||
user input into a SQL statement. Prepared statements with bound parameters
|
||||
are not only more portable, more convenient, immune to SQL injection, but
|
||||
are often much faster to execute than interpolated queries, as both the
|
||||
|
@ -153,8 +156,8 @@ Quoted string: 'Co''mpl''''ex "st''"ring'
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDO-rollBack">
|
||||
<refnamediv>
|
||||
<refname>PDO::rollBack</refname>
|
||||
<refname>PDO->rollBack()</refname>
|
||||
<refpurpose>
|
||||
Rolls back a transaction
|
||||
</refpurpose>
|
||||
|
@ -10,14 +10,17 @@
|
|||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDO::rollBack</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>rollBack</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Rolls back the current transaction, as initiated by
|
||||
<function>PDO::beginTransaction</function>. It is an error to call this
|
||||
<xref linkend="function.PDO-beginTransaction" />. It is an error to call this
|
||||
method if no transaction is active.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -70,8 +73,8 @@ $dbh->rollBack();
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::beginTransaction</function></member>
|
||||
<member><function>PDO::commit</function></member>
|
||||
<member><xref linkend="function.PDO-beginTransaction" /></member>
|
||||
<member><xref linkend="function.PDO-commit" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDO-setAttribute">
|
||||
<refnamediv>
|
||||
<refname>PDO::setAttribute</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDO</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>setAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Sets an attribute on the database handle. Some of the available generic
|
||||
|
|
|
@ -1,33 +1,36 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry id="function.PDOStatement-bindColumn">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::bindColumn</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>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>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
<function>PDOStatement::bindColumn</function> arranges to have a
|
||||
<xref linkend="function.PDOStatement-bindColumn" /> 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
|
||||
query. Each call to <xref linkend="function.PDOStatement-fetch" /> or
|
||||
<xref linkend="function.PDOStatement-fetchAll" /> 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>.
|
||||
function <emphasis>after</emphasis> <xref linkend="function.PDOStatement-execute" />.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
@ -126,10 +129,10 @@ strawberry red 25
|
|||
&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>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetch" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchAll" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchColumn" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry id="function.PDOStatement-bindParam">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::bindParam</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>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>
|
||||
</classsynopsis>
|
||||
<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
|
||||
<xref linkend="function.PDOStatement-bindValue" />, the variable is bound as a
|
||||
reference and will only be evaluated at the time that
|
||||
<function>PDOStatement::execute</function> is called.
|
||||
<xref linkend="function.PDOStatement-execute" /> is called.
|
||||
</para>
|
||||
<para>
|
||||
Most parameters are input parameters, that is, parameters that are used
|
||||
|
@ -172,9 +175,9 @@ print("After pureeing fruit, the colour is: $colour");
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><function>PDOStatement::bindValue</function></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-bindValue" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.PDOStatement-bindValue">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::bindValue</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>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>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Binds a value to a corresponding named or question mark placeholder
|
||||
in the SQL statement that was use to prepare the statement.
|
||||
|
@ -103,9 +106,9 @@ $sth->execute();
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><function>PDOStatement::bindParam</function></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-bindParam" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.PDOStatement-closeCursor">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::closeCursor</refname>
|
||||
<refname>PDOStatement->closeCursor()</refname>
|
||||
<refpurpose>
|
||||
Closes the cursor, enabling the statement to be executed again.
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::closeCursor</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>closeCursor</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
<function>PDOStatement::closeCursor</function> frees up the connection
|
||||
<xref linkend="function.PDOStatement-closeCursor" /> frees up the connection
|
||||
to the server so that other SQL statements may be issued, but leaves the
|
||||
statement in a state that enables it to be executed again.
|
||||
</para>
|
||||
|
@ -26,7 +29,7 @@
|
|||
the problem may manifest itself in an out-of-sequence error.
|
||||
</para>
|
||||
<para>
|
||||
<function>PDOStatement::closeCursor</function> is implemented either as an
|
||||
<xref linkend="function.PDOStatement-closeCursor" /> is implemented either as an
|
||||
optional driver specific method (allowing for maximum efficiency), or as
|
||||
the generic PDO fallback if no driver specific function is installed.
|
||||
The PDO generic fallback is semantically the same as writing the following
|
||||
|
@ -85,13 +88,13 @@ do {
|
|||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PDOStatement::closeCursor</function> example</title>
|
||||
<title>A <xref linkend="function.PDOStatement-closeCursor" /> example</title>
|
||||
<para>
|
||||
In the following example, the <varname>$stmt</varname> PDOStatement
|
||||
object returns multiple rows but the application fetches only the first
|
||||
row, leaving the PDOStatement object in a state of having unfetched rows.
|
||||
To ensure that the application will work with all database drivers, the
|
||||
author inserts a call to <function>PDOStatement::closeCursor</function>
|
||||
author inserts a call to <xref linkend="function.PDOStatement-closeCursor" />
|
||||
on <varname>$stmt</varname> before executing the
|
||||
<varname>$otherStmt</varname> PDOStatement object.
|
||||
</para>
|
||||
|
@ -126,7 +129,7 @@ $otherStmt->execute();
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.PDOStatement-columnCount">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::columnCount</refname>
|
||||
<refname>PDOStatement->columnCount()</refname>
|
||||
<refpurpose>
|
||||
Returns the number of columns in the result set
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>PDOStatement::columnCount</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>columnCount</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Use <function>PDOStatement::columnCount</function> to return the number
|
||||
Use <xref linkend="function.PDOStatement-columnCount" /> to return the number
|
||||
of columns in the result set represented by the PDOStatement object.
|
||||
</para>
|
||||
<para>
|
||||
If the PDOStatement object was returned from <function>PDO::query</function>,
|
||||
If the PDOStatement object was returned from <xref linkend="function.PDO-query" />,
|
||||
the column count is immediately available.
|
||||
</para>
|
||||
<para>
|
||||
If the PDOStatement object was returned from
|
||||
<function>PDO::prepare</function>, an accurate column count will not be
|
||||
available until you invoke <function>PDOStatement::execute</function>.
|
||||
<xref linkend="function.PDO-prepare" />, an accurate column count will not be
|
||||
available until you invoke <xref linkend="function.PDOStatement-execute" />.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@ -34,7 +37,7 @@
|
|||
<para>
|
||||
Returns the number of columns in the result set represented by the
|
||||
PDOStatement object. If there is no result set,
|
||||
<function>PDOStatement::columnCount</function> returns <literal>0</literal>.
|
||||
<xref linkend="function.PDOStatement-columnCount" /> returns <literal>0</literal>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@ -44,7 +47,7 @@
|
|||
<example>
|
||||
<title>Counting columns</title>
|
||||
<para>
|
||||
This example demonstrates how <function>PDOStatement::columnCount</function>
|
||||
This example demonstrates how <xref linkend="function.PDOStatement-columnCount" />
|
||||
operates with and without a result set.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
|
@ -83,9 +86,9 @@ After execute(), result set has 2 columns (should be 2)
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><function>PDOStatement::rowCount</function></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-rowCount" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.PDOStatement-errorCode">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::errorCode</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>errorCode</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Identical to <function>PDO::errorCode</function>, except that
|
||||
<function>PDOStatement::errorCode</function> only retrieves error codes
|
||||
Identical to <xref linkend="function.PDO-errorCode" />, except that
|
||||
<xref linkend="function.PDOStatement-errorCode" /> only retrieves error codes
|
||||
for operations performed with PDOStatement objects.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -54,9 +57,9 @@ PDOStatement::errorCode(): 42S02
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::errorCode</function></member>
|
||||
<member><function>PDO::errorInfo</function></member>
|
||||
<member><function>PDOStatement::errorInfo</function></member>
|
||||
<member><xref linkend="function.PDO-errorCode" /></member>
|
||||
<member><xref linkend="function.PDO-errorInfo" /></member>
|
||||
<member><xref linkend="function.PDOStatement-errorInfo" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.PDOStatement-errorInfo">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::errorInfo</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>errorInfo</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDOStatement::errorInfo</function> returns an array of
|
||||
<xref linkend="function.PDOStatement-errorInfo" /> returns an array of
|
||||
error information about the last operation performed by this
|
||||
statement handle. The array consists of the following fields:
|
||||
<informaltable>
|
||||
|
@ -88,9 +91,9 @@ Array
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::errorCode</function></member>
|
||||
<member><function>PDO::errorInfo</function></member>
|
||||
<member><function>PDOStatement::errorCode</function></member>
|
||||
<member><xref linkend="function.PDO-errorCode" /></member>
|
||||
<member><xref linkend="function.PDO-errorInfo" /></member>
|
||||
<member><xref linkend="function.PDOStatement-errorCode" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry id="function.PDOStatement-execute">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::execute</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>execute</methodname>
|
||||
<methodparam choice="opt"><type>array</type><parameter>input_parameters</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<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
|
||||
<listitem><para>call <xref linkend="function.PDOStatement-bindParam" /> 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>
|
||||
|
@ -130,11 +133,11 @@ $sth->execute();
|
|||
&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>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-bindParam" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetch" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchAll" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchColumn" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry id="function.PDOStatement-fetch">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::fetch</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>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>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Fetches a row from a result set associated with a PDOStatement object. The
|
||||
|
@ -47,7 +50,7 @@
|
|||
<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>
|
||||
they were bound with the <xref linkend="function.PDOStatement-bindParam" />
|
||||
method
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
|
@ -77,11 +80,6 @@
|
|||
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>
|
||||
|
@ -97,7 +95,7 @@
|
|||
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>.
|
||||
statement with <xref linkend="function.PDO-prepare" />.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -115,7 +113,7 @@
|
|||
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.
|
||||
<xref linkend="function.PDOStatement-fetch" /> was called.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -258,11 +256,11 @@ Reading backwards:
|
|||
&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>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchAll" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchColumn" /></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-setFetchMode" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry id="function.PDOStatement-fetchAll">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::fetchAll</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>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>
|
||||
</classsynopsis>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
@ -26,7 +29,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Controls the contents of the returned array as documented in
|
||||
<function>PDOStatement::fetch</function>. Defaults to
|
||||
<xref linkend="function.PDOStatement-fetch" />. Defaults to
|
||||
<literal>PDO::FETCH_BOTH</literal>.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -64,7 +67,7 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDOStatement::fetchAll</function> returns an array containing
|
||||
<xref linkend="function.PDOStatement-fetchAll" /> 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.
|
||||
|
@ -215,11 +218,11 @@ array(3) {
|
|||
&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>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetch" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchColumn" /></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-setFetchMode" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.PDOStatement-fetchColumn">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::fetchColumn</refname>
|
||||
<refname>PDOStatement->fetchColumn()</refname>
|
||||
<refpurpose>
|
||||
Returns a single column from the next row of a result set
|
||||
</refpurpose>
|
||||
|
@ -10,10 +10,13 @@
|
|||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>PDOStatement::fetchColumn</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>column_number</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>fetchColumn</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>column_number</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Returns a single column from the next row of a result set or &false; if
|
||||
|
@ -30,7 +33,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
0-indexed number of the column you wish to retrieve from the row. If
|
||||
no value is supplied, <function>PDOStatement::fetchColumn</function>
|
||||
no value is supplied, <xref linkend="function.PDOStatement-fetchColumn" />
|
||||
fetches the first column.
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -42,13 +45,13 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>PDOStatement::fetchColumn</function> returns a single column
|
||||
<xref linkend="function.PDOStatement-fetchColumn" /> returns a single column
|
||||
in the next row of a result set.
|
||||
</para>
|
||||
<warning>
|
||||
<para>
|
||||
There is no way to return another column from the same row if you
|
||||
use <function>PDOStatement::fetchColumn</function> to retrieve data.
|
||||
use <xref linkend="function.PDOStatement-fetchColumn" /> to retrieve data.
|
||||
</para>
|
||||
</warning>
|
||||
</refsect1>
|
||||
|
@ -91,11 +94,11 @@ colour = red
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::query</function></member>
|
||||
<member><function>PDOStatement::fetch</function></member>
|
||||
<member><function>PDOStatement::fetchAll</function></member>
|
||||
<member><function>PDOStatement::prepare</function></member>
|
||||
<member><function>PDOStatement::setFetchMode</function></member>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetch" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchAll" /></member>
|
||||
<member><xref linkend="function.PDO-prepare" /></member>
|
||||
<member><xref linkend="function.PDOStatement-setFetchMode" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.PDOStatement-fetchObject">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::fetchObject</refname>
|
||||
<refname>PDOStatement->fetchObject()</refname>
|
||||
<refpurpose>Fetches the next row and returns it as an object.</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>PDOStatement::fetchObject</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>ctor_args</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>fetchObject</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>ctor_args</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Fetches the next row and returns it as an object. This function is an
|
||||
alternative to <function>PDOStatement::fetch</function> with
|
||||
alternative to <xref linkend="function.PDOStatement-fetch" /> with
|
||||
<constant>PDO::FETCH_CLASS</constant> or
|
||||
<constant>PDO::FETCH_OBJ</constant> style.
|
||||
</para>
|
||||
|
@ -56,7 +59,7 @@
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDOStatement::fetch</function></member>
|
||||
<member><xref linkend="function.PDOStatement-fetch" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.PDOStatement-getAttribute">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::getAttribute</refname>
|
||||
<refname>PDOStatement->getAttribute()</refname>
|
||||
<refpurpose>
|
||||
Retrieve a statement attribute
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>PDOStatement::getAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>getAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Gets an attribute of the statement. Currently, no generic attributes exist but only driver specific:
|
||||
|
@ -86,9 +89,9 @@ Use the PEAR Coding Standards
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::getAttribute</function></member>
|
||||
<member><function>PDO::setAttribute</function></member>
|
||||
<member><function>PDOStatement::setAttribute</function></member>
|
||||
<member><xref linkend="function.PDO-getAttribute" /></member>
|
||||
<member><xref linkend="function.PDO-setAttribute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-setAttribute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.PDOStatement-getColumnMeta">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::getColumnMeta</refname>
|
||||
<refname>PDOStatement->getColumnMeta()</refname>
|
||||
<refpurpose>
|
||||
Returns metadata for a column in a result set
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>PDOStatement::getColumnMeta</methodname>
|
||||
<methodparam><type>int</type><parameter>column</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>getColumnMeta</methodname>
|
||||
<methodparam><type>int</type><parameter>column</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
|
@ -22,7 +25,7 @@
|
|||
<warning>
|
||||
<simpara>
|
||||
Not all PDO drivers support
|
||||
<function>PDOStatement::getColumnMeta</function>.
|
||||
<xref linkend="function.PDOStatement-getColumnMeta" />.
|
||||
</simpara>
|
||||
</warning>
|
||||
|
||||
|
@ -69,7 +72,7 @@
|
|||
<entry><literal><varname>driver</varname>:decl_type</literal></entry>
|
||||
<entry>The SQL type used to represent the column value in the database.
|
||||
If the column in the result set is the result of a function, this value
|
||||
is not returned by <function>PDOStatement::getColumnMeta</function>.
|
||||
is not returned by <xref linkend="function.PDOStatement-getColumnMeta" />.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
|
@ -185,8 +188,8 @@ array(6) {
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDOStatement::columnCount</function></member>
|
||||
<member><function>PDOStatement::rowCount</function></member>
|
||||
<member><xref linkend="function.PDOStatement-columnCount" /></member>
|
||||
<member><xref linkend="function.PDOStatement-rowCount" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.PDOStatement-nextRowset">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::nextRowset</refname>
|
||||
<refname>PDOStatement->nextRowset()</refname>
|
||||
<refpurpose>
|
||||
Advances to the next rowset in a multi-rowset statement handle
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::nextRowset</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>nextRowset</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Some database servers support stored procedures that return more than one
|
||||
rowset (also known as a result set).
|
||||
<function>PDOStatement::nextRowSet</function> enables you to access the
|
||||
<xref linkend="function.PDOStatement-nextRowset" /> enables you to access the
|
||||
second and subsequent rowsets associated with a PDOStatement object. Each
|
||||
rowset can have a different set of columns from the preceding rowset.
|
||||
</para>
|
||||
|
@ -38,7 +41,7 @@
|
|||
<para>
|
||||
The following example shows how to call a stored procedure,
|
||||
MULTIPLE_RESULTS, that returns three rowsets. We use a do / while loop to
|
||||
loop over the <function>PDOStatement::nextRowset</function> method, which
|
||||
loop over the <xref linkend="function.PDOStatement-nextRowset" /> method, which
|
||||
returns false and terminates the loop when no more rowsets can be returned.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
|
@ -93,10 +96,10 @@ banana yellow
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDOStatement::columnCount</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
<member><function>PDOStatement::getColumnMeta</function></member>
|
||||
<member><function>PDOStatement::query</function></member>
|
||||
<member><xref linkend="function.PDOStatement-columnCount" /></member>
|
||||
<member><xref linkend="function.PDOStatement-execute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-getColumnMeta" /></member>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry id="function.PDOStatement-rowCount">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::rowCount</refname>
|
||||
<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>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>rowCount</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
<function>PDOStatement::rowCount</function> returns the number of
|
||||
<xref linkend="function.PDOStatement-rowCount" /> returns the number of
|
||||
rows affected by the last DELETE, INSERT, or UPDATE statement
|
||||
executed by the corresponding <literal>PDOStatement</literal> object.
|
||||
</para>
|
||||
|
@ -33,7 +36,7 @@
|
|||
<example>
|
||||
<title>Return the number of deleted rows</title>
|
||||
<para>
|
||||
<function>PDOStatement::rowCount</function> returns the number of
|
||||
<xref linkend="function.PDOStatement-rowCount" /> returns the number of
|
||||
rows affected by a DELETE, INSERT, or UPDATE statement.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
|
@ -60,11 +63,11 @@ Deleted 9 rows.
|
|||
<example>
|
||||
<title>Counting rows returned by a SELECT statement</title>
|
||||
<para>
|
||||
For most databases, <function>PDOStatement::rowCount</function> does not
|
||||
For most databases, <xref linkend="function.PDOStatement-rowCount" /> does not
|
||||
return the number of rows affected by a SELECT statement. Instead, use
|
||||
<function>PDO::query</function> to issue a SELECT COUNT(*) statement
|
||||
<xref linkend="function.PDO-query" /> 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
|
||||
<xref linkend="function.PDOStatement-fetchColumn" /> to retrieve the number
|
||||
of rows that will be returned. Your application can then perform the
|
||||
correct action.
|
||||
</para>
|
||||
|
@ -111,9 +114,9 @@ pear
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDOStatement::columnCount</function></member>
|
||||
<member><function>PDOStatement::fetchColumn</function></member>
|
||||
<member><function>PDOStatement::query</function></member>
|
||||
<member><xref linkend="function.PDOStatement-columnCount" /></member>
|
||||
<member><xref linkend="function.PDOStatement-fetchColumn" /></member>
|
||||
<member><xref linkend="function.PDO-query" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.PDOStatement-setAttribute">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::setAttribute</refname>
|
||||
<refname>PDOStatement->setAttribute()</refname>
|
||||
<refpurpose>
|
||||
Set a statement attribute
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::setAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>setAttribute</methodname>
|
||||
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<para>
|
||||
Sets an attribute on the statement. Currently, no generic attributes are set but only driver specific:
|
||||
|
@ -130,9 +133,9 @@ Use the PEAR Coding Standards
|
|||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::getAttribute</function></member>
|
||||
<member><function>PDO::setAttribute</function></member>
|
||||
<member><function>PDOStatement::getAttribute</function></member>
|
||||
<member><xref linkend="function.PDO-getAttribute" /></member>
|
||||
<member><xref linkend="function.PDO-setAttribute" /></member>
|
||||
<member><xref linkend="function.PDOStatement-getAttribute" /></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,37 +1,49 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<refentry id="function.PDOStatement-setFetchMode">
|
||||
<refnamediv>
|
||||
<refname>PDOStatement::setFetchMode</refname>
|
||||
<refname>PDOStatement->setFetchMode()</refname>
|
||||
<refpurpose>
|
||||
Set the default fetch mode for this statement
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_COLUMN</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>colno</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_COLUMN</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>colno</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_CLASS</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>ctorargs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_CLASS</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>ctorargs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_INTO</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>PDOStatement</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>setFetchMode</methodname>
|
||||
<methodparam><type>int</type><parameter>PDO::FETCH_INTO</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
|
@ -64,7 +76,7 @@
|
|||
<title>Setting the fetch mode</title>
|
||||
<para>
|
||||
The following example demonstrates how
|
||||
<function>PDOStatement::setFetchMode</function> changes the default fetch
|
||||
<xref linkend="function.PDOStatement-setFetchMode" /> changes the default fetch
|
||||
mode for a PDOStatement object.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.53 $ -->
|
||||
<!-- $Revision: 1.54 $ -->
|
||||
<!-- Purpose: database.abstract -->
|
||||
<!-- Membership: pecl, bundled -->
|
||||
|
||||
|
@ -239,12 +239,12 @@ $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array(
|
|||
connection. Auto-commit mode means that every query that you run has its
|
||||
own implicit transaction, if the database supports it, or no transaction
|
||||
if the database doesn't support transactions. If you need a transaction,
|
||||
you must use the <function>PDO::beginTransaction</function> method to
|
||||
you must use the <xref linkend="function.PDO-beginTransaction" /> method to
|
||||
initiate one. If the underlying driver does not support transactions, a
|
||||
PDOException will be thrown (regardless of your error handling settings:
|
||||
this is always a serious error condition). Once you are in a transaction,
|
||||
you may use <function>PDO::commit</function> or
|
||||
<function>PDO::rollBack</function> to finish it, depending on the success
|
||||
you may use <xref linkend="function.PDO-commit" /> or
|
||||
<xref linkend="function.PDO-rollBack" /> to finish it, depending on the success
|
||||
of the code you run during the transaction.
|
||||
|
||||
</para>
|
||||
|
@ -259,7 +259,7 @@ $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array(
|
|||
<warning>
|
||||
<para>
|
||||
The automatic rollback only happens if you initiate the transaction via
|
||||
<function>PDO::beginTransaction</function>. If you manually issue a
|
||||
<xref linkend="function.PDO-beginTransaction" />. If you manually issue a
|
||||
query that begins a transaction PDO has no way of knowing about it and
|
||||
thus cannot roll it back if something bad happens.
|
||||
</para>
|
||||
|
@ -272,8 +272,8 @@ $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array(
|
|||
In addition to entering the basic data for that person, we also need to
|
||||
record their salary. It's pretty simple to make two separate updates,
|
||||
but by enclosing them within the
|
||||
<function>PDO::beginTransaction</function> and
|
||||
<function>PDO::commit</function> calls, we are guaranteeing that no one
|
||||
<xref linkend="function.PDO-beginTransaction" /> and
|
||||
<xref linkend="function.PDO-commit" /> calls, we are guaranteeing that no one
|
||||
else will be able to see those changes until they are complete. If
|
||||
something goes wrong, the catch block rolls back all changes made
|
||||
since the transaction was started, and then prints out an error
|
||||
|
@ -509,12 +509,12 @@ $stmt->execute(array("%$_GET[name]%"));
|
|||
</para>
|
||||
<para>
|
||||
This is the default mode. PDO will simply set the error code for you
|
||||
to inspect using the <function>PDO::errorCode</function> and
|
||||
<function>PDO::errorInfo</function> methods on both the
|
||||
to inspect using the <xref linkend="function.PDO-errorCode" /> and
|
||||
<xref linkend="function.PDO-errorInfo" /> methods on both the
|
||||
statement and database objects; if the error resulted from a call on a
|
||||
statement object, you would invoke the
|
||||
<function>PDOStatement::errorCode</function> or
|
||||
<function>PDOStatement::errorInfo</function>
|
||||
<xref linkend="function.PDOStatement-errorCode" /> or
|
||||
<xref linkend="function.PDOStatement-errorInfo" />
|
||||
method on that object. If the error resulted from a call on the
|
||||
database object, you would invoke those methods on the database object
|
||||
instead.
|
||||
|
@ -560,10 +560,10 @@ $stmt->execute(array("%$_GET[name]%"));
|
|||
<para>
|
||||
PDO standardizes on using SQL-92 SQLSTATE error code strings; individual
|
||||
PDO drivers are responsible for mapping their native codes to the
|
||||
appropriate SQLSTATE codes. The <function>PDO::errorCode</function>
|
||||
appropriate SQLSTATE codes. The <xref linkend="function.PDO-errorCode" />
|
||||
method returns a single SQLSTATE code. If you need more specific
|
||||
information about an error, PDO also offers an
|
||||
<function>PDO::errorInfo</function> method which returns an array
|
||||
<xref linkend="function.PDO-errorInfo" /> method which returns an array
|
||||
containing the SQLSTATE code, the driver specific error code and driver
|
||||
specific error string.
|
||||
</para>
|
||||
|
@ -578,8 +578,8 @@ $stmt->execute(array("%$_GET[name]%"));
|
|||
"large". Large objects can be either textual or binary in nature. PDO
|
||||
allows you to work with this large data type by using the
|
||||
<constant>PDO::PARAM_LOB</constant>
|
||||
type code in your <function>PDOStatement::bindParam</function> or
|
||||
<function>PDOStatement::bindColumn</function> calls.
|
||||
type code in your <xref linkend="function.PDOStatement-bindParam" /> or
|
||||
<xref linkend="function.PDOStatement-bindColumn" /> calls.
|
||||
<constant>PDO::PARAM_LOB</constant> tells
|
||||
PDO to map the data as a stream, so that you can manipulate it using the
|
||||
<link linkend='ref.stream'>PHP Streams API</link>.
|
||||
|
|
Loading…
Reference in a new issue