From ebe93ace8cfbe2bf2077c0b7937a9da251cdd018 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 29 Apr 2009 17:13:41 +0200 Subject: [PATCH] Added support for debug output in Cleanup routine of mysql and pdo logstreams. --- src/classes/logstreamdb.class.php | 28 +++++++++++++--------------- src/classes/logstreampdo.class.php | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index cd671d3..41a5201 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -657,7 +657,6 @@ class LogStreamDB extends LogStream { // Set default rowcount $rowcount = null; - // Perform if Connection is true! if ( $this->_dbhandle != null ) { @@ -678,6 +677,11 @@ class LogStreamDB extends LogStream { // Free result not needed here! //mysql_free_result ($myQuery); } + else + { + // error occured, output DEBUG message + $this->PrintDebugError("CleanupLogdataByDate failed with SQL Statement ' " . $szSql . " '"); + } } //return affected rows @@ -1212,21 +1216,15 @@ class LogStreamDB extends LogStream { */ private function PrintDebugError($szErrorMsg) { - if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) - { - $errdesc = mysql_error(); - $errno = mysql_errno(); + $errdesc = mysql_error(); + $errno = mysql_errno(); - $errormsg="Database error: $szErrorMsg
"; - $errormsg.="mysql error: $errdesc
"; - $errormsg.="mysql error number: $errno
"; - $errormsg.="Date: ".date("d.m.Y @ H:i"). "
"; - $errormsg.="Script: ".getenv("REQUEST_URI"). "
"; - $errormsg.="Referer: ".getenv("HTTP_REFERER"). "
"; - - //Output! - OutputDebugMessage("LogStreamDB|CreateMainSQLQuery: $errormsg", DEBUG_ERROR); - } + $errormsg="$szErrorMsg
"; + $errormsg.="Detail error: $errdesc
"; + $errormsg.="Error Code: $errno
"; + + //Output! + OutputDebugMessage("LogStreamDB|PrintDebugError: $errormsg", DEBUG_ERROR); } /* diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index 67cffc8..3147af3 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -669,6 +669,11 @@ class LogStreamPDO extends LogStream { // Free query now $myQuery->closeCursor(); } + else + { + // error occured, output DEBUG message + $this->PrintDebugError("CleanupLogdataByDate failed with SQL Statement ' " . $szSql . " '"); + } } //return affected rows @@ -1182,20 +1187,15 @@ class LogStreamPDO extends LogStream { */ private function PrintDebugError($szErrorMsg) { - if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) - { - $errdesc = $this->_dbhandle == null ? "" : implode( ";", $this->_dbhandle->errorInfo() ); - $errno = $this->_dbhandle == null ? "" : $this->_dbhandle->errorCode(); + $errdesc = $this->_dbhandle == null ? "" : implode( ";", $this->_dbhandle->errorInfo() ); + $errno = $this->_dbhandle == null ? "" : $this->_dbhandle->errorCode(); - $errormsg ="Error: " . $szErrorMsg . "
"; - $errormsg.="Errordetails:
"; - $errormsg.="Detail Error: $errdesc
"; - $errormsg.="Error Code: $errno
"; - $errormsg.="Date: ".date("d.m.Y @ H:i"). "
"; - - //Output! - OutputDebugMessage("LogStreamPDO|CreateMainSQLQuery: $errormsg", DEBUG_ERROR); - } + $errormsg="$szErrorMsg
"; + $errormsg.="Detail error: $errdesc
"; + $errormsg.="Error Code: $errno
"; + + //Output! + OutputDebugMessage("LogStreamPDO|PrintDebugError: $errormsg", DEBUG_ERROR); } /*