Feature 1255 : improve sql

Replace in queries LIMIT N,M by LIMIT N OFFSET M

git-svn-id: http://piwigo.org/svn/trunk@4331 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
nikrou
2009-11-21 12:15:22 +00:00
parent 8c17d369fa
commit f0d0a0952c
11 changed files with 16 additions and 16 deletions
+3 -3
View File
@@ -292,7 +292,7 @@ SELECT i.*, GROUP_CONCAT(category_id) cat_ids
AND ', $where_clauses).'
GROUP BY i.id
'.$order_by.'
LIMIT '.(int)($params['per_page']*$params['page']).','.(int)$params['per_page'];
LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
@@ -683,7 +683,7 @@ SELECT id, date, author, content
WHERE '.$where_comments.'
ORDER BY date
LIMIT '.(int)($params['comments_per_page']*$params['comments_page']).
','.(int)$params['comments_per_page'];
' OFFSET '.(int)$params['comments_per_page'];
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
@@ -1398,7 +1398,7 @@ SELECT DISTINCT i.* FROM '.IMAGES_TABLE.' i
WHERE '. implode('
AND ', $where_clauses).'
'.$order_by.'
LIMIT '.(int)($params['per_page']*$params['page']).','.(int)$params['per_page'];
LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))