Skip to content

Commit 2c4fc81

Browse files
committed
Merge branch '6.x' into 8.x
2 parents 3c2a0b8 + 09bf145 commit 2c4fc81

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php

Lines changed: 4 additions & 4 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy