summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/mysql/mysql_driver.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 9c630d0d6..d9c1a98a6 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -147,9 +147,27 @@ class CI_DB_mysql_driver extends CI_DB {
: FALSE;
}
- if ($this->stricton && is_resource($this->conn_id))
+ if (isset($this->stricton) && is_resource($this->conn_id))
{
- $this->simple_query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
+ if ($this->stricton)
+ {
+ $this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
+ }
+ else
+ {
+ $this->simple_query(
+ 'SET SESSION sql_mode =
+ REPLACE(
+ REPLACE(
+ REPLACE(@@sql_mode, "STRICT_ALL_TABLES,", ""),
+ ",STRICT_ALL_TABLES",
+ ""
+ ),
+ "STRICT_ALL_TABLES",
+ ""
+ )'
+ );
+ }
}
return $this->conn_id;