TYPO3 CMS  TYPO3_6-2
adodb-exceptions.inc.php
Go to the documentation of this file.
1 <?php
2 
17 if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
18 define('ADODB_ERROR_HANDLER','adodb_throw');
19 
20 class ADODB_Exception extends Exception {
21 var $dbms;
22 var $fn;
23 var $sql = '';
24 var $params = '';
25 var $host = '';
26 var $database = '';
27 
28  function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
29  {
30  switch($fn) {
31  case 'EXECUTE':
32  $this->sql = $p1;
33  $this->params = $p2;
34  $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n";
35  break;
36 
37  case 'PCONNECT':
38  case 'CONNECT':
39  $user = $thisConnection->user;
40  $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n";
41  break;
42  default:
43  $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
44  break;
45  }
46 
47  $this->dbms = $dbms;
48  if ($thisConnection) {
49  $this->host = $thisConnection->host;
50  $this->database = $thisConnection->database;
51  }
52  $this->fn = $fn;
53  $this->msg = $errmsg;
54 
55  if (!is_numeric($errno)) $errno = -1;
56  parent::__construct($s,$errno);
57  }
58 }
59 
71 function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
72 {
73 global $ADODB_EXCEPTION;
74 
75  if (error_reporting() == 0) return; // obey @ protocol
76  if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION;
77  else $errfn = 'ADODB_EXCEPTION';
78  throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection);
79 }
if(!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE' E_USER_ERROR
adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
__construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)