summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-06 13:51:27 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-06 13:51:27 +0100
commit0ca9ae6ca109177eb0e80456b097a9d63412517e (patch)
tree9c170e7d16a14751f78b2297d40df767d875e4fc /system/database/drivers/pdo
parent0b1efb38293416b13aee8d1d9505e97d2efade5f (diff)
Fix #4337
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php18
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php7
2 files changed, 24 insertions, 1 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
index 51c70b630..4df2de8ba 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php
@@ -161,6 +161,24 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
+ * Determines if a query is a "write" type.
+ *
+ * @param string An SQL query string
+ * @return bool
+ */
+ public function is_write_type($sql)
+ {
+ if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#i', $sql))
+ {
+ return FALSE;
+ }
+
+ return parent::is_write_type($sql);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Show table query
*
* Generates a platform-specific query string so that the table names can be fetched
diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
index 2dd41ca87..79c3c7be0 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php
@@ -154,7 +154,12 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
*/
public function is_write_type($sql)
{
- return (bool) preg_match('/^\s*"?(SET|INSERT(?![^\)]+\)\s+RETURNING)|UPDATE(?!.*\sRETURNING)|DELETE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', str_replace(array("\r\n", "\r", "\n"), ' ', $sql));
+ if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#i', $sql))
+ {
+ return FALSE;
+ }
+
+ return parent::is_write_type($sql);
}
// --------------------------------------------------------------------