]> source.dussan.org Git - nextcloud-server.git/commitdiff
make tag filter compatible with sqlite
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Tue, 23 Aug 2011 09:43:27 +0000 (11:43 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Tue, 23 Aug 2011 09:43:27 +0000 (11:43 +0200)
apps/bookmarks/ajax/updateList.php

index 1217a64c6e1a6996e3e8e23b99dfd9ee4dc7554b..7be14b9609bc697507edfae6d72e011436b05cf6 100644 (file)
@@ -36,11 +36,16 @@ if( !OC_User::isLoggedIn()){
 }
 
 $params=array(OC_User::getUser());
+$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
 
 //Filter for tag?
 $filterTag = isset($_GET["tag"]) ? urldecode($_GET["tag"]) : false;
 if($filterTag){
-       $sqlFilterTag = "HAVING INSTR (tags, ?) > 0";
+       if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
+               $sqlFilterTag = "HAVING tags LIKE '%' || ? || '%'";
+       } else {
+               $sqlFilterTag = "HAVING INSTR (tags, ?) > 0";
+       } 
        $params[] = $filterTag;
 } else {
        $sqlFilterTag = '';
@@ -49,7 +54,6 @@ if($filterTag){
 $offset = isset($_GET["page"]) ? intval($_GET["page"]) * 10 : 0;
 $params[] = $offset;
 
-$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
 if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
        $_gc_separator = ", ' '";
 } else {