summaryrefslogtreecommitdiffstats
path: root/system/database/DB_active_rec.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-12-19 16:01:55 +0100
committerDerek Allard <derek.allard@ellislab.com>2007-12-19 16:01:55 +0100
commite77d77c6b4c094483a3d85b23845436b77796d07 (patch)
tree616c036495ba4f76aeb9f8f964e0f549980ef691 /system/database/DB_active_rec.php
parentda6d240d7b8615b5ae628496c42cb216658eb6e4 (diff)
Added support for limit() into update() and delete() statements in Active Record.
Diffstat (limited to 'system/database/DB_active_rec.php')
-rw-r--r--system/database/DB_active_rec.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 4a88bd816..cea9bddc5 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -856,12 +856,12 @@ class CI_DB_active_record extends CI_DB_driver {
$table = $this->ar_from[0];
}
- if ($where != null)
+ if ($where != NULL)
{
$this->where($where);
}
- if ($limit != null)
+ if ($limit != NULL)
{
$this->limit($limit);
}
@@ -884,7 +884,7 @@ class CI_DB_active_record extends CI_DB_driver {
* @param mixed the where clause
* @return object
*/
- function delete($table = '', $where = '')
+ function delete($table = '', $where = '', $limit = NULL)
{
if ($table == '')
{
@@ -905,6 +905,11 @@ class CI_DB_active_record extends CI_DB_driver {
$this->where($where);
}
+ if ($limit != NULL)
+ {
+ $this->limit($limit);
+ }
+
if (count($this->ar_where) == 0)
{
if ($this->db_debug)
@@ -914,7 +919,7 @@ class CI_DB_active_record extends CI_DB_driver {
return FALSE;
}
- $sql = $this->_delete($this->dbprefix.$table, $this->ar_where);
+ $sql = $this->_delete($this->dbprefix.$table, $this->ar_where, $this->ar_limit);
$this->_reset_write();
return $this->query($sql);
@@ -1096,7 +1101,7 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Resets the active record "write" values.
*
- * Called by the insert() or update() functions
+ * Called by the insert() update() and delete() functions
*
* @access private
* @return void