Documentation TYPO3 par Ameos

adodb-errorpear.inc.php

00001 <?php
00013 include_once('PEAR.php');
00014 
00015 if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR');
00016 
00017 /*
00018 * Enabled the following if you want to terminate scripts when an error occurs
00019 */
00020 //PEAR::setErrorHandling (PEAR_ERROR_DIE);
00021 
00022 /*
00023 * Name of the PEAR_Error derived class to call.
00024 */
00025 if (!defined('ADODB_PEAR_ERROR_CLASS')) define('ADODB_PEAR_ERROR_CLASS','PEAR_Error');
00026 
00027 /*
00028 * Store the last PEAR_Error object here
00029 */
00030 global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
00031 
00042 function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
00043 {
00044 global $ADODB_Last_PEAR_Error;
00045         
00046         if (error_reporting() == 0) return; // obey @ protocol
00047         switch($fn) {
00048         case 'EXECUTE':
00049                 $sql = $p1;
00050                 $inputparams = $p2;
00051                 
00052                 $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
00053                 break;
00054                 
00055         case 'PCONNECT':
00056         case 'CONNECT':
00057                 $host = $p1;
00058                 $database = $p2;
00059                 
00060                 $s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, '$database')";
00061                 break;
00062                 
00063         default:
00064                 $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
00065                 break;
00066         }
00067         
00068         $class = ADODB_PEAR_ERROR_CLASS;
00069         $ADODB_Last_PEAR_Error = new $class($s, $errno,
00070                 $GLOBALS['_PEAR_default_error_mode'],
00071                 $GLOBALS['_PEAR_default_error_options'], 
00072                 $errmsg);
00073                 
00074         //print "<p>!$s</p>";
00075 }
00076 
00081 function &ADODB_PEAR_Error()
00082 {
00083 global $ADODB_Last_PEAR_Error;
00084 
00085         return $ADODB_Last_PEAR_Error;
00086 }
00087                 
00088 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6