Browse Source

Changed to proper format the order by in sqlserver

Juan Basso 12 years ago
parent
commit
e9d46bf084
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/Database/Dialect/SqlserverDialectTrait.php

+ 3 - 2
src/Database/Dialect/SqlserverDialectTrait.php

@@ -52,7 +52,6 @@ trait SqlserverDialectTrait {
 
 		if ($limit && $offset === null) {
 			// @todo implement TOP
-			$query->clause('order') || $query->order([$query->connection()->newQuery()->select(['NULL'])]);
 			throw new \Cake\Error\NotImplementedException();
 		}
 
@@ -64,7 +63,9 @@ trait SqlserverDialectTrait {
 			$query->offset($query->newExpr()->add($offsetSql));
 			$query->limit(null);
 
-			$query->clause('order') || $query->order([$query->connection()->newQuery()->select(['NULL'])]);
+			if (!$query->clause('order')) {
+				$query->order([(string)$query->connection()->newQuery()->select(['NULL'])]);
+			}
 		}
 
 		return $query;