Skip to content

Commit

Permalink
Fix incorrect default order by clause.
Browse files Browse the repository at this point in the history
Instead of NULL, the ORDER BY for SQLServer needs to be a select
statement. For compatibility with SQLServer2008 this statement needs to
be wrapped in parentheses as well.

No new tests were added as a number of tests are currently failing, but
we didn't know because AppVeyor is failing due to incorrect dependencies
being installed.

Refs #6730
  • Loading branch information
markstory committed Jun 8, 2015
1 parent 3953c1e commit f8e8044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Database/Dialect/SqlserverDialectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public function _version()
protected function _pagingSubquery($original, $limit, $offset)
{
$field = '_cake_paging_._cake_page_rownum_';
$order = $original->clause('order') ?: new OrderByExpression('(SELECT NULL)');

$query = clone $original;
$order = $query->clause('order') ?: new OrderByExpression('NULL');
$query->select([
'_cake_page_rownum_' => new UnaryExpression('ROW_NUMBER() OVER', $order)
])->limit(null)
Expand Down

0 comments on commit f8e8044

Please sign in to comment.