summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-01 15:18:42 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-01 15:18:42 +0100
commit67f71a415c4bd7a206fcfc1a6007d74af4590883 (patch)
tree4ce4dc197e9f56fa0cb6bedfe5fe559bd9427209
parent850f601edef5de5680510c900c3e613bc346fe1b (diff)
Fix issue #1036 (is_write_type() returned FALSE for RENAME, OPTIMIZE queries)
-rw-r--r--system/database/DB_driver.php13
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 5 insertions, 9 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 6352c731e..8ab5415ea 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -645,17 +645,12 @@ class CI_DB_driver {
/**
* Determines if a query is a "write" type.
*
- * @access public
* @param string An SQL query string
- * @return boolean
+ * @return bool
*/
- function is_write_type($sql)
+ public function is_write_type($sql)
{
- if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))
- {
- return FALSE;
- }
- return TRUE;
+ return (bool) preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|OPTIMIZE)\s+/i', $sql);
}
// --------------------------------------------------------------------
@@ -1443,4 +1438,4 @@ class CI_DB_driver {
}
/* End of file DB_driver.php */
-/* Location: ./system/database/DB_driver.php */ \ No newline at end of file
+/* Location: ./system/database/DB_driver.php */
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5cfb4014c..1687d90ab 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -117,6 +117,7 @@ Bug fixes for 3.0
- Fixed a bug (#129) - ODBC's num_rows() returned -1 in some cases, due to not all subdrivers supporting the odbc_num_rows() function.
- Fixed a bug (#153) - E_NOTICE being generated by getimagesize() in the :doc:`File Uploading Library <libraries/file_uploading>`.
- Fixed a bug (#611) - SQLSRV's _error_message() and _error_number() methods used to issue warnings when there's no actual error.
+- Fixed a bug (#1036) - is_write_type() method in the :doc:`Database Library <database/index>` didn't return TRUE for RENAME and OPTIMIZE queries.
Version 2.1.1
=============