Fixed an issue in showing insurance balance in payment pop-up.
[openemr.git] / library / adodb / adodb-exceptions.inc.php
blobbb9ed9e43b9d1cbe83241a537ec2a1d542271586
1 <?php
3 /**
4 * @version V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved.
5 * Released under both BSD license and Lesser GPL library license.
6 * Whenever there is any discrepancy between the two licenses,
7 * the BSD license will take precedence.
9 * Set tabs to 4 for best viewing.
11 * Latest version is available at http://php.weblogs.com
13 * Exception-handling code using PHP5 exceptions (try-catch-throw).
17 if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
18 define('ADODB_ERROR_HANDLER','adodb_throw');
20 class ADODB_Exception extends Exception {
21 var $dbms;
22 var $fn;
23 var $sql = '';
24 var $params = '';
25 var $host = '';
26 var $database = '';
28 function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
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;
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;
47 $this->dbms = $dbms;
48 if ($thisConnection) {
49 $this->host = $thisConnection->host;
50 $this->database = $thisConnection->database;
52 $this->fn = $fn;
53 $this->msg = $errmsg;
55 if (!is_numeric($errno)) $errno = -1;
56 parent::__construct($s,$errno);
60 /**
61 * Default Error Handler. This will be called with the following params
63 * @param $dbms the RDBMS you are connecting to
64 * @param $fn the name of the calling function (in uppercase)
65 * @param $errno the native error number from the database
66 * @param $errmsg the native error msg from the database
67 * @param $p1 $fn specific parameter - see below
68 * @param $P2 $fn specific parameter - see below
71 function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
73 global $ADODB_EXCEPTION;
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);