diff options
author | Andrey Andreev <narf@devilix.net> | 2016-07-29 10:42:28 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-07-29 10:42:28 +0200 |
commit | acc6481807fc9cac56b7c1de16239d98af711575 (patch) | |
tree | f672134fbe7828b45ec3e826185353704015610f | |
parent | b9f53a8d7a96bad5c6f1ff7e41a075fcb5d8fb5c (diff) |
Fix #4737
-rw-r--r-- | system/database/DB_query_builder.php | 4 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 713bf18f3..7a008eeb8 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1271,7 +1271,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ protected function _limit($sql) { - return $sql.' LIMIT '.($this->qb_offset ? $this->qb_offset.', ' : '').$this->qb_limit; + return $sql.' LIMIT '.($this->qb_offset ? $this->qb_offset.', ' : '').(int) $this->qb_limit; } // -------------------------------------------------------------------- @@ -2340,7 +2340,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { .$this->_compile_order_by(); // ORDER BY // LIMIT - if ($this->qb_limit) + if ($this->qb_limit OR $this->qb_offset) { return $this->_limit($sql."\n"); } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 0fc3138b7..4f04d4b8b 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -14,6 +14,7 @@ Bug fixes for 3.1.1 - Fixed a bug (#4732) - :doc:`Session Library <libraries/sessions>` triggered errors while writing data for a newly-created sessions with the 'memcached' driver. - Fixed a regression (#4736) - :doc:`Image Manipulation Library <libraries/image_lib>` processing via ImageMagick didn't work. +- Fixed a bug (#4737) - :doc:`Query Builder <database/query_builder>` didn't add an ``OFFSET`` when ``LIMIT`` is zero or unused. Version 3.1.0 |