1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-11-30 05:24:09 +01:00

Bookmark: correct search with postgres . fix #866

This commit is contained in:
Brice Maron 2013-03-25 22:49:53 +01:00
parent 4156a5caae
commit caec59e517

View File

@ -85,14 +85,15 @@ class OC_Bookmarks_Bookmarks{
$params=array(OCP\USER::getUser());
if($CONFIG_DBTYPE == 'pgsql') {
$group_fct = 'array_agg(tag)';
$sql = "select * from (SELECT *, (select array_to_string(array_agg(tag),'') from *PREFIX*bookmarks_tags where bookmark_id = b.id) as tags
FROM *PREFIX*bookmarks b
WHERE user_id = ? ) as x WHERE true ";
}
else {
$group_fct = 'GROUP_CONCAT(tag)';
}
$sql = "SELECT *, (select $group_fct from *PREFIX*bookmarks_tags where bookmark_id = b.id) as tags
$sql = "SELECT *, (select GROUP_CONCAT(tag) from *PREFIX*bookmarks_tags where bookmark_id = b.id) as tags
FROM *PREFIX*bookmarks b
WHERE user_id = ? ";
}
if($filterTagOnly) {
$exist_clause = " AND exists (select id from *PREFIX*bookmarks_tags