Index: trunk/core/kernel/application.php
===================================================================
diff -u -r939 -r944
--- trunk/core/kernel/application.php (.../application.php) (revision 939)
+++ trunk/core/kernel/application.php (.../application.php) (revision 944)
@@ -150,7 +150,7 @@
*/
function Init()
{
- $this->DB = new DBConnection(SQL_TYPE);
+ $this->DB = new DBConnection(SQL_TYPE, Array(&$this,'handleSQLError') );
$this->DB->Connect(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB);
$this->DB->debugMode = $this->isDebugMode();
@@ -773,6 +773,35 @@
$event_manager =& $this->recallObject('EventManager');
$event_manager->setEvent($prefix_special,$event_name);
}
+
+
+ /**
+ * SQL Error Handler
+ *
+ * @param int $code
+ * @param string $msg
+ * @param string $sql
+ * @return bool
+ * @access private
+ */
+ function handleSQLError($code,$msg,$sql)
+ {
+ global $debugger;
+ if($debugger)
+ {
+ $errorLevel=defined('DBG_SQL_FAILURE')&&DBG_SQL_FAILURE?E_USER_ERROR:E_USER_WARNING;
+ $debugger->dumpVars($_REQUEST);
+ $debugger->appendTrace();
+ trigger_error(''.$msg.' ('.$code.')
SQL: '.$debugger->highlightString($sql),$errorLevel);
+ return true;
+ }
+ else
+ {
+ echo 'xProcessing SQL: '.$sql.'
';
+ echo 'Error ('.$code.'): '.$msg.'
';
+ return false;
+ }
+ }
}
?>
\ No newline at end of file