mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
msSQL - also handle offset as string
When doing pagination you could get offset not as a int(eg. 10) but string(eg. "10") and it will not paginate at all. For example DataTables plugin pass offset from params and all params from http request are strings wrapped in numbers. Adding ctype_digit($offset) will also check the case.
This commit is contained in:
parent
b3d83afb81
commit
22d2564de9
1 changed files with 1 additions and 1 deletions
|
@ -411,7 +411,7 @@ class Sqlserver extends DboSource {
|
|||
$rt = ' TOP';
|
||||
}
|
||||
$rt .= sprintf(' %u', $limit);
|
||||
if (is_int($offset) && $offset > 0) {
|
||||
if ((is_int($offset) || ctype_digit($offset)) && $offset > 0) {
|
||||
$rt = sprintf(' OFFSET %u ROWS FETCH FIRST %u ROWS ONLY', $offset, $limit);
|
||||
}
|
||||
return $rt;
|
||||
|
|
Loading…
Reference in a new issue