added ending dates of service
[openemr.git] / library / adodb / adodb-errorhandler.inc.php
blob94b4d4742a4b49699c4ea3fbb7fa8d405e658cda
1 <?php
2 /**
3 * @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
4 * Released under both BSD license and Lesser GPL library license.
5 * Whenever there is any discrepancy between the two licenses,
6 * the BSD license will take precedence.
8 * Set tabs to 4 for best viewing.
10 * Latest version is available at http://php.weblogs.com
14 // added Claudio Bustos clbustos#entelchile.net
15 if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
17 define('ADODB_ERROR_HANDLER','ADODB_Error_Handler');
19 /**
20 * Default Error Handler. This will be called with the following params
22 * @param $dbms the RDBMS you are connecting to
23 * @param $fn the name of the calling function (in uppercase)
24 * @param $errno the native error number from the database
25 * @param $errmsg the native error msg from the database
26 * @param $p1 $fn specific parameter - see below
27 * @param $p2 $fn specific parameter - see below
28 * @param $thisConn $current connection object - can be false if no connection object created
30 function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
32 if (error_reporting() == 0) return; // obey @ protocol
33 switch($fn) {
34 case 'EXECUTE':
35 $sql = $p1;
36 $inputparams = $p2;
38 $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n";
39 break;
41 case 'PCONNECT':
42 case 'CONNECT':
43 $host = $p1;
44 $database = $p2;
46 $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n";
47 break;
48 default:
49 $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
50 break;
53 * Log connection error somewhere
54 * 0 message is sent to PHP's system logger, using the Operating System's system
55 * logging mechanism or a file, depending on what the error_log configuration
56 * directive is set to.
57 * 1 message is sent by email to the address in the destination parameter.
58 * This is the only message type where the fourth parameter, extra_headers is used.
59 * This message type uses the same internal function as mail() does.
60 * 2 message is sent through the PHP debugging connection.
61 * This option is only available if remote debugging has been enabled.
62 * In this case, the destination parameter specifies the host name or IP address
63 * and optionally, port number, of the socket receiving the debug information.
64 * 3 message is appended to the file destination
66 if (defined('ADODB_ERROR_LOG_TYPE')) {
67 $t = date('Y-m-d H:i:s');
68 if (defined('ADODB_ERROR_LOG_DEST'))
69 error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST);
70 else
71 error_log("($t) $s", ADODB_ERROR_LOG_TYPE);
75 //print "<p>$s</p>";
76 trigger_error($s,ADODB_ERROR_HANDLER_TYPE);