summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-02-26 18:19:58 +0100
committerFlorian Pritz <bluewind@xssn.at>2010-02-26 18:19:58 +0100
commit1d5ab0d38219163e07cc0923d30349e3bc82b9d7 (patch)
tree35af55c294cd1d651f539dc566a319d909ace2de
parentd3e4293d43ca8bd63e6fd2a10d6363485fe2eb6c (diff)
add LIMITs to (maybe) speedup queries
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rw-r--r--system/application/controllers/file.php2
-rw-r--r--system/application/models/file_mod.php9
2 files changed, 7 insertions, 4 deletions
diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php
index 96165eb55..ac8f15452 100644
--- a/system/application/controllers/file.php
+++ b/system/application/controllers/file.php
@@ -218,7 +218,7 @@ class File extends Controller {
unlink($file);
$this->db->query('DELETE FROM files WHERE hash = ?', array($row['hash']));
} else {
- $this->db->query('DELETE FROM files WHERE id = ?', array($row['id']));
+ $this->db->query('DELETE FROM files WHERE id = ? LIMIT 1', array($row['id']));
}
}
}
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) {