summaryrefslogtreecommitdiffstats
path: root/system/database/DB_driver.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2009-02-03 17:13:57 +0100
committerDerek Allard <derek.allard@ellislab.com>2009-02-03 17:13:57 +0100
commite37ab385f5c9ef8824d2ad4e31f544dbe6089095 (patch)
tree50d2cc1476bf17b415625526bd2b728e045520b4 /system/database/DB_driver.php
parent1978e12d4221fe7e61749a3206b086e5d4158f77 (diff)
DB count_all() not returns an integer always
Added some syntactical improvements within DB (braces) Fixed a bug when doing 'random' on order_by() (#5706). Fixed a bug where adding a primary key through Forge could fail (#5731). Fixed a bug when using DB cache on multiple databases (#5737).
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r--system/database/DB_driver.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index fde0a435f..dac4c8bdf 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -613,7 +613,7 @@ class CI_DB_driver {
*/
function is_write_type($sql)
{
- if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
+ if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
{
return FALSE;
}
@@ -1086,12 +1086,15 @@ class CI_DB_driver {
{
return TRUE;
}
-
- if ( ! @include(BASEPATH.'database/DB_cache'.EXT))
+
+ if ( ! class_exists('CI_DB_Cache'))
{
- return $this->cache_off();
+ if ( ! @include(BASEPATH.'database/DB_cache'.EXT))
+ {
+ return $this->cache_off();
+ }
}
-
+
$this->CACHE = new CI_DB_Cache($this); // pass db object to support multiple db connections and returned db objects
return TRUE;
}
@@ -1196,7 +1199,19 @@ class CI_DB_driver {
{
$protect_identifiers = $this->_protect_identifiers;
}
-
+
+ if (is_array($item))
+ {
+ $escaped_array = array();
+
+ foreach($item as $k => $v)
+ {
+ $escaped_array[$this->_protect_identifiers($k)] = $this->_protect_identifiers($v);
+ }
+
+ return $escaped_array;
+ }
+
// Convert tabs or multiple spaces into single spaces
$item = preg_replace('/[\t| ]+/', ' ', $item);