diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-06 13:12:15 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-06 13:12:15 +0200 |
commit | 968690491f625ddf59a5136b55ae1b9a2cf98a9a (patch) | |
tree | 6bc3eff6e8ec3ecae925ac3ff5c9542888f160f4 /system/database/DB.php | |
parent | 58dc75471c25f33b059967ffb515eedc08e86a0b (diff) | |
parent | 6683c3c872952ae16d98c89ef474e5522897592a (diff) |
Merge upstream branch and some changes for better readability
Diffstat (limited to 'system/database/DB.php')
-rwxr-xr-x | system/database/DB.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/system/database/DB.php b/system/database/DB.php index b28439b29..00d14b43e 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -53,7 +53,7 @@ function &DB($params = '', $query_builder_override = NULL) show_error('No database connection settings were found in the database config file.'); } - if ($params != '') + if ($params !== '') { $active_group = $params; } @@ -106,7 +106,7 @@ function &DB($params = '', $query_builder_override = NULL) } // No DB specified yet? Beat them senseless... - if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') + if (empty($params['dbdriver'])) { show_error('You have not selected a database type to connect to.'); } @@ -118,10 +118,17 @@ function &DB($params = '', $query_builder_override = NULL) { $query_builder = $query_builder_override; } + // Backwards compatibility work-around for keeping the + // $active_record config variable working. Should be + // removed in v3.1 + elseif ( ! isset($query_builder) && isset($active_record)) + { + $query_builder = $active_record; + } require_once(BASEPATH.'database/DB_driver.php'); - if ( ! isset($query_builder) OR $query_builder == TRUE) + if ( ! isset($query_builder) OR $query_builder === TRUE) { require_once(BASEPATH.'database/DB_query_builder.php'); if ( ! class_exists('CI_DB')) @@ -145,12 +152,12 @@ function &DB($params = '', $query_builder_override = NULL) $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; $DB = new $driver($params); - if ($DB->autoinit == TRUE) + if ($DB->autoinit === TRUE) { $DB->initialize(); } - if (isset($params['stricton']) && $params['stricton'] == TRUE) + if ( ! empty($params['stricton'])) { $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); } @@ -159,4 +166,4 @@ function &DB($params = '', $query_builder_override = NULL) } /* End of file DB.php */ -/* Location: ./system/database/DB.php */ +/* Location: ./system/database/DB.php */
\ No newline at end of file |