Skip to content

Commit 742c062

Browse files
committed
Merge branch '6.x' into 8.x
2 parents 17e445a + 8445174 commit 742c062

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Query/Grammars/SqlServerGrammar.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ protected function compileColumns(Builder $query, $columns)
6161
// If there is a limit on the query, but not an offset, we will add the top
6262
// clause to the query, which serves as a "limit" type clause within the
6363
// SQL Server system similar to the limit keywords available in MySQL.
64-
if ($query->limit > 0 && $query->offset <= 0) {
65-
$select .= 'top '.$query->limit.' ';
64+
if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) {
65+
$select .= 'top '.((int) $query->limit).' ';
6666
}
6767

6868
return $select.$this->columnize($columns);
@@ -222,10 +222,10 @@ protected function compileTableExpression($sql, $query)
222222
*/
223223
protected function compileRowConstraint($query)
224224
{
225-
$start = $query->offset + 1;
225+
$start = (int) $query->offset + 1;
226226

227227
if ($query->limit > 0) {
228-
$finish = $query->offset + $query->limit;
228+
$finish = (int) $query->offset + (int) $query->limit;
229229

230230
return "between {$start} and {$finish}";
231231
}

0 commit comments

Comments
 (0)