<?php if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_Handler'); /** * Default Error Handler. This will be called with the following params * * @param $dbms the RDBMS you are connecting to * @param $fn the name of the calling function (in uppercase) * @param $errno the native error number from the database * @param $errmsg the native error msg from the database * @param $p1 $fn specific parameter - see below * @param $p2 $fn specific parameter - see below * @param $thisConn $current connection object - can be false if no connection object created */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { if (error_reporting() == 0) return; // obey @ protocol switch($fn) { case 'EXECUTE': $sql = $p1; $inputparams = $p2; $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n"; break; case 'PCONNECT': case 'CONNECT': $host = $p1; $database = $p2; $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n"; break; default: $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; break; } function PmWikiDbError($error) { global $Now, $IsPagePosted; $logpage = 'Site.DbErrors'; $page = ReadPage($logpage); $page['text'] = strftime('%a, %d %b %y @ %H:%M:%S', $Now)."\\\\\n".$error."\n\n".$page['text']; WritePage($logpage,$page); $IsPagePosted = true; PostNotify($logpage,$page,$page); } if (defined('ADODB_ERROR_LOG_TYPE')) { $t = date('Y-m-d H:i:s'); if (ADODB_ERROR_LOG_TYPE == 4) PmWikiDbError("($t) $s"); else if (defined('ADODB_ERROR_LOG_FROM')) error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST, ADODB_ERROR_LOG_FROM); else if (defined('ADODB_ERROR_LOG_DEST')) error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST); else error_log("($t) $s", ADODB_ERROR_LOG_TYPE); } }