Skip to content

Commit 23f2398

Browse files
author
daniel danek
committed
in case of applyLimit with different offset returns always the same result.
1 parent 2bcad19 commit 23f2398

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Database/Drivers/OciDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ public function applyLimit(string &$sql, ?int $limit, ?int $offset): void
8989
} elseif ($offset) {
9090
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
9191
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
92-
. ($limit !== null ? 'WHERE ROWNUM <= ' . ($offset + $limit) : '')
93-
. ') WHERE "__rnum" > ' . $offset;
92+
. ') WHERE "__rnum" > ' . $offset
93+
. ($limit !== null ? ' AND "__rnum" <= ' . ($offset + $limit) : '');
9494

9595
} elseif ($limit !== null) {
9696
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . $limit;

0 commit comments

Comments
 (0)