summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/oci8/oci8_driver.php17
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 7 insertions, 11 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 6e225ee1f..a452d51ed 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -632,24 +632,19 @@ class CI_DB_oci8_driver extends CI_DB {
*
* @param string the table name
* @param array the where clause
+ * @param array the like clause
* @param string the limit clause
* @return string
*/
protected function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
- $conditions = '';
- if (count($where) > 0 OR count($like) > 0)
- {
- $conditions = "\nWHERE ".implode("\n", $this->ar_where);
+ $conditions = array();
- if (count($where) > 0 && count($like) > 0)
- {
- $conditions .= ' AND ';
- }
- $conditions .= implode("\n", $like);
- }
+ empty($where) OR $conditions[] = implode(' ', $where);
+ empty($like) OR $conditions[] = implode(' ', $like);
+ empty($limit) OR $conditions[] = 'rownum <= '.$limit;
- return 'DELETE FROM '.$table.$conditions.( ! $limit ? '' : ' LIMIT '.$limit);
+ return 'DELETE FROM '.$table.(empty($conditions) ? '' : ' WHERE '.implode(' AND ', $conditions));
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 30793111b..5ca688c2c 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -200,6 +200,7 @@ Bug fixes for 3.0
- Fixed a bug in MSSQL and SQLSrv's _truncate() where the TABLE keyword was missing.
- Fixed a bug in PDO's trans_commit() method where it failed due to an erroneous property name.
- Fixed a bug (#798) - update() used to ignore LIKE conditions that were set with like().
+- Fixed a bug in Oracle's delete() method where an erroneous SQL statement was generated when used with limit().
Version 2.1.1
=============