summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-18 12:30:45 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-18 12:30:45 +0200
commit777153d8362ed884fc3d47ea4a5e1fa0f1ce8ca9 (patch)
tree26ae7b9c855e635a50aa4b2bc8ad188fbb792530
parentfad14b25148ca7202a036dc2b764feb0c8518838 (diff)
Changed limit() and offset() to ignore NULL values
-rw-r--r--system/database/DB_query_builder.php10
-rw-r--r--user_guide_src/source/changelog.rst2
2 files changed, 5 insertions, 7 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 4c54b1c0a..d21f15066 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1042,12 +1042,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function limit($value, $offset = NULL)
{
- $this->qb_limit = (int) $value;
-
- if ( ! empty($offset))
- {
- $this->qb_offset = (int) $offset;
- }
+ is_null($value) OR $this->qb_limit = (int) $value;
+ empty($offset) OR $this->qb_offset = (int) $offset;
return $this;
}
@@ -1062,7 +1058,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
public function offset($offset)
{
- $this->qb_offset = (int) $offset;
+ empty($offset) OR $this->qb_offset = (int) $offset;
return $this;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 67b78bf8b..da608b162 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -80,6 +80,8 @@ Release Date: Not Released
- Added an optional parameter that allows to disable escaping (useful for custom fields) for methods join(), order_by(), where_in(), or_where_in(), where_not_in(), or_where_not_in().
- Added support for join() with multiple conditions.
- Added support for USING in join().
+ - Changed limit() to ignore NULL values instead of always casting to integer.
+ - Changed offset() to ignore empty values instead of always casting to integer.
- Improved support for the MySQLi driver, including:
- OOP style of the PHP extension is now used, instead of the procedural aliases.
- Server version checking is now done via ``mysqli::$server_info`` instead of running an SQL query.