From f8f14f3da263338bb4723012229f6c373a1764c6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 10 Dec 2013 11:32:32 +0200 Subject: Fix a bug where DB() tried to set the MySQL-specific 'sql_mode' on all drivers Supersedes PR #2756 --- system/database/drivers/mysql/mysql_driver.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'system/database/drivers/mysql') diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index b94642b35..16b2f6f53 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -66,6 +66,15 @@ class CI_DB_mysql_driver extends CI_DB { */ public $delete_hack = TRUE; + /** + * Strict ON flag + * + * Whether we're running in strict SQL mode. + * + * @var bool + */ + public $stricton = FALSE; + // -------------------------------------------------------------------- /** @@ -126,6 +135,11 @@ class CI_DB_mysql_driver extends CI_DB { : FALSE; } + if ($this->stricton && is_resource($this->conn_id)) + { + $this->simple_query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); + } + return $this->conn_id; } -- cgit v1.2.3-24-g4f1b