Skip to content

Commit b566cd2

Browse files
committed
Merge pull request laravel#2384 from ccovey/3.0
3.0
2 parents 58d6b11 + b956efe commit b566cd2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

laravel/database/query/grammars/grammar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ protected function orderings(Query $query)
355355
*/
356356
protected function limit(Query $query)
357357
{
358-
return 'LIMIT '.$query->limit;
358+
return 'LIMIT '. (int) $query->limit;
359359
}
360360

361361
/**
@@ -366,7 +366,7 @@ protected function limit(Query $query)
366366
*/
367367
protected function offset(Query $query)
368368
{
369-
return 'OFFSET '.$query->offset;
369+
return 'OFFSET '. (int) $query->offset;
370370
}
371371

372372
/**
@@ -488,4 +488,4 @@ public function shortcut($sql, &$bindings)
488488
return trim($sql);
489489
}
490490

491-
}
491+
}

laravel/database/query/grammars/sqlserver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function selects(Query $query)
5959
// it to the query here if there is not an OFFSET present.
6060
if ($query->limit > 0 and $query->offset <= 0)
6161
{
62-
$select .= 'TOP '.$query->limit.' ';
62+
$select .= 'TOP '. (int) $query->limit.' ';
6363
}
6464

6565
return $select.$this->columnize($query->selects);
@@ -91,14 +91,14 @@ protected function ansi_offset(Query $query, $components)
9191

9292
unset($components['orderings']);
9393

94-
$start = $query->offset + 1;
94+
$start = (int) $query->offset + 1;
9595

9696
// Next we need to calculate the constraint that should be placed on
9797
// the row number to get the correct offset and limit on the query.
9898
// If there is not a limit, we'll just handle the offset.
9999
if ($query->limit > 0)
100100
{
101-
$finish = $query->offset + $query->limit;
101+
$finish = (int) $query->offset + (int) $query->limit;
102102

103103
$constraint = "BETWEEN {$start} AND {$finish}";
104104
}
@@ -137,4 +137,4 @@ protected function offset(Query $query)
137137
return '';
138138
}
139139

140-
}
140+
}

0 commit comments

Comments
 (0)