Bug 1250707 - Add insert method to url annotations table in BrowserProvider. r=sebastian
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 25 Feb 2016 15:28:28 -0800
changeset 322093 f55ec17dfbfafdf3b616cbf9968b835041ad3c62
parent 322092 9bba5814be611ea3155521718984bcf9ccaeb9bc
child 322094 d8316642b8021f3bc1c054dbeaa2d9ca239bdd30
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1250707
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1250707 - Add insert method to url annotations table in BrowserProvider. r=sebastian MozReview-Commit-ID: 8clkXPqmpOV
mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
@@ -503,16 +503,22 @@ public class BrowserProvider extends Sha
             }
 
             case THUMBNAILS: {
                 trace("Insert on THUMBNAILS: " + uri);
                 id = insertThumbnail(uri, values);
                 break;
             }
 
+            case URL_ANNOTATIONS: {
+                trace("Insert on URL_ANNOTATIONS: " + uri);
+                id = insertUrlAnnotation(uri, values);
+                break;
+            }
+
             default: {
                 Table table = findTableFor(match);
                 if (table == null) {
                     throw new UnsupportedOperationException("Unknown insert URI " + uri);
                 }
 
                 trace("Insert on TABLE: " + uri);
                 final SQLiteDatabase db = getWritableDatabase(uri);
@@ -1208,16 +1214,25 @@ public class BrowserProvider extends Sha
 
         DBUtils.stripEmptyByteArray(values, Thumbnails.DATA);
 
         final SQLiteDatabase db = getWritableDatabase(uri);
         beginWrite(db);
         return db.insertOrThrow(TABLE_THUMBNAILS, null, values);
     }
 
+    private long insertUrlAnnotation(final Uri uri, final ContentValues values) {
+        final String url = values.getAsString(UrlAnnotations.URL);
+        trace("Inserting url annotations for URL: " + url);
+
+        final SQLiteDatabase db = getWritableDatabase(uri);
+        beginWrite(db);
+        return db.insertOrThrow(TABLE_URL_ANNOTATIONS, null, values);
+    }
+
     private int updateOrInsertThumbnail(Uri uri, ContentValues values, String selection,
             String[] selectionArgs) {
         return updateThumbnail(uri, values, selection, selectionArgs,
                 true /* insert if needed */);
     }
 
     private int updateExistingThumbnail(Uri uri, ContentValues values, String selection,
             String[] selectionArgs) {