make tag filter compatible with sqlite

This commit is contained in:
Arthur Schiwon 2011-08-23 11:43:27 +02:00
parent 391e064e67
commit 53f0381f0f
1 changed files with 6 additions and 2 deletions

View File

@ -36,11 +36,16 @@ if( !OC_User::isLoggedIn()){
} }
$params=array(OC_User::getUser()); $params=array(OC_User::getUser());
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
//Filter for tag? //Filter for tag?
$filterTag = isset($_GET["tag"]) ? urldecode($_GET["tag"]) : false; $filterTag = isset($_GET["tag"]) ? urldecode($_GET["tag"]) : false;
if($filterTag){ 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; $params[] = $filterTag;
} else { } else {
$sqlFilterTag = ''; $sqlFilterTag = '';
@ -49,7 +54,6 @@ if($filterTag){
$offset = isset($_GET["page"]) ? intval($_GET["page"]) * 10 : 0; $offset = isset($_GET["page"]) ? intval($_GET["page"]) * 10 : 0;
$params[] = $offset; $params[] = $offset;
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
$_gc_separator = ", ' '"; $_gc_separator = ", ' '";
} else { } else {