Skip to content

Commit

Permalink
Merge branch '6.x' into 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 28, 2021
2 parents 3c2a0b8 + 09bf145 commit 2c4fc81
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ protected function compileColumns(Builder $query, $columns)
// If there is a limit on the query, but not an offset, we will add the top
// clause to the query, which serves as a "limit" type clause within the
// SQL Server system similar to the limit keywords available in MySQL.
if ($query->limit > 0 && $query->offset <= 0) {
$select .= 'top '.$query->limit.' ';
if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) {
$select .= 'top '.((int) $query->limit).' ';
}

return $select.$this->columnize($columns);
Expand Down Expand Up @@ -222,10 +222,10 @@ protected function compileTableExpression($sql, $query)
*/
protected function compileRowConstraint($query)
{
$start = $query->offset + 1;
$start = (int) $query->offset + 1;

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

return "between {$start} and {$finish}";
}
Expand Down

0 comments on commit 2c4fc81

Please sign in to comment.