diff options
author | Andrey Andreev <narf@devilix.net> | 2016-01-07 13:20:21 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-01-07 13:20:21 +0100 |
commit | 1fbeb61596e0f781999dbb48c95ef3c1e3260e48 (patch) | |
tree | b843b66969ed85208b458cf58fb3c9bd04aa3a9b /system/database/drivers/oci8/oci8_driver.php | |
parent | 79b8a086187f199bb708bd56477850fbf1dd9e91 (diff) | |
parent | e8de9eb4a8bba7cde0d81fe8571bcceed7aef77b (diff) |
Merge branch 'feature/oci_offset' into 3.0-stable
Diffstat (limited to 'system/database/drivers/oci8/oci8_driver.php')
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 206924d06..994f8f33a 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -654,6 +654,14 @@ class CI_DB_oci8_driver extends CI_DB { */ protected function _limit($sql) { + if (version_compare($this->version(), '12.1', '>=')) + { + // OFFSET-FETCH can be used only with the ORDER BY clause + empty($this->qb_orderby) && $sql .= ' ORDER BY 1'; + + return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY'; + } + $this->limit_used = TRUE; return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($this->qb_offset + $this->qb_limit + 1).')' .($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1) : ''); |