summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryaoshanliang <1329517386@qq.com>2015-03-15 03:42:18 +0100
committeryaoshanliang <1329517386@qq.com>2015-03-15 03:42:18 +0100
commit19c2847a7c24daa0c2999b77ce82ae199afadda9 (patch)
tree2f63649d65af711acae474ff3fb7304f6aa7c0e0
parent561b820ce81d8fe3367d6ba6bf550b9cc936ea57 (diff)
add changelog and documentation for adding an optional parameter to ``count_all_results()``
-rw-r--r--system/database/DB_query_builder.php11
-rw-r--r--user_guide_src/source/changelog.rst2
2 files changed, 8 insertions, 5 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 3d4a8576c..facaf0e4c 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1353,9 +1353,10 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
* returned by an Query Builder query.
*
* @param string
+ * @param bool TRUE: resets QB values; FALSE: leave QB vaules alone
* @return int
*/
- public function count_all_results($table = '', $reset = true)
+ public function count_all_results($table = '', $reset = TRUE)
{
if ($table !== '')
{
@@ -1367,10 +1368,10 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));
- if($reset)
- {
- $this->_reset_select();
- }
+ if($reset === TRUE)
+ {
+ $this->_reset_select();
+ }
if ($result->num_rows() === 0)
{
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 99e4de53a..6faa1d752 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -176,6 +176,7 @@ Release Date: Not Released
- Added Interbase/Firebird database support via the *ibase* driver.
- Added ODBC support for ``create_database()``, ``drop_database()`` and ``drop_table()`` in :doc:`Database Forge <database/forge>`.
- Added support to binding arrays as ``IN()`` sets in ``query()``.
+ - Added an optional second parameter to ``count_all_results()``.
- :doc:`Query Builder <database/query_builder>` changes include:
@@ -192,6 +193,7 @@ Release Date: Not Released
- Methods ``insert_batch()`` and ``update_batch()`` now return an integer representing the number of rows affected by them.
- Methods ``where()``, ``or_where()``, ``having()`` and ``or_having()`` now convert trailing ``=`` and ``<>``, ``!=`` SQL operators to ``IS NULL`` and ``IS NOT NULL`` respectively when the supplied comparison value is ``NULL``.
- Added method chaining support to ``reset_query()``, ``start_cache()``, ``stop_cache()`` and ``flush_cache()``.
+ - Added an optional second parameter to ``count_all_results`` that allows leaving QB values alone.
- :doc:`Database Results <database/results>` changes include: