summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-09 11:06:35 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-09 11:06:35 +0200
commit5f56246efd8ae86b327835ddaf67bc0d726700a3 (patch)
tree8d90e7d72122c3baa00b7af46a7b573aa966f8af /system/database/drivers
parent00541ae101a2044c4223b7b48d97c6afefe94be4 (diff)
Fix AR delete() for Oracle
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php17
1 files changed, 6 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));
}
// --------------------------------------------------------------------