1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-01-18 14:52:10 +01:00

fix sql syntax for pgsql

This commit is contained in:
Thomas Müller 2014-08-20 21:19:34 +02:00
parent bd70de98ae
commit 76b830036a

View File

@ -377,9 +377,15 @@ class OC_Bookmarks_Bookmarks{
* @return null
**/
private static function addTags($bookmarkId, $tags) {
$query = OCP\DB::prepare("INSERT INTO `*PREFIX*bookmarks_tags` (`bookmark_id`, `tag`)
select ?, ? where not exists(select * from oc_bookmarks_tags where bookmark_id = ? and tag = ?)");
$sql = 'INSERT INTO `*PREFIX*bookmarks_tags` (`bookmark_id`, `tag`) select ?, ? ';
$dbtype = OCP\Config::getSystemValue( 'dbtype', 'sqlite' );
if ($dbtype === 'mysql') {
$sql .= 'from dual ';
}
$sql .= 'where not exists(select * from oc_bookmarks_tags where bookmark_id = ? and tag = ?)';
$query = OCP\DB::prepare($sql);
foreach ($tags as $tag) {
$tag = trim($tag);
if(empty($tag)) {