summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-05 14:38:30 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-05 14:38:30 +0200
commit17ceeae7ddd5c4eba2b1d0b25a17706b3d873346 (patch)
tree37d2607d6c589b47e3796708099dca338d804c12
parenta3bca8f8c1e4cca5d763cbfe043999cbfd07cd21 (diff)
Add replace() support for SQLite/SQLite3
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php17
-rw-r--r--system/database/drivers/sqlite3/sqlite3_driver.php34
-rw-r--r--user_guide_src/source/changelog.rst1
3 files changed, 44 insertions, 8 deletions
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 627420295..12908effb 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -428,6 +428,23 @@ 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
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php
index 7d6de80bf..199706e69 100644
--- a/system/database/drivers/sqlite3/sqlite3_driver.php
+++ b/system/database/drivers/sqlite3/sqlite3_driver.php
@@ -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,6 +400,23 @@ 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
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 3525b530f..911996e12 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