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

Correct pg support for finding bookmark

This commit is contained in:
Brice Maron 2012-07-02 09:43:37 +02:00
parent de3d39f9bc
commit 15a515b92a

View File

@ -62,11 +62,17 @@ class OC_Bookmarks_Bookmarks{
* @return void
*/
public static function findBookmarks($offset, $sqlSortColumn, $filter, $filterTagOnly){
//$CONFIG_DBTYPE = OCP\Config::getSystemValue( 'dbtype', 'sqlite' );
$CONFIG_DBTYPE = OCP\Config::getSystemValue( 'dbtype', 'sqlite' );
$limit = 10;
$params=array(OCP\USER::getUser());
//@TODO replace GROUP_CONCAT for postgresql
$sql = "SELECT *, (select GROUP_CONCAT(tag) from *PREFIX*bookmarks_tags where bookmark_id = b.id) as tags
if($CONFIG_DBTYPE == 'pgsql') {
$group_fct = 'array_agg(tag)';
}
else {
$group_fct = 'GROUP_CONCAT(tag)';
}
$sql = "SELECT *, (select $group_fct from *PREFIX*bookmarks_tags where bookmark_id = b.id) as tags
FROM *PREFIX*bookmarks b
WHERE user_id = ? ";