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