dbs Wed Jan 26 09:41:31 2005 EDT
Modified files:
/phpdoc/en/reference/pdo/functions PDO-construct.xml
PDO-errorCode.xml
PDO-errorInfo.xml
PDO-lastInsertId.xml
PDOStatement-bindColumn.xml
Log:
Update PDO::errorCode and PDO::errorInfo to reflect current reality.
Continue conversion to new reference template.
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDO-construct.xml?r1=1.6&r2=1.7&ty=u
Index: phpdoc/en/reference/pdo/functions/PDO-construct.xml
diff -u phpdoc/en/reference/pdo/functions/PDO-construct.xml:1.6
phpdoc/en/reference/pdo/functions/PDO-construct.xml:1.7
--- phpdoc/en/reference/pdo/functions/PDO-construct.xml:1.6 Wed Jan 26
00:35:40 2005
+++ phpdoc/en/reference/pdo/functions/PDO-construct.xml Wed Jan 26 09:41:31 2005
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<refentry id="function.PDO-construct">
<refnamediv>
<refname>PDO::__construct</refname>
@@ -7,8 +7,8 @@
Creates a PDO instance representing a connection to a database
</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>PDO</type><methodname>PDO::__construct</methodname>
<methodparam><type>string</type><parameter>dsn</parameter></methodparam>
@@ -122,10 +122,10 @@
$user = 'dbuser';
$password = 'dbpass';
try {
- $dbh = new PDO($dsn, $user, $password);
+ $dbh = new PDO($dsn, $user, $password);
}
catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
+ echo 'Connection failed: ' . $e->getMessage();
}
?>
]]>
@@ -157,10 +157,10 @@
$user = '';
$password = '';
try {
- $dbh = new PDO($dsn, $user, $password);
+ $dbh = new PDO($dsn, $user, $password);
}
catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
+ echo 'Connection failed: ' . $e->getMessage();
}
?>
]]>
@@ -182,10 +182,10 @@
$user = '';
$password = '';
try {
- $dbh = new PDO($dsn, $user, $password);
+ $dbh = new PDO($dsn, $user, $password);
}
catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
+ echo 'Connection failed: ' . $e->getMessage();
}
?>
]]>
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDO-errorCode.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/pdo/functions/PDO-errorCode.xml
diff -u phpdoc/en/reference/pdo/functions/PDO-errorCode.xml:1.2
phpdoc/en/reference/pdo/functions/PDO-errorCode.xml:1.3
--- phpdoc/en/reference/pdo/functions/PDO-errorCode.xml:1.2 Fri Nov 26
15:12:46 2004
+++ phpdoc/en/reference/pdo/functions/PDO-errorCode.xml Wed Jan 26 09:41:31 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.
-->
<refentry id="function.PDO-errorCode">
<refnamediv>
@@ -8,17 +8,21 @@
Fetch the error code associated with the last operation on the database
handle
</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>int</type><methodname>PDO::errorCode</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
<para>
- Returns an integer value that maps to the generic error categories
- defined in the <literal>PDO_ERR_*</literal> set of constants.
+ Returns a SQLSTATE, a five-character alphanumric identifier defined in
the ANSI SQL
+ standard.
</para>
<para>
<function>PDO::errorCode</function> only retrieves error codes for
operations
@@ -30,59 +34,44 @@
<function>PDOStatement::errorCode</function> to return the error
code for an operation performed on a particular statement handle.
</para>
- <example><title>Determining which category of error occurred</title>
- <programlisting role="php">
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example><title>Retrieving a SQLSTATE code</title>
+ <programlisting role="php">
<![CDATA[
<?php
/* Provoke an error -- the BONES table does not exist */
-$dbh->exec("INSERT INTO bones(skull) VALUES ('reagan')");
+$dbh->exec("INSERT INTO bones(skull) VALUES ('lucy')");
echo "\nPDO::errorCode(): ";
-switch ($dbh->errorCode()) {
- case PDO_ERR_NONE:
- echo "No error!\n";
- break;
- case PDO_ERR_CANT_MAP:
- echo "Error: Unable to map data types between database and PHP.\n";
- break;
- case PDO_ERR_SYNTAX:
- echo "Error: incorrect syntax\n";
- break;
- case PDO_ERR_CONSTRAINT:
- echo "Error: The request would violate a constraint.\n";
- break;
- case PDO_ERR_NOT_FOUND:
- echo "Error: The object could not be found.\n";
- break;
- case PDO_ERR_ALREADY_EXISTS:
- echo "Error: The object already exists.\n";
- break;
- case PDO_ERR_NOT_IMPLEMENTED:
- echo "Error: The requested function is not implemented.\n";
- break;
- case PDO_ERR_MISMATCH:
- echo "Error: mismatch\n";
- break;
- case PDO_ERR_TRUNCATED:
- echo "Error: The value was truncated because the input value was longer
- than the maximum column length.\n";
- break;
- case PDO_ERR_DISCONNECTED:
- echo "Error: The connection to the requested database has been
closed.\n";
- break;
-}
+print $dbh->errorCode();
?>
]]>
- </programlisting>
- </example>
- &example.outputs;
- <screen>
+ </programlisting>
+ &example.outputs;
+ <screen>
<![CDATA[
-PDO::errorCode(): Error: The object could not be found.
+PDO::errorCode(): 42S02
]]>
- </screen>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>PDO::errorInfo</function></member>
+ <member><function>PDOStatement::errorCode</function></member>
+ <member><function>PDOStatement::errorInfo</function></member>
+ </simplelist>
+ </para>
</refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDO-errorInfo.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/pdo/functions/PDO-errorInfo.xml
diff -u phpdoc/en/reference/pdo/functions/PDO-errorInfo.xml:1.3
phpdoc/en/reference/pdo/functions/PDO-errorInfo.xml:1.4
--- phpdoc/en/reference/pdo/functions/PDO-errorInfo.xml:1.3 Fri Nov 26
15:12:46 2004
+++ phpdoc/en/reference/pdo/functions/PDO-errorInfo.xml Wed Jan 26 09:41:31 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.PDO-errorInfo">
<refnamediv>
@@ -8,15 +8,18 @@
Fetch extended error information associated with the last operation on
the database handle
</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDO::errorInfo</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
+ </refsect1>
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
<para>
<function>PDO::errorInfo</function> returns an array of error information
about the last operation performed by this database handle. The array
@@ -32,8 +35,8 @@
<tbody>
<row>
<entry>0</entry>
- <entry>Generic PDO error code corresponding to one of the
- <literal>PDO_ERR_*</literal> constants.</entry>
+ <entry>SQLSTATE error code (a five-character alphanumeric identifier
defined
+ in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
@@ -43,6 +46,11 @@
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
+ <row>
+ <entry>3</entry>
+ <entry>SQLSTATE error code (a five-character alphanumeric identifier
defined
+ in the ANSI SQL standard).</entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
@@ -59,37 +67,53 @@
return the error information for an operation performed on a particular
statement handle.
</para>
+ </refsect1>
- <example><title>Displaying errorInfo() fields for a PDO_ODBC connection to
a DB2 database</title>
- <programlisting role="php">
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example><title>Displaying errorInfo() fields for a PDO_ODBC connection
to a DB2 database</title>
+ <programlisting role="php">
<![CDATA[
<?php
/* Provoke an error -- the BONES table does not exist */
-$dbh->exec("INSERT INTO bones(skull) VALUES ('reagan')");
-
-$arr = $dbh->errorInfo();
-if ($arr[0] == PDO_ERR_NOT_FOUND) {
- echo "Error: a requested database object does not exist.\n";
- printf("Driver-specific error code: %d\n", $arr[1]);
- printf("Driver-specific message: [%s]\n", $arr[2]);
-}
+$err = $dbh->prepare('SELECT skull FROM bones');
+$err->execute();
+echo "\nPDOStatement::errorInfo():\n";
+print_r($err->errorInfo());
?>
]]>
- </programlisting>
- </example>
- &example.outputs;
- <screen>
+ </programlisting>
+ &example.outputs;
+ <screen>
<![CDATA[
-Error: a requested database object does not exist.
-Driver-specific error code: -204
-Driver-specific message: [SQLExecute: -204 [IBM][CLI Driver][DB2/NT]
-SQL0204N "DB2INST1.BONES" is an undefined name. SQLSTATE=42704
- [SQL State 42S02] (..\pecl\pdo_odbc\odbc_stmt.c:80)]
+PDOStatement::errorInfo():
+Array
+(
+ [0] => 42S02
+ [1] => -204
+ [2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an
undefined name. SQLSTATE=42704
+ (SQLExecute[-204] at /home/daniels/php/pecl/pdo_odbc/odbc_stmt.c:88)
+ [3] => 42S02
+)
]]>
- </screen>
-
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>PDO::errorCode</function></member>
+ <member><function>PDOStatement::errorCode</function></member>
+ <member><function>PDOStatement::errorInfo</function></member>
+ </simplelist>
+ </para>
</refsect1>
+
+
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDO-lastInsertId.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/pdo/functions/PDO-lastInsertId.xml
diff -u phpdoc/en/reference/pdo/functions/PDO-lastInsertId.xml:1.3
phpdoc/en/reference/pdo/functions/PDO-lastInsertId.xml:1.4
--- phpdoc/en/reference/pdo/functions/PDO-lastInsertId.xml:1.3 Sun Jan 23
22:11:02 2005
+++ phpdoc/en/reference/pdo/functions/PDO-lastInsertId.xml Wed Jan 26
09:41:31 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.PDO-lastInsertId">
<refnamediv>
@@ -18,7 +18,7 @@
&warn.experimental.func;
<note>
<para>
- Due to differences between database server implmenetations, this method
+ Due to differences between database server implementations, this method
may not always return a meaningful result.
</para>
</note>
http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDOStatement-bindColumn.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc/en/reference/pdo/functions/PDOStatement-bindColumn.xml
diff -u phpdoc/en/reference/pdo/functions/PDOStatement-bindColumn.xml:1.3
phpdoc/en/reference/pdo/functions/PDOStatement-bindColumn.xml:1.4
--- phpdoc/en/reference/pdo/functions/PDOStatement-bindColumn.xml:1.3 Sun Jan
23 22:11:02 2005
+++ phpdoc/en/reference/pdo/functions/PDOStatement-bindColumn.xml Wed Jan
26 09:41:31 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-bindColumn">
<refnamediv>
@@ -8,8 +8,8 @@
Bind a column to a PHP variable
</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>PDOStatement::bindColumn</methodname>
<methodparam><type>mixed</type><parameter>column</parameter></methodparam>