Documentation TYPO3 par Ameos |
00001 <?php 00002 00017 if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); 00018 define('ADODB_ERROR_HANDLER','adodb_throw'); 00019 00020 class ADODB_Exception extends Exception { 00021 var $dbms; 00022 var $fn; 00023 var $sql = ''; 00024 var $params = ''; 00025 var $host = ''; 00026 var $database = ''; 00027 00028 function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) 00029 { 00030 switch($fn) { 00031 case 'EXECUTE': 00032 $this->sql = $p1; 00033 $this->params = $p2; 00034 $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; 00035 break; 00036 00037 case 'PCONNECT': 00038 case 'CONNECT': 00039 $user = $thisConnection->user; 00040 $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; 00041 break; 00042 default: 00043 $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; 00044 break; 00045 } 00046 00047 $this->dbms = $dbms; 00048 if ($thisConnection) { 00049 $this->host = $thisConnection->host; 00050 $this->database = $thisConnection->database; 00051 } 00052 $this->fn = $fn; 00053 $this->msg = $errmsg; 00054 00055 if (!is_numeric($errno)) $errno = -1; 00056 parent::__construct($s,$errno); 00057 } 00058 } 00059 00071 function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) 00072 { 00073 global $ADODB_EXCEPTION; 00074 00075 if (error_reporting() == 0) return; // obey @ protocol 00076 if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; 00077 else $errfn = 'ADODB_EXCEPTION'; 00078 throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); 00079 } 00080 00081 00082 ?>