diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-03-30 10:29:56 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-03-30 10:29:56 +0200 |
commit | 3396d531e2f3864d06860cdbdf7320bc121f77f1 (patch) | |
tree | cbc9ff0e1e574db87bbb3a31c783eb4dcca86dae /system/database/DB.php | |
parent | 64bfa0634c991ef98ec3d2d44d862ea99d839854 (diff) | |
parent | 2c4c5e1946293e1c7a834112a8d271e890cc1c71 (diff) |
Merge pull request #1228 from toopay/database-test
Multiple database drivers testing
Diffstat (limited to 'system/database/DB.php')
-rwxr-xr-x | system/database/DB.php | 17 |
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'; |