mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
commit
b566cd2535
@ -355,7 +355,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
*/
|
||||
protected function limit(Query $query)
|
||||
{
|
||||
return 'LIMIT '.$query->limit;
|
||||
return 'LIMIT '. (int) $query->limit;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,7 +366,7 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
*/
|
||||
protected function offset(Query $query)
|
||||
{
|
||||
return 'OFFSET '.$query->offset;
|
||||
return 'OFFSET '. (int) $query->offset;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -488,4 +488,4 @@ class Grammar extends \Laravel\Database\Grammar {
|
||||
return trim($sql);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class SQLServer extends Grammar {
|
||||
// it to the query here if there is not an OFFSET present.
|
||||
if ($query->limit > 0 and $query->offset <= 0)
|
||||
{
|
||||
$select .= 'TOP '.$query->limit.' ';
|
||||
$select .= 'TOP '. (int) $query->limit.' ';
|
||||
}
|
||||
|
||||
return $select.$this->columnize($query->selects);
|
||||
@ -91,14 +91,14 @@ class SQLServer extends Grammar {
|
||||
|
||||
unset($components['orderings']);
|
||||
|
||||
$start = $query->offset + 1;
|
||||
$start = (int) $query->offset + 1;
|
||||
|
||||
// Next we need to calculate the constraint that should be placed on
|
||||
// the row number to get the correct offset and limit on the query.
|
||||
// If there is not a limit, we'll just handle the offset.
|
||||
if ($query->limit > 0)
|
||||
{
|
||||
$finish = $query->offset + $query->limit;
|
||||
$finish = (int) $query->offset + (int) $query->limit;
|
||||
|
||||
$constraint = "BETWEEN {$start} AND {$finish}";
|
||||
}
|
||||
@ -137,4 +137,4 @@ class SQLServer extends Grammar {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user