dbs             Wed Nov 10 00:26:38 2004 EDT

  Added files:                 
    /phpdoc/en/reference/pdo    reference.xml 
    /phpdoc/en/reference/pdo/functions  pdo-beginTransaction.xml 
                                        pdo-bindParam.xml pdo-commit.xml 
                                        pdo-execute.xml pdo-fetch.xml 
                                        pdo-prepare.xml pdo-rollback.xml 
                                        pdo-setAttribute.xml pdo.xml 
  Log:
  Adding initial draft of PDO documentation
  
http://cvs.php.net/co.php/phpdoc/en/reference/pdo/reference.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/reference.xml
+++ phpdoc/en/reference/pdo/reference.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<reference id='ref.pdo'>
 <title>PHP Data Objects</title>
 <titleabbrev>PDO</titleabbrev>
 <partintro>
  <section id='pdo.initro'>
   &reftitle.intro;
   <para>
   &warn.experimental;
    The PDO extension defines a lightweight, consistent interface
    for accessing databases in PHP. Each database driver that
    implements the PDO interface can expose database-specific
    features as regular extension functions.
   </para>
  </section>
  <!--
  &reference.pdo.configure;
  &reference.pdo.ini;
  -->
  <section id='pdo.classes'>
   &reftitle.classes;
   <section id='pdo.class.pdo'>
    <title><classname>PDO</classname></title>
    <para>
     Represents a connection between PHP and a database server.
    </para>
    <section id='pdo.class.pdo.constructor'>
     &reftitle.constructor;
     <itemizedlist>
      <listitem>
       <para><link linkend='function.pdo'>PDO</link> - construct a new PDO
        object</para>
      </listitem>
     </itemizedlist>
    </section>
    <section id='pdo.class.pdo.methods'>
     &reftitle.methods;
     <itemizedlist>
      <listitem>
       <para><link linkend='function.pdo-beginTransaction'>beginTransaction
       </link> - begin a transaction</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-commit'>commit</link> - commit a
        transaction</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-errorInfo'>errorInfo</link> -
        retrieves an array of error information, if any, from the
        database</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-getMessage'>getMessage</link> -
        retrieves an error message, if any, from the database</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-prepare'>prepare</link> - prepares
        an SQL statement for execution</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-rollback'>rollback</link> - roll
        back a transaction</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-setAttribute'>setAttribute</link> -
        sets a database connection attribute</para>
      </listitem>
     </itemizedlist>
    </section>
   </section>
   <section id='pdo.classes.Statement'>
    <title><classname>Statement</classname></title>
    <para>Represents a prepared statement and, after the statement is
     executed, an associated result set.</para>
    <section id='pdo.class.Statement.methods'>
     &reftitle.methods;
     <itemizedlist>
      <listitem>
       <para><link linkend='function.pdo-bindParam'>bindParam</link> - binds a
        PHP variable to a parameter in the prepared statement</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-execute'>execute</link> - executes a
        prepared statement</para>
      </listitem>
      <listitem>
       <para><link linkend='function.pdo-fetch'>fetch</link> - fetches a
        row from a result set</para>
      </listitem>
     </itemizedlist>
    </section>
   </section>
  </section>
 </partintro>
 &reference.pdo.functions;
</reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-beginTransaction.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-beginTransaction.xml
+++ phpdoc/en/reference/pdo/functions/pdo-beginTransaction.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.beginTransaction'>
 <refnamediv>
  <refname>beginTransaction</refname>
  <refpurpose>Begins a transaction.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>???</type> <methodname>beginTransaction</methodname>
   <void />
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Turns off autocommit mode. Call <function>commit</function> or
   <function>rollback</function> to end the transaction and return to
   autocommit mode.
  </para>
 </refsect1>
</refentry>

http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-bindParam.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-bindParam.xml
+++ phpdoc/en/reference/pdo/functions/pdo-bindParam.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.bindParam'>
 <refnamediv>
  <refname>bindParam</refname>
  <refpurpose>Binds a parameter to the specified variable name.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>???</type> <methodname>bindParam</methodname>
     <methodparam><type>String</type>
      <parameter>parameter-name</parameter></methodparam>
     <methodparam><type>var</type>
      <parameter>variable-name</parameter></methodparam>
     <methodparam choice='opt'><type>integer</type>
      <parameter>data-type</parameter></methodparam>
     <methodparam choice='opt'><type>integer</type>
      <parameter>length</parameter></methodparam>
  </methodsynopsis>
  &warn.experimental.func;
  <para>
  Binds a parameter to the specified variable name.
  </para>
   <example><title>Execute a prepared statement with bound variables</title>
    <programlisting role='php'><![CDATA[
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < ?' AND colour = ?);
$sth->bindParam(1, $calories, PDO_PARAM_INT)
$sth->bindParam(2, $colour, PDO_PARAM_STR, 12)
$sth->execute();
     ]]>
    </programlisting>
   </example>

 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-commit.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-commit.xml
+++ phpdoc/en/reference/pdo/functions/pdo-commit.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.commit'>
 <refnamediv>
  <refname>commit</refname>
  <refpurpose>Commits a transaction.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>???</type> <methodname>commit</methodname>
   <void />
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Commits a transaction, returning the database connection to autocommit
   mode until the next call to <function>beginTransaction</function>
   starts a new transaction.
  </para>
 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-execute.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-execute.xml
+++ phpdoc/en/reference/pdo/functions/pdo-execute.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.execute'>
 <refnamediv>
  <refname>execute</refname>
  <refpurpose>Executes a prepared statement.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>???</type> <methodname>execute</methodname>
   <methodparam choice='opt'><type>array</type>
    <parameter>parameters</parameter></methodparam>
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Execute the prepared statement. If the prepared statement included
   parameter markers, you must either:
   <itemizedlist>
    <listitem><para>call <function>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 parameter values</para></listitem>
   </itemizedlist>
   <example><title>Execute a prepared statement with bound variables</title>
    <programlisting role='php'><![CDATA[
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < ?' AND colour = ?);
$sth->bindParam(1, $calories, PDO_PARAM_INT)
$sth->bindParam(2, $colour, PDO_PARAM_STR, 12)
$sth->execute();
     ]]>
    </programlisting>
   </example>
   <example><title>Execute a prepared statement by passing an array of
     values</title>
    <programlisting role='php'><![CDATA[
/* Execute a prepared statement by passing an array of values */
$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < ?' AND colour = ?);
$sth->execute(array(150, 'red'));
     ]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-fetch.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-fetch.xml
+++ phpdoc/en/reference/pdo/functions/pdo-fetch.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.fetch'>
 <refnamediv>
  <refname>fetch</refname>
  <refpurpose>Fetches a row from a result set.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>array</type> <methodname>fetch</methodname>
     <methodparam choice='opt'><type>integer</type>
      <parameter>PDO_FETCH_STYLE</parameter></methodparam>
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Fetches a row from a result set associated with a Statement object.
  </para>
  <para>
   <parameter>PDO_FETCH_STYLE</parameter> can be one of the following values:
   <itemizedlist>
    <listitem><para>PDO_FETCH_NUM: returns an array indexed by column number
      as returned in your result set, starting at column 0</para></listitem>
    <listitem><para>PDO_FETCH_ASSOC: returns an array indexed by column name
      as returned in your result set
    </para></listitem>
    <listitem><para>
      PDO_FETCH_BOTH (default): returns an array indexed by
      both column name and column number as returned in your result set
    </para></listitem>
    <listitem><para>
      PDO_FETCH_OBJ: returns an anonymous object with property names that
      correspond to the column names returned in your result set
    </para></listitem>
    <listitem><para>
      PDO_FETCH_LAZY: combines PDO_FETCH_BOTH and PDO_FETCH_OBJ, creating
      the object variable names as they are accessed
    </para></listitem>
    <listitem><para>
      PDO_FETCH_BOUND: 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>bindParam</function> method
    </para></listitem>
   </itemizedlist>
  </para>
 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-prepare.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-prepare.xml
+++ phpdoc/en/reference/pdo/functions/pdo-prepare.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.prepare'>
 <refnamediv>
  <refname>prepare</refname>
  <refpurpose>Prepares an SQL statement.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>Statement</type> <methodname>prepare</methodname>
   <methodparam><type>String</type> 
<parameter>SQL-statement</parameter></methodparam>
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Prepares an SQL statement to be executed by the statement-handle
   <function>execute</function> method. The SQL statement can contain zero
   or more parameter markers.
  </para>
   <example><title>Execute a prepared statement by passing an array of
     values</title>
    <programlisting role='php'><![CDATA[
/* Execute a prepared statement by passing an array of values */
$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < ?' AND colour = ?);
$sth->execute(array(150, 'red'));
]]></programlisting>
   </example>

 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-rollback.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-rollback.xml
+++ phpdoc/en/reference/pdo/functions/pdo-rollback.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.rollback'>
 <refnamediv>
  <refname>rollback</refname>
  <refpurpose>Rolls back a transaction.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>???</type> <methodname>rollback</methodname>
   <void />
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Rolls back a transaction, returning the connection state to autocommit mode.
  </para>
 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo-setAttribute.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo-setAttribute.xml
+++ phpdoc/en/reference/pdo/functions/pdo-setAttribute.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo.setAttribute'>
 <refnamediv>
  <refname>setAttribute</refname>
  <refpurpose>Sets a database connection attribute.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>???</type> <methodname>setAttribute</methodname>
   <methodparam><type>int</type> <parameter>attribute</parameter></methodparam>
   <methodparam><type>int</type> <parameter>value</parameter></methodparam>
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   Sets a database connection attribute. The generic PDO connection attributes
   include:
   <itemizedlist>
    <listitem><para>PDO_ATTR_CASE: Force column names to a specific case.
      <itemizedlist>
       <listitem><para>PDO_CASE_LOWER: Force column names to lower
         case.</para></listitem>
       <listitem><para>PDO_CASE_NATURAL: Leave column names as returned by
         the database driver.</para></listitem>
       <listitem><para>PDO_CASE_UPPER: Force column names to upper
         case.</para></listitem>
      </itemizedlist>
    </para></listitem>
   </itemizedlist>
   PDO drivers may define further driver-specific attributes.
  </para>
 </refsect1>
</refentry>


http://cvs.php.net/co.php/phpdoc/en/reference/pdo/functions/pdo.xml?r=1.1&p=1
Index: phpdoc/en/reference/pdo/functions/pdo.xml
+++ phpdoc/en/reference/pdo/functions/pdo.xml
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision -->
<refentry id='function.pdo'>
 <refnamediv>
  <refname>PDO</refname>
  <refpurpose>Creates a PDO instance to represent a connection to a
   database.</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>object</type> <methodname>PDO</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>
  </methodsynopsis>
  &warn.experimental.func;
  <para>
   The format of the Data Source Name (DSN) parameter is:
   <itemizedlist>
    <listitem><para>PDO driver, followed by a colon</para></listitem>
    <listitem><para>followed by optional driver-specific
      information</para></listitem>
   </itemizedlist>
  </para>
  <para>
   To close a database connection:
   <itemizedlist>
    <listitem><para>assign a &null; value to the PDO object</para></listitem>
    <listitem><para>let the PDO object go out of scope</para></listitem>
   </itemizedlist>
  </para>
  <para> 
   Connections are automatically in autocommit mode. Invoke the
   <function>beginTransaction</function> method to turn off autocommit, and
   call <function>commit</function> or <function>rollback</function> to end
   the transaction. PDO automatically rolls back transactions that are ended
   by a closed connection handle.
  </para>
  <example><title>Create a connection</title>
   <programlisting role='php'><![CDATA[
$database = 'SAMPLE';
$user = 'db2inst1';
$password = 'ibmdb2';
try {
    $dbh = new PDO("ODBC:$database", $user, $password);
}
catch (PDOException $e) {
    echo "Could not connect to database '$database' as user '$user'.";
    echo $e->getMessage();
}
]]>
</programlisting>
</example>
 </refsect1>
</refentry>

Reply via email to