diff options
author | Derek Allard <derek.allard@ellislab.com> | 2007-12-19 15:49:29 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2007-12-19 15:49:29 +0100 |
commit | da6d240d7b8615b5ae628496c42cb216658eb6e4 (patch) | |
tree | a209e2971a8dbc524ef08deb58aa55a84fc504ae /system/database/DB_active_rec.php | |
parent | c6935514fbe8ead6aed2ee711e1ce106913a9f47 (diff) |
Added support for limit() into update() statements in Active Record.
Diffstat (limited to 'system/database/DB_active_rec.php')
-rw-r--r-- | system/database/DB_active_rec.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 473685874..4a88bd816 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -826,7 +826,7 @@ class CI_DB_active_record extends CI_DB_driver { * @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 @@ class CI_DB_active_record extends CI_DB_driver { {
$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 @@ class CI_DB_active_record extends CI_DB_driver { $this->ar_set = array();
$this->ar_from = array();
$this->ar_where = array();
+ $this->ar_limit = FALSE;
}
}
|