mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 22:38:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@229814 c90b9560-bf6c-de11-be94-00142212c4b1
132 lines
3.4 KiB
XML
132 lines
3.4 KiB
XML
<?xml version='1.0' encoding='iso-8859-1'?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<refentry id="function.PDO-errorInfo">
|
|
<refnamediv>
|
|
<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;
|
|
<classsynopsis>
|
|
<ooclass><classname>PDO</classname></ooclass>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>errorInfo</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
</classsynopsis>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<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>
|
|
<tgroup cols='2'>
|
|
<thead>
|
|
<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>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
|
|
<para>
|
|
<xref linkend="function.PDO-errorInfo" /> only retrieves error information for
|
|
operations performed directly on the database handle. If you create a
|
|
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
|
|
<xref linkend="function.PDOStatement-errorInfo" /> to return the error
|
|
information for an operation performed on a particular statement handle.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<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 -- bogus SQL syntax */
|
|
$stmt = $dbh->prepare('bogus sql');
|
|
if (!$stmt) {
|
|
echo "\nPDO::errorInfo():\n";
|
|
print_r($dbh->errorInfo());
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
PDO::errorInfo():
|
|
Array
|
|
(
|
|
[0] => HY000
|
|
[1] => 1
|
|
[2] => near "bogus": syntax error
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><xref linkend="function.PDO-errorCode" /></member>
|
|
<member><xref linkend="function.PDOStatement-errorCode" /></member>
|
|
<member><xref linkend="function.PDOStatement-errorInfo" /></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
|
|
</refentry>
|
|
|
|
<!-- 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
|
|
-->
|