summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-05 15:20:50 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-05 15:20:50 +0200
commit6d83cde3ba326f400b11475c51a4becec51c2de8 (patch)
tree00e90f37dfade925df350ee7034f182d2c6cb6dc
parenta6fe36eb42e5d8df8336f8c711ff8a6e0ee509e7 (diff)
Fixed MSSQL and SQLSrv truncate()
-rw-r--r--system/database/drivers/mssql/mssql_driver.php18
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php18
-rw-r--r--user_guide_src/source/changelog.rst1
3 files changed, 37 insertions, 0 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index b1d2716ba..055c9decb 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -466,6 +466,24 @@ class CI_DB_mssql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
+ * Truncate statement
+ *
+ * Generates a platform-specific truncate string from the supplied data
+ *
+ * If the database does not support the truncate() command,
+ * then this method maps to 'DELETE FROM table'
+ *
+ * @param string the table name
+ * @return string
+ */
+ protected function _truncate($table)
+ {
+ return 'TRUNCATE TABLE '.$table;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index dd55d7e1d..f75024799 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -453,6 +453,24 @@ class CI_DB_sqlsrv_driver extends CI_DB {
// --------------------------------------------------------------------
/**
+ * Truncate statement
+ *
+ * Generates a platform-specific truncate string from the supplied data
+ *
+ * If the database does not support the truncate() command,
+ * then this method maps to 'DELETE FROM table'
+ *
+ * @param string the table name
+ * @return string
+ */
+ protected function _truncate($table)
+ {
+ return 'TRUNCATE TABLE '.$table;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 911996e12..81644ecac 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -197,6 +197,7 @@ Bug fixes for 3.0
- Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found.
- Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library <libraries/zip>` wasn't compatible with Windows.
- Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it.
+- Fixed a bug in MSSQL and SQLSrv's _truncate() where the TABLE keyword was missing.
Version 2.1.1
=============