1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-02-18 15:54:28 +01:00

Correct offset for postgresql

This commit is contained in:
Brice Maron 2012-10-11 16:45:00 +02:00
parent f2c0cbabd5
commit 7397ebd1c2

View File

@ -32,7 +32,6 @@ class OC_Bookmarks_Bookmarks{
$params = array_merge($filterTags, $filterTags); $params = array_merge($filterTags, $filterTags);
array_unshift($params, OCP\USER::getUser()); array_unshift($params, OCP\USER::getUser());
$not_in = ''; $not_in = '';
if(!empty($filterTags) ) { if(!empty($filterTags) ) {
$exist_clause = " AND exists (select 1 from *PREFIX*bookmarks_tags $exist_clause = " AND exists (select 1 from *PREFIX*bookmarks_tags
t2 where t2.bookmark_id = t.bookmark_id and tag = ?) "; t2 where t2.bookmark_id = t.bookmark_id and tag = ?) ";
@ -43,8 +42,8 @@ class OC_Bookmarks_Bookmarks{
$sql = 'SELECT tag, count(*) as nbr from *PREFIX*bookmarks_tags t '. $sql = 'SELECT tag, count(*) as nbr from *PREFIX*bookmarks_tags t '.
' WHERE EXISTS( SELECT 1 from *PREFIX*bookmarks bm where t.bookmark_id = bm.id and user_id = ?) '. ' WHERE EXISTS( SELECT 1 from *PREFIX*bookmarks bm where t.bookmark_id = bm.id and user_id = ?) '.
$not_in. $not_in.
' group by tag Order by nbr DESC LIMIT '.$offset.', '.$limit; ' group by tag Order by nbr DESC LIMIT '.$limit.' OFFSET '.$offset;
$query = OCP\DB::prepare($sql); $query = OCP\DB::prepare($sql);
$tags = $query->execute($params)->fetchAll(); $tags = $query->execute($params)->fetchAll();
return $tags; return $tags;