Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

cvs: phpdoc /en/reference/pdo/functions PDOStatement-errorCode.xml
dbs		Thu Nov 25 22:15:40 2004 EDT

Modified files:
/phpdoc/en/reference/pdo/functions	PDOStatement-errorCode.xml
Log:
Add an example.


http://cvs.php.net/diff.php/phpdoc/...1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/pdo/functions/PDOStatement-errorCode.xml
diff -u phpdoc/en/reference/pdo/functions/PDOStatement-errorCode.xml:1.1 php
doc/en/reference/pdo/functions/PDOStatement-errorCode.xml:1.2
--- phpdoc/en/reference/pdo/functions/PDOStatement-errorCode.xml:1.1	Wed Nov
 10 17:21:23 2004
+++ phpdoc/en/reference/pdo/functions/PDOStatement-errorCode.xml	Thu Nov 25 
22:15:40 2004
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc.
 -->
<refentry id="function.PDOStatement-errorCode">
<refnamediv>
@@ -14,9 +14,64 @@
<type>int</type><methodname>PDOStatement::errorCode</methodname>
<void/>
</methodsynopsis>
+     &warn.experimental.func;

-     &warn.undocumented.func;
+    <para>
+     Returns an integer value that maps to the error categories defined
+     in the PDO constants.
+    </para>
+    <example><title>Determining which category of error occurred</title>
+     <programlisting role="php">
+<![CDATA[
+<?php
+/* Provoke an error -- the BONES table does not exist */
+$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 lo
nger
+    than the maximum column length.\n";
+        break;
+    case PDO_ERR_DISCONNECTED:
+        echo "Error: The connection to the requested database has been clos
ed.\n";
+        break;
+}
+?>
+]]>
+     </programlisting>
+    </example>
+    &example.outputs;
+    <screen>
+<![CDATA[
+PDOStatement::errorCode(): Error: The object could not be found.
+]]>
+    </screen>
</refsect1>
</refentry>


Report this thread to moderator Post Follow-up to this message
Old Post
Dan Scott
11-26-04 09:01 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Documentation archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:50 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.