From 5f56246efd8ae86b327835ddaf67bc0d726700a3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Apr 2012 12:06:35 +0300 Subject: Fix AR delete() for Oracle --- system/database/drivers/oci8/oci8_driver.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'system/database/drivers/oci8') 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)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b