1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-16 02:54:25 +02:00

- Oracle driver: fixed bug

This commit is contained in:
David Grudl
2009-04-26 20:05:09 +00:00
parent 98d43e0815
commit bba85b5441
3 changed files with 105 additions and 48 deletions

View File

@@ -320,10 +320,17 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
case 'sqlite':
case 'sqlite2':
case 'oci':
$sql .= ' LIMIT ' . $limit . ($offset > 0 ? ' OFFSET ' . (int) $offset : '');
break;
case 'oci':
if ($offset > 0) {
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t ' . ($limit >= 0 ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '') . ') WHERE "__rnum" > '. (int) $offset;
} elseif ($limit >= 0) {
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . (int) $limit;
}
break;
case 'odbc':
case 'mssql':
if ($offset < 1) {