php-doc-en/reference/pdo/pdostatement/errorinfo.xml
2019-06-22 00:00:07 +00:00

119 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="pdostatement.errorinfo" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>PDOStatement::errorInfo</refname>
<refpurpose>
Fetch extended error information associated with the last operation on the statement handle
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>PDOStatement::errorInfo</methodname>
<void/>
</methodsynopsis>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>PDOStatement::errorInfo</function> returns an array of
error information about the last operation performed by this
statement handle. The array consists of at least 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 characters 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>
<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();
print_r($arr);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
PDOStatement::errorInfo():
Array
(
[0] => 42S02
[1] => -204
[2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an undefined name. SQLSTATE=42704
)
]]>
</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
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:"~/.phpdoc/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
-->