From d2ee6031614074da9737a57ced95ae98678b4d46 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Fri, 18 Jul 2014 16:47:10 -0700 Subject: [PATCH] Bug 1017242 - Part D: remove API 8 code from BrowserDatabaseHelper. r=margaret --- .../base/db/BrowserDatabaseHelper.java | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/mobile/android/base/db/BrowserDatabaseHelper.java b/mobile/android/base/db/BrowserDatabaseHelper.java index 64be4d8450d..daf02f056ba 100644 --- a/mobile/android/base/db/BrowserDatabaseHelper.java +++ b/mobile/android/base/db/BrowserDatabaseHelper.java @@ -74,14 +74,6 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper { private void createBookmarksTable(SQLiteDatabase db) { debug("Creating " + TABLE_BOOKMARKS + " table"); - // Android versions older than Froyo ship with an sqlite - // that doesn't support foreign keys. - String foreignKeyOnParent = null; - if (Build.VERSION.SDK_INT >= 8) { - foreignKeyOnParent = ", FOREIGN KEY (" + Bookmarks.PARENT + - ") REFERENCES " + TABLE_BOOKMARKS + "(" + Bookmarks._ID + ")"; - } - db.execSQL("CREATE TABLE " + TABLE_BOOKMARKS + "(" + Bookmarks._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + Bookmarks.TITLE + " TEXT," + @@ -95,8 +87,9 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper { Bookmarks.DATE_CREATED + " INTEGER," + Bookmarks.DATE_MODIFIED + " INTEGER," + Bookmarks.GUID + " TEXT NOT NULL," + - Bookmarks.IS_DELETED + " INTEGER NOT NULL DEFAULT 0" + - (foreignKeyOnParent != null ? foreignKeyOnParent : "") + + Bookmarks.IS_DELETED + " INTEGER NOT NULL DEFAULT 0, " + + "FOREIGN KEY (" + Bookmarks.PARENT + ") REFERENCES " + + TABLE_BOOKMARKS + "(" + Bookmarks._ID + ")" + ");"); db.execSQL("CREATE INDEX bookmarks_url_index ON " + TABLE_BOOKMARKS + "(" @@ -112,14 +105,6 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper { private void createBookmarksTableOn13(SQLiteDatabase db) { debug("Creating " + TABLE_BOOKMARKS + " table"); - // Android versions older than Froyo ship with an sqlite - // that doesn't support foreign keys. - String foreignKeyOnParent = null; - if (Build.VERSION.SDK_INT >= 8) { - foreignKeyOnParent = ", FOREIGN KEY (" + Bookmarks.PARENT + - ") REFERENCES " + TABLE_BOOKMARKS + "(" + Bookmarks._ID + ")"; - } - db.execSQL("CREATE TABLE " + TABLE_BOOKMARKS + "(" + Bookmarks._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + Bookmarks.TITLE + " TEXT," + @@ -134,8 +119,9 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper { Bookmarks.DATE_CREATED + " INTEGER," + Bookmarks.DATE_MODIFIED + " INTEGER," + Bookmarks.GUID + " TEXT NOT NULL," + - Bookmarks.IS_DELETED + " INTEGER NOT NULL DEFAULT 0" + - (foreignKeyOnParent != null ? foreignKeyOnParent : "") + + Bookmarks.IS_DELETED + " INTEGER NOT NULL DEFAULT 0, " + + "FOREIGN KEY (" + Bookmarks.PARENT + ") REFERENCES " + + TABLE_BOOKMARKS + "(" + Bookmarks._ID + ")" + ");"); db.execSQL("CREATE INDEX bookmarks_url_index ON " + TABLE_BOOKMARKS + "("