summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-07 15:10:10 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-07 15:10:10 +0100
commitb98c657c100d3220a5d7ed1b6ff3ec78e227b406 (patch)
treeb336b5f3f71c657432a3da9dea16c0aafeed6a13 /system/database/drivers/mysql/mysql_driver.php
parent89576a8cf0918c4d1797f6ef34be98b5caef29d3 (diff)
Fix MySQL's 'stricton' feature
Diffstat (limited to 'system/database/drivers/mysql/mysql_driver.php')
-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;