mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Fixing offsetting in paginated queries in SqlSrv
This commit is contained in:
parent
2e5bdd862b
commit
9aa2a4227f
1 changed files with 1 additions and 4 deletions
|
@ -517,9 +517,6 @@ class Sqlserver extends DboSource {
|
|||
$limit = preg_replace('/\s*offset.*$/i', '', $limit);
|
||||
preg_match('/top\s+([0-9]+)/i', $limit, $limitVal);
|
||||
$offset = intval($offset[1]) + intval($limitVal[1]);
|
||||
$rOrder = $this->__switchSort($order);
|
||||
list($order2, $rOrder) = array($this->__mapFields($order), $this->__mapFields($rOrder));
|
||||
$limit2 = str_replace('TOP', '', $limit);
|
||||
if (!$order) {
|
||||
$order = 'ORDER BY (SELECT NULL)';
|
||||
}
|
||||
|
@ -530,7 +527,7 @@ class Sqlserver extends DboSource {
|
|||
SELECT {$fields}, ROW_NUMBER() OVER ({$order}) AS {$rowCounter}
|
||||
FROM {$table} {$alias} {$joins} {$conditions} {$group}
|
||||
) AS _cake_paging_
|
||||
WHERE _cake_paging_.{$rowCounter} > {$limit2}
|
||||
WHERE _cake_paging_.{$rowCounter} >= {$offset}
|
||||
ORDER BY _cake_paging_.{$rowCounter}
|
||||
";
|
||||
return $pagination;
|
||||
|
|
Loading…
Add table
Reference in a new issue