Added support for debug output in Cleanup routine of mysql and pdo logstreams.

This commit is contained in:
Andre Lorbach 2009-04-29 17:13:41 +02:00
parent 542c988556
commit ebe93ace8c
2 changed files with 26 additions and 28 deletions

View File

@ -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 <br>";
$errormsg.="mysql error: $errdesc <br>";
$errormsg.="mysql error number: $errno <br>";
$errormsg.="Date: ".date("d.m.Y @ H:i"). "<br>";
$errormsg.="Script: ".getenv("REQUEST_URI"). "<br>";
$errormsg.="Referer: ".getenv("HTTP_REFERER"). "<br>";
//Output!
OutputDebugMessage("LogStreamDB|CreateMainSQLQuery: $errormsg", DEBUG_ERROR);
}
$errormsg="$szErrorMsg <br>";
$errormsg.="Detail error: $errdesc <br>";
$errormsg.="Error Code: $errno <br>";
//Output!
OutputDebugMessage("LogStreamDB|PrintDebugError: $errormsg", DEBUG_ERROR);
}
/*

View File

@ -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 ="<font color='red'>Error: " . $szErrorMsg . "</font></H3><br>";
$errormsg.="<B>Errordetails:</B><br>";
$errormsg.="Detail Error: $errdesc <br>";
$errormsg.="Error Code: $errno <br>";
$errormsg.="Date: ".date("d.m.Y @ H:i"). "<br>";
//Output!
OutputDebugMessage("LogStreamPDO|CreateMainSQLQuery: $errormsg", DEBUG_ERROR);
}
$errormsg="$szErrorMsg <br>";
$errormsg.="Detail error: $errdesc <br>";
$errormsg.="Error Code: $errno <br>";
//Output!
OutputDebugMessage("LogStreamPDO|PrintDebugError: $errormsg", DEBUG_ERROR);
}
/*