summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_active_rec.php18
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php17
-rw-r--r--system/database/drivers/interbase/interbase_driver.php7
-rw-r--r--system/database/drivers/mssql/mssql_driver.php7
-rw-r--r--system/database/drivers/mysql/mysql_driver.php17
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php17
-rw-r--r--system/database/drivers/oci8/oci8_driver.php5
-rw-r--r--system/database/drivers/odbc/odbc_driver.php7
-rw-r--r--system/database/drivers/pdo/pdo_driver.php7
-rw-r--r--system/database/drivers/postgre/postgre_driver.php17
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php24
-rw-r--r--system/database/drivers/sqlite3/sqlite3_driver.php43
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php7
-rw-r--r--user_guide_src/source/changelog.rst2
14 files changed, 95 insertions, 100 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index f5dcd3dd7..a19f9bedd 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1762,6 +1762,24 @@ abstract class CI_DB_active_record extends CI_DB_driver {
// --------------------------------------------------------------------
/**
+ * 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;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Get DELETE query string
*
* Compiles a delete query string and returns the sql
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index cf9a351d2..b2ccec2d4 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -549,23 +549,6 @@ class CI_DB_cubrid_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
- * This function maps to "DELETE FROM table"
- *
- * @param string the table name
- * @return string
- */
- protected function _truncate($table)
- {
- return "TRUNCATE ".$table;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 9d01832a1..fd164cd07 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -429,15 +429,16 @@ class CI_DB_interbase_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
- * This public function maps to "DELETE FROM table"
+ *
+ * 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 $this->_delete($table);
+ return 'DELETE FROM '.$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 3604e80fb..055c9decb 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -469,15 +469,16 @@ 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
- * This function maps to "DELETE FROM table"
+ *
+ * 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;
+ return 'TRUNCATE TABLE '.$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 7f43be5f4..7afa5acd4 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -571,23 +571,6 @@ class CI_DB_mysql_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
- * This function maps to "DELETE FROM table"
- *
- * @param string the table name
- * @return string
- */
- protected function _truncate($table)
- {
- return 'TRUNCATE '.$table;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 26a77aa75..00bc726c5 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -540,23 +540,6 @@ class CI_DB_mysqli_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
- * This function maps to "DELETE FROM table"
- *
- * @param string the table name
- * @return string
- */
- protected function _truncate($table)
- {
- return 'TRUNCATE '.$table;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 65ae1eaf3..756d93a16 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -648,8 +648,9 @@ class CI_DB_oci8_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
- * This function maps to "DELETE FROM table"
+ *
+ * If the database does not support the truncate() command,
+ * then this method maps to 'DELETE FROM table'
*
* @param string the table name
* @return string
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index bab8f5865..de5af7bd2 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -408,15 +408,16 @@ class CI_DB_odbc_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
- * This function maps to "DELETE FROM table"
+ *
+ * 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 $this->_delete($table);
+ return 'DELETE FROM '.$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 9a08f9d4c..aec39c819 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -722,15 +722,16 @@ class CI_DB_pdo_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
- * This function maps to "DELETE FROM table"
+ *
+ * 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 $this->_delete($table);
+ return 'DELETE FROM '.$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 75e545e10..f95ff560f 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -547,23 +547,6 @@ class CI_DB_postgre_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
- * This function maps to "DELETE FROM table"
- *
- * @param string the table name
- * @return string
- */
- protected function _truncate($table)
- {
- return "TRUNCATE ".$table;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 627420295..9c611f2fd 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -428,18 +428,36 @@ class CI_DB_sqlite_driver extends CI_DB {
// --------------------------------------------------------------------
/**
+ * Replace statement
+ *
+ * Generates a platform-specific replace string from the supplied data
+ *
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ protected function _replace($table, $keys, $values)
+ {
+ return 'INSERT OR '.parent::_replace($table, $keys, $values);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Truncate statement
*
* Generates a platform-specific truncate string from the supplied data
- * If the database does not support the truncate() command
- * This function maps to "DELETE FROM table"
+ *
+ * If the database does not support the truncate() command,
+ * then this function maps to 'DELETE FROM table'
*
* @param string the table name
* @return string
*/
protected function _truncate($table)
{
- return $this->_delete($table);
+ return 'DELETE FROM '.$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php
index 7d6de80bf..c78f0c4fe 100644
--- a/system/database/drivers/sqlite3/sqlite3_driver.php
+++ b/system/database/drivers/sqlite3/sqlite3_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -16,12 +16,12 @@
* through the world wide web, please send an email to
* licensing@ellislab.com so we can send you a copy immediately.
*
- * @package CodeIgniter
- * @author EllisLab Dev Team
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
- * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
- * @link http://codeigniter.com
- * @since Version 1.0
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
+ * @link http://codeigniter.com
+ * @since Version 1.0
* @filesource
*/
@@ -32,11 +32,12 @@
* creates dynamically based on whether the active record
* class is being used or not.
*
- * @package CodeIgniter
+ * @package CodeIgniter
* @subpackage Drivers
* @category Database
- * @author Andrey Andreev
- * @link http://codeigniter.com/user_guide/database/
+ * @author Andrey Andreev
+ * @link http://codeigniter.com/user_guide/database/
+ * @since Version 3.0
*/
class CI_DB_sqlite3_driver extends CI_DB {
@@ -399,18 +400,36 @@ class CI_DB_sqlite3_driver extends CI_DB {
// --------------------------------------------------------------------
/**
+ * Replace statement
+ *
+ * Generates a platform-specific replace string from the supplied data
+ *
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ protected function _replace($table, $keys, $values)
+ {
+ return 'INSERT OR '.parent::_replace($table, $keys, $values);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* 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"
+ *
+ * If the database does not support the truncate() command, then,
+ * then this method maps to 'DELETE FROM table'
*
* @param string the table name
* @return string
*/
protected function _truncate($table)
{
- return $this->_delete($table);
+ return 'DELETE FROM '.$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index df2dcb60d..f75024799 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -456,15 +456,16 @@ 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
- * This function maps to "DELETE FROM table"
+ *
+ * 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;
+ return 'TRUNCATE TABLE '.$table;
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 3525b530f..81644ecac 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -90,6 +90,7 @@ Release Date: Not Released
- Generally improved for speed and cleaned up all of its components.
- *Row* result methods now really only fetch only the needed number of rows, instead of depending entirely on result().
- num_rows() is now only called explicitly by the developer and no longer re-executes statements.
+ - Added replace() support for SQLite.
- Libraries
@@ -196,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
=============