summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-03-30 10:29:56 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-03-30 10:29:56 +0200
commit3396d531e2f3864d06860cdbdf7320bc121f77f1 (patch)
treecbc9ff0e1e574db87bbb3a31c783eb4dcca86dae /system/database
parent64bfa0634c991ef98ec3d2d44d862ea99d839854 (diff)
parent2c4c5e1946293e1c7a834112a8d271e890cc1c71 (diff)
Merge pull request #1228 from toopay/database-test
Multiple database drivers testing
Diffstat (limited to 'system/database')
-rwxr-xr-xsystem/database/DB.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index 96e495515..0d81e40d3 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -92,16 +92,12 @@ function &DB($params = '', $active_record_override = NULL)
if (isset($dsn['query']))
{
parse_str($dsn['query'], $extra);
+
foreach ($extra as $key => $val)
{
- // booleans please
- if (strtoupper($val) === 'TRUE')
- {
- $val = TRUE;
- }
- elseif (strtoupper($val) === 'FALSE')
+ if (is_string($val) && in_array(strtoupper($val), array('TRUE', 'FALSE', 'NULL')))
{
- $val = FALSE;
+ $val = var_export($val);
}
$params[$key] = $val;
@@ -138,7 +134,12 @@ function &DB($params = '', $active_record_override = NULL)
class CI_DB extends CI_DB_driver { }
}
- require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php');
+ // Load the DB driver
+ $driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php';
+
+ if ( ! file_exists($driver_file)) show_error('Invalid DB driver');
+
+ require_once($driver_file);
// Instantiate the DB adapter
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';