Added some performance tweaks into mysql db driver, which will make searching for strings within messages faster.

This commit is contained in:
Andre Lorbach 2008-12-19 15:01:58 +01:00
parent 69089e7543
commit 5c43460fdd

View File

@ -432,6 +432,10 @@ class LogStreamDB extends LogStream {
{
global $querycount, $dbmapping;
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Only perform query if row counting is enabled!
if ( strlen($this->_SQLwhereClause) > 0 && !$this->_logStreamConfigObj->DBEnableRowCounting )
return $this->_firstPageUID;
$szSql = "SELECT MAX(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause;
$myQuery = mysql_query($szSql, $this->_dbhandle);
@ -461,6 +465,10 @@ class LogStreamDB extends LogStream {
global $querycount, $dbmapping;
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Only perform query if row counting is enabled!
if ( strlen($this->_SQLwhereClause) > 0 && !$this->_logStreamConfigObj->DBEnableRowCounting )
return $this->_lastPageUID;
$szSql = "SELECT MIN(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause;
$myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery)
@ -1097,6 +1105,9 @@ class LogStreamDB extends LogStream {
// Append precreated where clause
$sqlString .= $this->_SQLwhereClause;
// Output SQL Query into DEBUG
// OutputDebugMessage( "CreateSQLStatement result: " . $sqlString );
// Append ORDER clause
if ( $this->_readDirection == EnumReadDirection::Forward )
$sqlString .= " ORDER BY " . $dbmapping[$szTableType][$szSortColumn];