Fixed bug that more entries were processed then available inlogstreamdb

This commit is contained in:
Andre Lorbach 2008-04-18 17:15:28 +02:00
parent 791790066a
commit bbb0ec0f04
3 changed files with 22 additions and 18 deletions

View File

@ -185,6 +185,23 @@ class LogStreamDB extends LogStream {
// No buffer? then read from DB!
if ( $this->bufferedRecords == null )
$ret = $this->ReadNextRecordsFromDB($uID);
else
{
if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) )
{
// We need to load new records, so clear the old ones first!
$this->ResetBufferedRecords();
// Set new Record start, will be used in the SQL Statement!
$this->_currentRecordStart = $this->_currentRecordNum; // + 1;
// Now read new ones
$ret = $this->ReadNextRecordsFromDB($uID);
if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) )
$ret = ERROR_NOMORERECORDS;
}
}
if ( $ret == SUCCESS )
{
@ -215,21 +232,6 @@ class LogStreamDB extends LogStream {
// Increment $_currentRecordNum
$this->_currentRecordNum++;
if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) )
{
// We need to load new records, so clear the old ones first!
$this->ResetBufferedRecords();
// Set new Record start, will be used in the SQL Statement!
$this->_currentRecordStart = $this->_currentRecordNum; // + 1;
// Now read new ones
$ret = $this->ReadNextRecordsFromDB($uID);
// TODO Check and READ next record!
// die ("omfg wtf ReadNext " . $this->_currentRecordNum);
}
}
// reached here means return result!

View File

@ -49,7 +49,7 @@ $CFG['UserDBPass'] = "";
// --- Misc Options
$CFG['MiscShowDebugMsg'] = 1; // if enabled, you will get additional output on certain places
$CFG['MiscShowDebugGridCounter'] = 0; // Only for debugging purposes, will add a counter column into the grid!
$CFG['MiscShowDebugGridCounter'] = 1; // Only for debugging purposes, will add a counter column into the grid!
$CFG["MiscShowPageRenderStats"] = 1; // If enabled, you will see Pagerender Settings
// ---
@ -105,7 +105,7 @@ $CFG['Sources'][Source5]['SourceType'] = SOURCE_DB;
$CFG['Sources'][Source5]['DBTableType'] = "winsyslog";
$CFG['Sources'][Source5]['DBType'] = DB_MYSQL;
$CFG['Sources'][Source5]['DBServer'] = "127.0.0.1";
$CFG['Sources'][Source5]['DBName'] = "phplogcon";
$CFG['Sources'][Source5]['DBName'] = "phplogcon_test";
$CFG['Sources'][Source5]['DBUser'] = "root";
$CFG['Sources'][Source5]['DBPassword'] = "";
$CFG['Sources'][Source5]['DBTableName'] = "systemevents";

View File

@ -380,7 +380,9 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
// Increment Counter
$counter++;
} while ($stream->ReadNext($uID, $logArray) == SUCCESS && $counter < $CFG['ViewEntriesPerPage']);
//print_r ( $content['syslogmessages'] );
if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $CFG['ViewEntriesPerPage'] )
{
// Enable Pager in any case here!