summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli/mysqli_utility.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-12-18 16:58:03 +0100
committerDerek Allard <derek.allard@ellislab.com>2007-12-18 16:58:03 +0100
commit694b5b8ee6a40b57c91be3c5448bc8f5540d32d8 (patch)
treee79f794d18e31113ef086d76772c49c81b6b3cf1 /system/database/drivers/mysqli/mysqli_utility.php
parent04036f33f6af540ce371b1ebd1878018f0816ed8 (diff)
Added count_all_results() function to Active Record.
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_utility.php')
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 55ffcb738..c904e92d7 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -219,13 +219,30 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
$v = str_replace('\\\r', '\r', $v);
$v = str_replace('\\\t', '\t', $v);
- // Escape the data if it's not an integer type
- $val_str .= ($is_int[$i] == FALSE) ? $this->db->escape($v) : $v;
- $val_str .= ', ';
+ // Is the value NULL?
+ if ($v == NULL)
+ {
+ $val_str .= 'NULL';
+ }
+ else
+ {
+ // Escape the data if it's not an integer
+ if ($is_int[$i] == FALSE)
+ {
+ $val_str .= $this->db->escape($v);
+ }
+ else
+ {
+ $val_str .= $v;
+ }
+ }
+ // Append a comma
+ $val_str .= ', ';
$i++;
}
+ // Remove the comma at the end of the string
$val_str = preg_replace( "/, $/" , "" , $val_str);
// Build the INSERT string