dbs Wed Jan 26 00:35:40 2005 EDT
Modified files:
/phpdoc/en/reference/pdo constants.xml
/phpdoc/en/reference/pdo/functions PDO-construct.xml
PDOStatement-rowCount.xml
PDOStatement-setFetchMode.xml
Log:
Correct constants.xml typo.
Migrate construct to new template.
Correct rowCount example.
Add setFetchMode documentation.
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/constants.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/pdo/constants.xml
diff -u phpdoc/en/reference/pdo/constants.xml:1.2
phpdoc/en/reference/pdo/constants.xml:1.3
--- phpdoc/en/reference/pdo/constants.xml:1.2 Sun Jan 23 22:11:01 2005
+++ phpdoc/en/reference/pdo/constants.xml Wed Jan 26 00:35:40 2005
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc.
-->
<section id="pdo.constants">
&reftitle.constants;
@@ -133,7 +133,7 @@
<simpara>
Specifies that the fetch method shall return TRUE and assign the values of
the columns in the result set to the PHP variables to which they were
- bound with the <function>PDOStatement::bindParam()</function> method.
+ bound with the <function>PDOStatement::bindParam</function> method.
</simpara>
</listitem>
</varlistentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDO-construct.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/pdo/functions/PDO-construct.xml
diff -u phpdoc/en/reference/pdo/functions/PDO-construct.xml:1.5
phpdoc/en/reference/pdo/functions/PDO-construct.xml:1.6
--- phpdoc/en/reference/pdo/functions/PDO-construct.xml:1.5 Tue Nov 16
15:12:45 2004
+++ phpdoc/en/reference/pdo/functions/PDO-construct.xml Wed Jan 26 00:35:40 2005
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<refentry id="function.PDO-construct">
<refnamediv>
<refname>PDO::__construct</refname>
<refpurpose>
- Creates a PDO instance to represent a connection to a database
+ Creates a PDO instance representing a connection to a database
</refpurpose>
</refnamediv>
<refsect1>
@@ -19,49 +19,101 @@
&warn.experimental.func;
<para>
Creates a PDO instance to represent a connection to the requested
- database. The <parameter>dsn</parameter> parameter supports three
- different methods of specifying the arguments required to create
- a database connection:
+ database.
+ </para>
+ </refsect1>
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
<variablelist>
- <varlistentry><term>Driver invocation</term>
+ <varlistentry><term>dsn</term>
+ <listitem>
+ <para>
+ The <parameter>dsn</parameter> parameter supports three
+ different methods of specifying the arguments required to create
+ a database connection:
+ <variablelist>
+ <varlistentry><term>Driver invocation</term>
+ <listitem>
+ <para>
+ <parameter>dsn</parameter> consists of the PDO driver name,
followed
+ by a colon, followed by the PDO driver-specific connection syntax.
+ For example,
<userinput>'odbc:DSN=SAMPLE;UID=db2inst1;PWD=ibmdb2'</userinput>
+ would create a PDO_ODBC connection to an ODBC database, while
+ <userinput>'mysql:host=127.0.0.1;dbname=testdb'</userinput> would
create
+ a PDO_MYSQL connection to a MySQL database.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry><term>URI invocation</term>
+ <listitem>
+ <para>
+ <parameter>dsn</parameter> consists of <userinput>uri:</userinput>
+ followed by a URI that defines the location of a file containing
+ the DSN string. The URI can specify a local file or a remote URL.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry><term>Aliasing</term>
+ <listitem>
+ <para>
+ <parameter>dsn</parameter> consists of a name
+ <parameter>name</parameter> that maps to
+ <literal>pdo.dsn.<parameter>name</parameter></literal> in
&php.ini;
+ defining the DSN string. <parameter>name</parameter> can not
contain
+ a colon.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry><term>username</term>
<listitem>
<para>
- <parameter>dsn</parameter> consists of the PDO driver name, followed
- by a colon, followed by the PDO driver-specific connection syntax.
- For example,
<userinput>'odbc:DSN=SAMPLE;UID=db2inst1;PWD=ibmdb2'</userinput>
- would create a PDO_ODBC connection to an ODBC database, while
- <userinput>'mysql:host=127.0.0.1;dbname=testdb'</userinput> would
create
- a PDO_MYSQL connection to a MySQL database.
+ The user name, if required, for the DSN string.
</para>
</listitem>
</varlistentry>
- <varlistentry><term>URI invocation</term>
+ <varlistentry><term>password</term>
<listitem>
<para>
- <parameter>dsn</parameter> consists of <userinput>uri:</userinput>
- followed by a URI that defines the location of a file containing
- the DSN string. The URI can specify a local file or a remote URL.
+ The password, if required, for the DSN string.
</para>
</listitem>
</varlistentry>
- <varlistentry><term>Aliasing</term>
+ <varlistentry><term>driver_opts</term>
<listitem>
<para>
- <parameter>dsn</parameter> consists of a name
- <parameter>name</parameter> that maps to
- <literal>pdo.dsn.<parameter>name</parameter></literal> in &php.ini;
- defining the DSN string. <parameter>name</parameter> can not contain
- a colon.
+ A key => value array of driver-specific connection options.
</para>
</listitem>
</varlistentry>
</variablelist>
- If <parameter>username</parameter> or <parameter>password</parameter>
- are not required to complete the connection, you must pass empty strings
- or the constructor will throw a PDOException exception.
</para>
- <example><title>Create a PDO instance via driver invocation</title>
- <programlisting role="php">
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns a PDO object on success.
+ </para>
+ </refsect1>
+
+ <refsect1 role="exceptions">
+ &reftitle.exceptions;
+ <para>
+ <function>PDO::construct</function> throws a PDOException if the attempt
+ to connect to the requested database fails.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example><title>Create a PDO instance via driver invocation</title>
+ <programlisting role="php">
<![CDATA[
<?php
/* Connect to an ODBC database using driver invocation */
@@ -77,26 +129,26 @@
}
?>
]]>
- </programlisting>
- </example>
- <example><title>Create a PDO instance via URI invocation</title>
- <para>
- The following example assumes that the file
- <filename>/usr/local/dbconnect</filename> exists with file permissions
- that enable PHP to read the file. The file contains the PDO DSN to
- connect to a DB2 database through the PDO_ODBC driver:
- </para>
- <programlisting>
+ </programlisting>
+ </example>
+ <example><title>Create a PDO instance via URI invocation</title>
+ <para>
+ The following example assumes that the file
+ <filename>/usr/local/dbconnect</filename> exists with file permissions
+ that enable PHP to read the file. The file contains the PDO DSN to
+ connect to a DB2 database through the PDO_ODBC driver:
+ </para>
+ <programlisting>
<![CDATA[
odbc:DSN=SAMPLE;UID=db2inst1;PWD=password
]]>
- </programlisting>
- <para>
- The PHP script can then create a database connection by simply
- passing the <literal>uri:</literal> parameter and pointing to
- the file URI:
- </para>
- <programlisting role="php">
+ </programlisting>
+ <para>
+ The PHP script can then create a database connection by simply
+ passing the <literal>uri:</literal> parameter and pointing to
+ the file URI:
+ </para>
+ <programlisting role="php">
<![CDATA[
<?php
/* Connect to an ODBC database using driver invocation */
@@ -112,16 +164,16 @@
}
?>
]]>
- </programlisting>
- </example>
- <example><title>Create a PDO instance using an alias</title>
- <para>
- The following example assumes that &php.ini; contains the following
- entry to enable a connection to a MySQL database using only the
- alias <literal>mydb</literal>:
- <screen>pdo.dsn.mydb=mysql:dbname=testdb;host=127.0.0.1</screen>
- </para>
- <programlisting role="php">
+ </programlisting>
+ </example>
+ <example><title>Create a PDO instance using an alias</title>
+ <para>
+ The following example assumes that &php.ini; contains the following
+ entry to enable a connection to a MySQL database using only the
+ alias <literal>mydb</literal>:
+ <screen>pdo.dsn.mydb=mysql:dbname=testdb;host=127.0.0.1</screen>
+ </para>
+ <programlisting role="php">
<![CDATA[
<?php
/* Connect to an ODBC database using an alias */
@@ -137,8 +189,9 @@
}
?>
]]>
- </programlisting>
- </example>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml
diff -u phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml:1.3
phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml:1.4
--- phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml:1.3 Sun Nov
21 15:01:42 2004
+++ phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml Wed Jan 26
00:35:40 2005
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc.
-->
<refentry id="function.PDOStatement-rowCount">
<refnamediv>
@@ -31,6 +31,7 @@
<example><title>Return the number of deleted rows</title>
<programlisting role="php">
<![CDATA[
+<?php
/* Delete all rows from the FRUIT table */
$del = $dbh->prepare('DELETE FROM fruit');
$del->execute();
@@ -39,6 +40,7 @@
print("Return number of rows that were deleted:\n");
$count = $del->rowCount();
print("Deleted $count rows.\n");
+?>
]]>
</programlisting>
</example>
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDOStatement-setFetchMode.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/pdo/functions/PDOStatement-setFetchMode.xml
diff -u phpdoc/en/reference/pdo/functions/PDOStatement-setFetchMode.xml:1.1
phpdoc/en/reference/pdo/functions/PDOStatement-setFetchMode.xml:1.2
--- phpdoc/en/reference/pdo/functions/PDOStatement-setFetchMode.xml:1.1 Mon Jan
17 22:16:39 2005
+++ phpdoc/en/reference/pdo/functions/PDOStatement-setFetchMode.xml Wed Jan
26 00:35:40 2005
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc.
-->
<refentry id="function.PDOStatement-setFetchMode">
<refnamediv>
<refname>PDOStatement::setFetchMode</refname>
<refpurpose>
- Returns meta data for a numbered column
+ Set the default fetch mode for this statement
</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -15,7 +15,7 @@
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
- &warn.undocumented.func;
+ &warn.experimental.func;
</refsect1>
<refsect1 role="parameters">
@@ -26,72 +26,44 @@
<term><parameter>mode</parameter></term>
<listitem>
<para>
- Its description
+ The fetch mode must be one of the <literal>PDO_FETCH_*</literal>
constants.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
+
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- What the function returns, first on success, then on failure. See
- also the &return.success; entity
- </para>
- </refsect1>
-
- <!-- Use when EXCEPTIONS exist
- <refsect1 role="exceptions">
- &reftitle.exceptions;
- <para>
- When does this function throw exceptions?
- </para>
- </refsect1>
- -->
-
-
- <!-- Use when a CHANGELOG exists
- <refsect1 role="changelog">
- &reftitle.changelog;
- <para>
- <informaltable>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>&Version;</entry>
- <entry>&Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Enter the PHP version of change here
- <entry>Description of change
- </row>
- </tbody>
- </tgroup>
- </informaltable>
+ Returns <literal>1</literal> on success or &false; on failure.
</para>
</refsect1>
- -->
-
- <!-- Use when examples exist
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
- <title><function>A PDOStatement-setFetchMode example</title>
+ <title>Setting the fetch mode</title>
<para>
- Any text that describes the purpose of the example, or
- what goes on in the example should go here (inside the
- <example> tag, not out
+ The following example demonstrates how
+ <function>PDOStatement::setFetchMode</function> changes the default fetch
+ mode for a PDOStatement object.
</para>
<programlisting role="php">
<![CDATA[
<?php
-if ($anexample === true) {
- echo 'Use the PEAR Coding Standards';
+$sql = 'SELECT name, colour, calories FROM fruit';
+try {
+ $stmt = $dbh->query($sql);
+ $result = $stmt->setFetchMode(PDO_FETCH_NUM);
+ while ($row = $stmt->fetch()) {
+ print $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
+ }
+}
+catch (PDOException $e) {
+ print $e->getMessage();
}
?>
]]>
@@ -99,14 +71,18 @@
&example.outputs;
<screen>
<![CDATA[
-Use the PEAR Coding Standards
+apple red 150
+banana yellow 250
+orange orange 300
+kiwi brown 75
+lemon yellow 25
+pear green 150
+watermelon pink 90
]]>
</screen>
</example>
</para>
</refsect1>
- -->
-
<!-- Use when adding See Also links
<refsect1 role="seealso">