summaryrefslogtreecommitdiffstats
path: root/system/database/DB_query_builder.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r--system/database/DB_query_builder.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index c862d937d..713bf18f3 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1395,7 +1395,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$this->qb_orderby = NULL;
}
- $result = ($this->qb_distinct === TRUE)
+ $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby))
? $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')));
@@ -1498,8 +1498,10 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$affected_rows = 0;
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
{
- $this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, $batch_size)));
- $affected_rows += $this->affected_rows();
+ if ($this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, $batch_size))))
+ {
+ $affected_rows += $this->affected_rows();
+ }
}
$this->_reset_write();
@@ -1913,8 +1915,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$affected_rows = 0;
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
{
- $this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, $batch_size), $this->protect_identifiers($index)));
- $affected_rows += $this->affected_rows();
+ if ($this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, $batch_size), $this->protect_identifiers($index))))
+ {
+ $affected_rows += $this->affected_rows();
+ }
+
$this->qb_where = array();
}