Merge pull request #2384 from ccovey/3.0

3.0
This commit is contained in:
Taylor Otwell 2013-10-30 06:28:51 -07:00
commit b566cd2535
2 changed files with 7 additions and 7 deletions

View File

@ -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);
}
}
}

View File

@ -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 '';
}
}
}