Added support for limit() into update() statements in Active Record.
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 4736858..4a88bd8 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -826,7 +826,7 @@
* @param mixed the where clause
* @return object
*/
- function update($table = '', $set = NULL, $where = null)
+ function update($table = '', $set = NULL, $where = null, $limit = NULL)
{
if ( ! is_null($set))
{
@@ -860,8 +860,13 @@
{
$this->where($where);
}
+
+ if ($limit != null)
+ {
+ $this->limit($limit);
+ }
- $sql = $this->_update($this->dbprefix.$table, $this->ar_set, $this->ar_where);
+ $sql = $this->_update($this->dbprefix.$table, $this->ar_set, $this->ar_where, $this->ar_limit);
$this->_reset_write();
return $this->query($sql);
@@ -1101,6 +1106,7 @@
$this->ar_set = array();
$this->ar_from = array();
$this->ar_where = array();
+ $this->ar_limit = FALSE;
}
}