Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Include all columns to allow SQL Server to ORDER BY on the outside

  • Loading branch information...
commit b416d3b2a38495e4435bde872b19fec371fe5657 1 parent b5e19dc
@CraigMason authored
View
10 lib/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php
@@ -121,10 +121,20 @@ public function walkSelectStatement(SelectStatement $AST)
}
// Build the counter query
+ /*
return sprintf('SELECT %s AS dctrn_count FROM (SELECT DISTINCT %s FROM (%s) dctrn_result) dctrn_table',
$this->platform->getCountExpression('*'),
implode(', ', $sqlIdentifier),
$sql
);
+ *
+ */
+
+ // Build the counter query
+ return sprintf('SELECT %s AS dctrn_count FROM (SELECT DISTINCT %s FROM (%s) dctrn_result) dctrn_table',
+ $this->platform->getCountExpression('*'),
+ '*',
+ $sql
+ );
}
}
View
6 lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php
@@ -132,8 +132,12 @@ public function walkSelectStatement(SelectStatement $AST)
}
// Build the counter query
- $sql = sprintf('SELECT DISTINCT %s FROM (%s) dctrn_result',
+ /*
+ $sql = sprintf('SELECT DISTINCT %s, FROM (%s) dctrn_result',
implode(', ', $sqlIdentifier), $sql);
+ */
+
+ $sql = sprintf('SELECT DISTINCT * FROM (%s) dctrn_result', $sql);
// Apply the limit and offset
$sql = $this->platform->modifyLimitQuery(
Please sign in to comment.
Something went wrong with that request. Please try again.