summaryrefslogtreecommitdiffstats
path: root/system/database
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 /system/database
parenta6fe36eb42e5d8df8336f8c711ff8a6e0ee509e7 (diff)
Fixed MSSQL and SQLSrv truncate()
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/mssql/mssql_driver.php18
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php18
2 files changed, 36 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