Continue the conversion to the new reference template.

Add another couple of constants, and update the PDOStatement
error functions to reflect the new reality.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@178485 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Dan Scott 2005-01-29 04:28:40 +00:00
parent a9bbb39746
commit 47febed813
5 changed files with 127 additions and 120 deletions

View file

@ -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. -->
<section id="pdo.constants">
&reftitle.constants;
@ -133,7 +133,8 @@
<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> or
<function>PDOStatement::bindColumn</function> methods.
</simpara>
</listitem>
</varlistentry>
@ -144,7 +145,8 @@
</term>
<listitem>
<simpara>
Specifies that the fetch method shall return only a single requested
column from the next row in the result set.
</simpara>
</listitem>
</varlistentry>
@ -155,7 +157,8 @@
</term>
<listitem>
<simpara>
Specifies that the fetch method shall return a new instance of the
requested class, mapping the columns to named properties in the class.
</simpara>
</listitem>
</varlistentry>
@ -166,7 +169,8 @@
</term>
<listitem>
<simpara>
Specifies that the fetch method shall update an existing instance of the
requested class, mapping the columns to named properties in the class.
</simpara>
</listitem>
</varlistentry>

View file

@ -1,11 +1,11 @@
<?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-errorCode">
<refnamediv>
<refname>PDO::errorCode</refname>
<refpurpose>
Fetch the error code associated with the last operation on the database handle
Fetch the SQLSTATE associated with the last operation on the database handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -21,7 +21,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a SQLSTATE, a five-character alphanumric identifier defined in the ANSI SQL
Returns a SQLSTATE, a five-character alphanumeric identifier defined in the ANSI SQL
standard.
</para>
<para>

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-errorInfo">
<refnamediv>
@ -27,30 +27,25 @@
<informaltable>
<tgroup cols='2'>
<thead>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
<row>
<entry>3</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
@ -79,7 +74,7 @@
/* Provoke an error -- the BONES table does not exist */
$err = $dbh->prepare('SELECT skull FROM bones');
$err->execute();
echo "\nPDOStatement::errorInfo():\n";
echo "\nPDO::errorInfo():\n";
print_r($err->errorInfo());
?>
]]>
@ -87,14 +82,12 @@ print_r($err->errorInfo());
&example.outputs;
<screen>
<![CDATA[
PDOStatement::errorInfo():
PDO::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>

View file

@ -1,27 +1,36 @@
<?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.PDOStatement-errorCode">
<refnamediv>
<refname>PDOStatement::errorCode</refname>
<refpurpose>
Fetch the error code associated with the last operation on the statement handle
Fetch the SQLSTATE associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>PDOStatement::errorCode</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an integer value that maps to the error categories defined
in the PDO constants.
Returns a SQLSTATE, a five-character alphanumeric identifier defined in the ANSI SQL
standard. <function>PDOStatement::errorCode</function> only retrieves error codes
for operations performed with PDOStatement objects.
</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 */
@ -29,50 +38,31 @@ $err = $dbh->prepare('SELECT skull FROM bones');
$err->execute();
echo "\nPDOStatement::errorCode(): ";
switch ($err->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 $err->errorCode();
?>
]]>
</programlisting>
</example>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDOStatement::errorCode(): Error: The object could not be found.
PDOStatement::errorCode(): 42S02
]]>
</screen>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorInfo</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,21 +1,25 @@
<?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-errorInfo">
<refnamediv>
<refname>PDOStatement::errorInfo</refname>
<refpurpose>
Fetch an array of error information associated with the last operation on the statement handle
Fetch extended error information associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>PDOStatement::errorInfo</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::errorInfo</function> returns an array of
error information about the last operation performed by this
@ -23,60 +27,76 @@
<informaltable>
<tgroup cols='2'>
<thead>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
<row>
<entry>Element</entry>
<entry>Information</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>Generic PDO error code corresponding to one of the
<literal>PDO_ERR_*</literal> constants.</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
<row>
<entry>0</entry>
<entry>SQLSTATE error code (a five-character alphanumeric identifier defined
in the ANSI SQL standard).</entry>
</row>
<row>
<entry>1</entry>
<entry>Driver-specific error code.</entry>
</row>
<row>
<entry>2</entry>
<entry>Driver-specific error message.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<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 */
$sth = $dbh->prepare('SELECT skull FROM bones');
$sth->execute();
echo "\nPDOStatement::errorInfo():\n";
$arr = $sth->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]);
}
print_r($arr);
?>
]]>
</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
)
]]>
</screen>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::errorCode</function></member>
<member><function>PDO::errorInfo</function></member>
<member><function>PDOStatement::errorCode</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file