From 7bfe6a7c899ca3cb4910296724effb6374f7b161 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Thu, 3 May 2012 13:06:08 +0200 Subject: [PATCH] ported oc_db --- ajax/delBookmark.php | 6 +++--- ajax/editBookmark.php | 6 +++--- ajax/recordClick.php | 2 +- appinfo/migrate.php | 6 +++--- bookmarksHelper.php | 6 +++--- lib/bookmarks.php | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) mode change 100644 => 100755 appinfo/migrate.php diff --git a/ajax/delBookmark.php b/ajax/delBookmark.php index f4019294..2634bed0 100755 --- a/ajax/delBookmark.php +++ b/ajax/delBookmark.php @@ -35,7 +35,7 @@ $params=array( OCP\USER::getUser() ); -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" SELECT id FROM *PREFIX*bookmarks WHERE url LIKE ? AND user_id = ? @@ -43,7 +43,7 @@ $query = OC_DB::prepare(" $id = $query->execute($params)->fetchOne(); -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" DELETE FROM *PREFIX*bookmarks WHERE id = $id "); @@ -51,7 +51,7 @@ $query = OC_DB::prepare(" $result = $query->execute(); -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" DELETE FROM *PREFIX*bookmarks_tags WHERE bookmark_id = $id "); diff --git a/ajax/editBookmark.php b/ajax/editBookmark.php index 1b6d6d6c..db349af3 100755 --- a/ajax/editBookmark.php +++ b/ajax/editBookmark.php @@ -41,7 +41,7 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ $bookmark_id = (int)$_GET["id"]; -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" UPDATE *PREFIX*bookmarks SET url = ?, title =?, lastmodified = $_ut WHERE id = $bookmark_id @@ -54,14 +54,14 @@ $params=array( $query->execute($params); # Remove old tags and insert new ones. -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" DELETE FROM *PREFIX*bookmarks_tags WHERE bookmark_id = $bookmark_id "); $query->execute(); -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" INSERT INTO *PREFIX*bookmarks_tags (bookmark_id, tag) VALUES (?, ?) diff --git a/ajax/recordClick.php b/ajax/recordClick.php index 03d01063..2bd91f23 100755 --- a/ajax/recordClick.php +++ b/ajax/recordClick.php @@ -30,7 +30,7 @@ $RUNTIME_NOSETUPFS=true; OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('bookmarks'); -$query = OC_DB::prepare(" +$query = OCP\DB::prepare(" UPDATE *PREFIX*bookmarks SET clickcount = clickcount + 1 WHERE user_id = ? diff --git a/appinfo/migrate.php b/appinfo/migrate.php old mode 100644 new mode 100755 index c1251e81..e7e572f5 --- a/appinfo/migrate.php +++ b/appinfo/migrate.php @@ -40,10 +40,10 @@ class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{ $idmap = array(); while( $row = $results->fetchRow() ){ // Import each bookmark, saving its id into the map - $query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks(url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, ?, ?, ?)" ); + $query = OCP\DB::prepare( "INSERT INTO *PREFIX*bookmarks(url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, ?, ?, ?)" ); $query->execute( array( $row['url'], $row['title'], $this->uid, $row['public'], $row['added'], $row['lastmodified'] ) ); // Map the id - $idmap[$row['id']] = OC_DB::insertid(); + $idmap[$row['id']] = OCP\DB::insertid(); } // Now tags foreach($idmap as $oldid => $newid){ @@ -51,7 +51,7 @@ class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{ $results = $query->execute( array( $oldid ) ); while( $row = $results->fetchRow() ){ // Import the tags for this bookmark, using the new bookmark id - $query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks_tags(bookmark_id, tag) VALUES (?, ?)" ); + $query = OCP\DB::prepare( "INSERT INTO *PREFIX*bookmarks_tags(bookmark_id, tag) VALUES (?, ?)" ); $query->execute( array( $newid, $row['tag'] ) ); } } diff --git a/bookmarksHelper.php b/bookmarksHelper.php index e299f9ee..01b55111 100755 --- a/bookmarksHelper.php +++ b/bookmarksHelper.php @@ -82,7 +82,7 @@ function addBookmark($url, $title, $tags='') { } //FIXME: Detect when user adds a known URL - $query = OC_DB::prepare(" + $query = OCP\DB::prepare(" INSERT INTO *PREFIX*bookmarks (url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, 0, $_ut, $_ut) @@ -105,10 +105,10 @@ function addBookmark($url, $title, $tags='') { ); $query->execute($params); - $b_id = OC_DB::insertid('*PREFIX*bookmarks'); + $b_id = OCP\DB::insertid('*PREFIX*bookmarks'); if($b_id !== false) { - $query = OC_DB::prepare(" + $query = OCP\DB::prepare(" INSERT INTO *PREFIX*bookmarks_tags (bookmark_id, tag) VALUES (?, ?) diff --git a/lib/bookmarks.php b/lib/bookmarks.php index cbc50fdb..67b8e2f7 100755 --- a/lib/bookmarks.php +++ b/lib/bookmarks.php @@ -70,7 +70,7 @@ class OC_Bookmarks_Bookmarks{ } if($CONFIG_DBTYPE == 'pgsql' ){ - $query = OC_DB::prepare(' + $query = OCP\DB::prepare(' SELECT id, url, title, '.($filterTagOnly?'':'url || title ||').' array_to_string(array_agg(tag), \' \') as tags FROM *PREFIX*bookmarks LEFT JOIN *PREFIX*bookmarks_tags ON *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id @@ -87,7 +87,7 @@ class OC_Bookmarks_Bookmarks{ else $concatFunction = 'Concat(Concat( url, title), '; - $query = OC_DB::prepare(' + $query = OCP\DB::prepare(' SELECT id, url, title, ' .($filterTagOnly?'':$concatFunction). 'CASE WHEN *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id