Bug fix: (replicate what was done in the 1.2 branch) make sure that we differentiate the cache entries for the queries with and without the $bAllowAllData flag

SVN:1.2.1[2581]
This commit is contained in:
Denis Flaven
2012-12-17 12:42:14 +00:00
parent 71732f1722
commit d72503b411

View File

@@ -4328,7 +4328,15 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
public static function MakeSingleRow($sClass, $iKey, $bMustBeFound = true, $bAllowAllData = false) public static function MakeSingleRow($sClass, $iKey, $bMustBeFound = true, $bAllowAllData = false)
{ {
if (!array_key_exists($sClass, self::$aQueryCacheGetObject)) // Build the query cache signature
//
$sQuerySign = $sClass;
if($bAllowAllData)
{
$sQuerySign .= '_all_';
}
if (!array_key_exists($sQuerySign, self::$aQueryCacheGetObject))
{ {
// NOTE: Quick and VERY dirty caching mechanism which relies on // NOTE: Quick and VERY dirty caching mechanism which relies on
// the fact that the string '987654321' will never appear in the // the fact that the string '987654321' will never appear in the
@@ -4343,13 +4351,13 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
} }
$sSQL = self::MakeSelectQuery($oFilter); $sSQL = self::MakeSelectQuery($oFilter);
self::$aQueryCacheGetObject[$sClass] = $sSQL; self::$aQueryCacheGetObject[$sQuerySign] = $sSQL;
self::$aQueryCacheGetObjectHits[$sClass] = 0; self::$aQueryCacheGetObjectHits[$sQuerySign] = 0;
} }
else else
{ {
$sSQL = self::$aQueryCacheGetObject[$sClass]; $sSQL = self::$aQueryCacheGetObject[$sQuerySign];
self::$aQueryCacheGetObjectHits[$sClass] += 1; self::$aQueryCacheGetObjectHits[$sQuerySign] += 1;
// echo " -load $sClass/$iKey- ".self::$aQueryCacheGetObjectHits[$sClass]."<br/>\n"; // echo " -load $sClass/$iKey- ".self::$aQueryCacheGetObjectHits[$sClass]."<br/>\n";
} }
$sSQL = str_replace(CMDBSource::Quote(987654321), CMDBSource::Quote($iKey), $sSQL); $sSQL = str_replace(CMDBSource::Quote(987654321), CMDBSource::Quote($iKey), $sSQL);