gain compatibility with sqlite3
This commit is contained in:
parent
0573695d05
commit
48df7a2a7d
|
@ -35,12 +35,21 @@ if( !OC_User::isLoggedIn()){
|
|||
exit();
|
||||
}
|
||||
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
||||
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
||||
$_ut = "strftime('%s','now')";
|
||||
} else {
|
||||
$_ut = "UNIX_TIMESTAMP()";
|
||||
}
|
||||
|
||||
//FIXME: Detect when user adds a known URL
|
||||
$query = OC_DB::prepare("
|
||||
INSERT IGNORE INTO *PREFIX*bookmarks
|
||||
INSERT INTO *PREFIX*bookmarks
|
||||
(url, title, description, user_id, public, added, lastmodified)
|
||||
VALUES (?, ?, ?, ?, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())
|
||||
VALUES (?, ?, ?, ?, 0, $_ut, $_ut)
|
||||
");
|
||||
|
||||
|
||||
$params=array(
|
||||
urldecode($_GET["url"]),
|
||||
urldecode($_GET["title"]),
|
||||
|
@ -50,6 +59,7 @@ $params=array(
|
|||
$query->execute($params);
|
||||
$b_id = OC_DB::insertid();
|
||||
|
||||
|
||||
if($b_id !== false) {
|
||||
$query = OC_DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks_tags
|
||||
|
|
|
@ -49,9 +49,16 @@ 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 {
|
||||
$_gc_separator = "SEPARATOR ' '";
|
||||
}
|
||||
|
||||
//FIXME: bookmarks without tags are not being retrieved
|
||||
$query = OC_DB::prepare("
|
||||
SELECT url, title, description, GROUP_CONCAT( tag SEPARATOR ' ' ) AS tags
|
||||
SELECT url, title, description, GROUP_CONCAT( tag $_gc_separator ) AS tags
|
||||
FROM *PREFIX*bookmarks, *PREFIX*bookmarks_tags
|
||||
WHERE *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
|
||||
AND *PREFIX*bookmarks.user_id = ?
|
||||
|
|
Loading…
Reference in New Issue