From 1d5ab0d38219163e07cc0923d30349e3bc82b9d7 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 26 Feb 2010 18:19:58 +0100 Subject: add LIMITs to (maybe) speedup queries Signed-off-by: Florian Pritz --- system/application/models/file_mod.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'system/application/models') diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php index 23c3002af..769273f2f 100644 --- a/system/application/models/file_mod.php +++ b/system/application/models/file_mod.php @@ -30,7 +30,8 @@ class File_mod extends Model { $sql = ' SELECT id FROM `files` - WHERE `id` = ?'; + WHERE `id` = ? + LIMIT 1'; $query = $this->db->query($sql, array($id)); if ($query->num_rows() == 1) { @@ -45,7 +46,8 @@ class File_mod extends Model { $sql = ' SELECT hash,filename FROM `files` - WHERE `id` = ?'; + WHERE `id` = ? + LIMIT 1'; $query = $this->db->query($sql, array($id)); if ($query->num_rows() == 1) { @@ -74,7 +76,8 @@ class File_mod extends Model { $sql = ' SELECT id FROM `files` - WHERE `hash` = ?'; + WHERE `hash` = ? + LIMIT 1'; $query = $this->db->query($sql, array($hash)); if ($query->num_rows() == 0) { -- cgit v1.2.3-24-g4f1b