mirror of
https://github.com/owncloud/bookmarks.git
synced 2025-01-19 15:52:10 +01:00
Change manual limit and offset with OC DB function
This commit is contained in:
parent
84cb325822
commit
f017cfdbf8
@ -42,9 +42,9 @@ class OC_Bookmarks_Bookmarks{
|
||||
$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 = ?) '.
|
||||
$not_in.
|
||||
' group by tag Order by nbr DESC LIMIT '.$limit.' OFFSET '.$offset;
|
||||
' group by tag Order by nbr DESC ';
|
||||
|
||||
$query = OCP\DB::prepare($sql);
|
||||
$query = OCP\DB::prepare($sql, $limit, $offset);
|
||||
$tags = $query->execute($params)->fetchAll();
|
||||
return $tags;
|
||||
}
|
||||
@ -86,12 +86,12 @@ class OC_Bookmarks_Bookmarks{
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY ".$sqlSortColumn." DESC ";
|
||||
if($limit != -1 && $limit !== false) {
|
||||
$sql .= " LIMIT $limit ";
|
||||
$sql .= " OFFSET $offset";
|
||||
if($limit == -1 || $limit === false) {
|
||||
$limit = null;
|
||||
$offset = null;
|
||||
}
|
||||
|
||||
$query = OCP\DB::prepare($sql);
|
||||
$query = OCP\DB::prepare($sql, $limit, $offset);
|
||||
$results = $query->execute($params)->fetchAll();
|
||||
$bookmarks = array();
|
||||
foreach($results as $result){
|
||||
|
Loading…
x
Reference in New Issue
Block a user