1
0
mirror of synced 2025-02-09 00:39:25 +03:00

DDC-3434 - HIDDEN modifier marked fields in ORDER BY clause are always preserved when creating a paginator subquery

This commit is contained in:
Marco Pivetta 2014-12-05 17:11:57 +01:00
parent f31f088f0b
commit 24c4ec91e5

View File

@ -93,25 +93,21 @@ class LimitSubqueryOutputWalker extends SqlWalker
*/ */
public function walkSelectStatement(SelectStatement $AST) public function walkSelectStatement(SelectStatement $AST)
{ {
if ($this->platform instanceof PostgreSqlPlatform) { // Set every select expression as visible(hidden = false) to
// Set every select expression as visible(hidden = false) to // make $AST to have scalar mappings properly
// make $AST to have scalar mappings properly $hiddens = array();
$hiddens = array();
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$hiddens[$idx] = $expr->hiddenAliasResultVariable;
$expr->hiddenAliasResultVariable = false;
}
$innerSql = parent::walkSelectStatement($AST); foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$hiddens[$idx] = $expr->hiddenAliasResultVariable;
// Restore hiddens $expr->hiddenAliasResultVariable = false;
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$expr->hiddenAliasResultVariable = $hiddens[$idx];
}
} else {
$innerSql = parent::walkSelectStatement($AST);
} }
$innerSql = parent::walkSelectStatement($AST);
// Restore hiddens
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$expr->hiddenAliasResultVariable = $hiddens[$idx];
}
// Find out the SQL alias of the identifier column of the root entity. // Find out the SQL alias of the identifier column of the root entity.
// It may be possible to make this work with multiple root entities but that // It may be possible to make this work with multiple root entities but that