From 7034b50d0d50612ca52273aacabd2b3189c968d8 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 9 Nov 2009 14:24:41 +0200 Subject: Limit on controller->delete --- Controller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Controller.php b/Controller.php index 5432673..458d3a3 100644 --- a/Controller.php +++ b/Controller.php @@ -254,7 +254,7 @@ class Controller /** * Delete this thing */ - protected function delete($where) + protected function delete($where, $limit = "") { if (empty($where)) { return App::error("Delete without arguments"); @@ -262,8 +262,12 @@ class Controller list($key, $value) = each($where); + if ($limit) { + $limit = " LIMIT $limit"; + } + $data = array(":{$key}" => $value); - $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = :{$key}"; + $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = :{$key} $limit"; return Db::query($sql, $data); -- cgit v1.2.3