From c34e578c4bf993481381b1efb8f95089482135a4 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 2 Mar 2010 17:35:55 -0600 Subject: added stricton db config item to force strict mode - good for ensuring strict sql during development --- system/application/config/database.php | 3 +++ system/database/DB.php | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'system') diff --git a/system/application/config/database.php b/system/application/config/database.php index ee11c8a7a..28dfff5c9 100644 --- a/system/application/config/database.php +++ b/system/application/config/database.php @@ -26,6 +26,8 @@ | ['cachedir'] The path to the folder where cache files should be stored | ['char_set'] The character set used in communicating with the database | ['dbcollat'] The character collation used in communicating with the database +| ['stricton'] TRUE/FALSE - forces "Strict Mode" connections +| - good for ensuring strict SQL while developing | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the "default" group). @@ -49,6 +51,7 @@ $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ""; $db['default']['char_set'] = "utf8"; $db['default']['dbcollat'] = "utf8_general_ci"; +$db['default']['stricton'] = FALSE; /* End of file database.php */ diff --git a/system/database/DB.php b/system/database/DB.php index 6930411c7..a91ca08fa 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -137,6 +137,11 @@ function &DB($params = '', $active_record_override = NULL) $DB->initialize(); } + if (isset($params['stricton']) && $params['stricton'] == TRUE) + { + $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); + } + return $DB; } -- cgit v1.2.3-24-g4f1b