summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_driver.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-12-19 15:49:29 +0100
committerDerek Allard <derek.allard@ellislab.com>2007-12-19 15:49:29 +0100
commitda6d240d7b8615b5ae628496c42cb216658eb6e4 (patch)
treea209e2971a8dbc524ef08deb58aa55a84fc504ae /system/database/drivers/mysql/mysql_driver.php
parentc6935514fbe8ead6aed2ee711e1ce106913a9f47 (diff)
Added support for limit() into update() statements in Active Record.
Diffstat (limited to 'system/database/drivers/mysql/mysql_driver.php')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 2d91c5927..aaa9cc635 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -439,14 +439,16 @@ class CI_DB_mysql_driver extends CI_DB {
* @param array the where clause
* @return string
*/
- function _update($table, $values, $where)
+ function _update($table, $values, $where, $limit = FALSE)
{
foreach($values as $key => $val)
{
$valstr[] = $key." = ".$val;
}
+
+ $limit = (!$limit) ? '' : ' LIMIT '.$limit;
- return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where);
+ return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where).$limit;
}
// --------------------------------------------------------------------