--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
@@ -36,17 +36,17 @@ import android.os.Build;
import android.util.Log;
final class BrowserDatabaseHelper extends SQLiteOpenHelper {
private static final String LOGTAG = "GeckoBrowserDBHelper";
// Replace the Bug number below with your Bug that is conducting a DB upgrade, as to force a merge conflict with any
// other patches that require a DB upgrade.
- public static final int DATABASE_VERSION = 27; // Bug 826400
+ public static final int DATABASE_VERSION = 28; // Bug 760956
public static final String DATABASE_NAME = "browser.db";
final protected Context mContext;
static final String TABLE_BOOKMARKS = Bookmarks.TABLE_NAME;
static final String TABLE_HISTORY = History.TABLE_NAME;
static final String TABLE_FAVICONS = Favicons.TABLE_NAME;
static final String TABLE_THUMBNAILS = Thumbnails.TABLE_NAME;
@@ -353,16 +353,17 @@ final class BrowserDatabaseHelper extend
createOrUpdateSpecialFolder(db, Bookmarks.PLACES_FOLDER_GUID,
R.string.bookmarks_folder_places, 0);
createOrUpdateAllSpecialFolders(db);
createSearchHistoryTable(db);
createReadingListTable(db, TABLE_READING_LIST);
didCreateCurrentReadingListTable = true; // Mostly correct, in the absence of transactions.
createReadingListIndices(db, TABLE_READING_LIST);
+ createNumbersTable(db);
}
/**
* Copies the tabs and clients tables out of the given tabs.db file and into the destinationDB.
*
* @param tabsDBFile Path to existing tabs.db.
* @param destinationDB The destination database.
*/
@@ -500,16 +501,29 @@ final class BrowserDatabaseHelper extend
if (updated == 0) {
db.insert(TABLE_BOOKMARKS, Bookmarks.GUID, values);
debug("Inserted special folder: " + guid);
} else {
debug("Updated special folder: " + guid);
}
}
+ private void createNumbersTable(SQLiteDatabase db) {
+ db.execSQL("CREATE TABLE " + BrowserContract.Numbers.TABLE_NAME + " (POSITION INTEGER PRIMARY KEY)");
+
+ final String numbers = "(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)," +
+ "(10),(11),(12),(13),(14),(15),(16),(17),(18),(19)," +
+ "(20),(21),(22),(23),(24),(25),(26),(27),(28),(29)," +
+ "(30),(31),(32),(33),(34),(35),(36),(37),(38),(39)," +
+ "(40),(41),(42),(43),(44),(45),(46),(47),(48),(49)," +
+ "(50)";
+
+ db.execSQL("INSERT INTO " + BrowserContract.Numbers.TABLE_NAME + " VALUES " + numbers);
+ }
+
private boolean isSpecialFolder(ContentValues values) {
String guid = values.getAsString(Bookmarks.GUID);
if (guid == null) {
return false;
}
return guid.equals(Bookmarks.MOBILE_FOLDER_GUID) ||
guid.equals(Bookmarks.MENU_FOLDER_GUID) ||
@@ -1027,16 +1041,20 @@ final class BrowserDatabaseHelper extend
private void upgradeDatabaseFrom25to26(SQLiteDatabase db) {
debug("Dropping unnecessary indices");
db.execSQL("DROP INDEX IF EXISTS clients_guid_index");
db.execSQL("DROP INDEX IF EXISTS thumbnails_url_index");
db.execSQL("DROP INDEX IF EXISTS favicons_url_index");
}
+ private void upgradeDatabaseFrom27to28(SQLiteDatabase db) {
+ createNumbersTable(db);
+ }
+
private void createV19CombinedView(SQLiteDatabase db) {
db.execSQL("DROP VIEW IF EXISTS " + VIEW_COMBINED);
db.execSQL("DROP VIEW IF EXISTS " + VIEW_COMBINED_WITH_FAVICONS);
createCombinedViewOn19(db);
}
@Override
@@ -1110,16 +1128,19 @@ final class BrowserDatabaseHelper extend
case 25:
upgradeDatabaseFrom24to25(db);
break;
case 26:
upgradeDatabaseFrom25to26(db);
break;
+
+ case 28:
+ upgradeDatabaseFrom27to28(db);
}
}
for (Table table : BrowserProvider.sTables) {
table.onUpgrade(db, oldVersion, newVersion);
}
// Delete the obsolete favicon database after all other upgrades complete.