mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N.536 Regression introduced in [r4469] (N.505), itself fixing a regression introduced in [r4404]. REQUIRES TESTING
SVN:trunk[4488]
This commit is contained in:
@@ -1426,6 +1426,7 @@ class DBObjectSearch extends DBSearch
|
||||
}
|
||||
}
|
||||
$sRawId .= $bGetCount;
|
||||
$sRawId .= implode(',', $aSelectedClasses); // Unions may alter the list of selected columns
|
||||
$sOqlId = md5($sRawId);
|
||||
}
|
||||
else
|
||||
@@ -1476,7 +1477,7 @@ class DBObjectSearch extends DBSearch
|
||||
if (!isset($oSQLQuery))
|
||||
{
|
||||
$oKPI = new ExecutionKPI();
|
||||
$oSQLQuery = $oSearch->BuildSQLQueryStruct($aAttToLoad, $bGetCount, $aModifierProperties, $aGroupByExpr);
|
||||
$oSQLQuery = $oSearch->BuildSQLQueryStruct($aAttToLoad, $bGetCount, $aModifierProperties, $aGroupByExpr, $aSelectedClasses);
|
||||
$oKPI->ComputeStats('BuildSQLQueryStruct', $sOqlQuery);
|
||||
|
||||
if (self::$m_bQueryCacheEnabled)
|
||||
|
||||
@@ -5363,3 +5363,45 @@ class TestParsingOptimization extends TestBizModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestUnions extends TestBizModel
|
||||
{
|
||||
static public function GetName()
|
||||
{
|
||||
return 'Unions';
|
||||
}
|
||||
|
||||
static public function GetDescription()
|
||||
{
|
||||
return 'Checking a few UNION queries';
|
||||
}
|
||||
|
||||
protected function DoExecute()
|
||||
{
|
||||
// The two first items did reveal an issue with the query cache,
|
||||
//because SELECT Person on the second line must not give the same query as SELECT Person on the first line
|
||||
$aQueries = array(
|
||||
"SELECT Person UNION SELECT Person" => true,
|
||||
"SELECT Person UNION SELECT Team" => true,
|
||||
"SELECT Person UNION SELECT Contact" => true,
|
||||
"SELECT Contact UNION SELECT Person" => true,
|
||||
"SELECT Person UNION SELECT Organization" => false,
|
||||
);
|
||||
foreach ($aQueries as $sQuery => $bSuccess)
|
||||
{
|
||||
echo "<h5>To Parse: ".htmlentities($sQuery, ENT_QUOTES, 'UTF-8')."</h5>\n";
|
||||
try
|
||||
{
|
||||
$oSearch = DBSearch::FromOQL($sQuery);
|
||||
if (!$bSuccess) throw new Exception('This query should not be parsable!');
|
||||
|
||||
CMDBSource::TestQuery($oSearch->MakeSelectQuery());
|
||||
echo "<p>Successfully tested the SQL query.</p>\n";
|
||||
}
|
||||
catch (OQLException $e)
|
||||
{
|
||||
if ($bSuccess) throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user