From 85653c9ffc5f5f4543b974ccd4efc77e2947c328 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 11 Jun 2019 08:45:25 +0200 Subject: [PATCH] Sanityzation: - no use of cache to build queries when the flag is set - Use class key instead of 'id' for default select column --- core/dbobjectsearch.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index 9d4e1755c..68573503a 100644 --- a/core/dbobjectsearch.class.php +++ b/core/dbobjectsearch.class.php @@ -1667,7 +1667,7 @@ class DBObjectSearch extends DBSearch // Query caching // $sOqlAPCCacheId = null; - if (self::$m_bQueryCacheEnabled) + if (self::$m_bQueryCacheEnabled && $bCanCache) { // Warning: using directly the query string as the key to the hash array can FAIL if the string // is long and the differences are only near the end... so it's safer (but not bullet proof?) @@ -1815,7 +1815,7 @@ class DBObjectSearch extends DBSearch if ($bIsOnQueriedClass) { // default to the whole list of attributes + the very std id/finalclass - $oBuild->m_oQBExpressions->AddSelect($sClassAlias.'id', new FieldExpression('id', $sClassAlias)); + $oBuild->m_oQBExpressions->AddSelect($sClassAlias.$sKeyField, new FieldExpression($sKeyField, $sClassAlias)); if (is_null($aAttToLoad) || !array_key_exists($sClassAlias, $aAttToLoad)) { $sSelectedClass = $oBuild->GetSelectedClass($sClassAlias);