зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1351104 part 1 - Store the fxaDeviceId in the Clients database. r=Grisha
MozReview-Commit-ID: Hs25rAX6dIB --HG-- extra : rebase_source : 15eb9bf8c3f088e9bdc454b625620b69effce591
This commit is contained in:
Родитель
638f92e9b7
Коммит
322ba44ea6
|
@ -19,7 +19,7 @@ public class ClientsDatabase extends CachedSQLiteOpenHelper {
|
|||
|
||||
// Database Specifications.
|
||||
protected static final String DB_NAME = "clients_database";
|
||||
protected static final int SCHEMA_VERSION = 3;
|
||||
protected static final int SCHEMA_VERSION = 4;
|
||||
|
||||
// Clients Table.
|
||||
public static final String TBL_CLIENTS = "clients";
|
||||
|
@ -34,9 +34,11 @@ public class ClientsDatabase extends CachedSQLiteOpenHelper {
|
|||
public static final String COL_APPLICATION = "application";
|
||||
public static final String COL_APP_PACKAGE = "appPackage";
|
||||
public static final String COL_DEVICE = "device";
|
||||
public static final String COL_FXA_DEVICE_ID = "fxa_device_id";
|
||||
|
||||
public static final String[] TBL_CLIENTS_COLUMNS = new String[] { COL_ACCOUNT_GUID, COL_PROFILE, COL_NAME, COL_TYPE,
|
||||
COL_FORMFACTOR, COL_OS, COL_APPLICATION, COL_APP_PACKAGE, COL_DEVICE };
|
||||
COL_FORMFACTOR, COL_OS, COL_APPLICATION, COL_APP_PACKAGE,
|
||||
COL_DEVICE, COL_FXA_DEVICE_ID};
|
||||
public static final String TBL_CLIENTS_KEY = COL_ACCOUNT_GUID + " = ? AND " +
|
||||
COL_PROFILE + " = ?";
|
||||
|
||||
|
@ -78,6 +80,7 @@ public class ClientsDatabase extends CachedSQLiteOpenHelper {
|
|||
+ COL_APPLICATION + " TEXT, "
|
||||
+ COL_APP_PACKAGE + " TEXT, "
|
||||
+ COL_DEVICE + " TEXT, "
|
||||
+ COL_FXA_DEVICE_ID + " TEXT, "
|
||||
+ "PRIMARY KEY (" + COL_ACCOUNT_GUID + ", " + COL_PROFILE + "))";
|
||||
db.execSQL(createClientsTableSql);
|
||||
}
|
||||
|
@ -112,6 +115,11 @@ public class ClientsDatabase extends CachedSQLiteOpenHelper {
|
|||
db.execSQL("ALTER TABLE " + TBL_CLIENTS + " ADD COLUMN " + COL_APP_PACKAGE + " TEXT");
|
||||
db.execSQL("ALTER TABLE " + TBL_CLIENTS + " ADD COLUMN " + COL_DEVICE + " TEXT");
|
||||
}
|
||||
|
||||
if (newVersion >= 4) {
|
||||
db.execSQL("ALTER TABLE " + TBL_CLIENTS + " ADD COLUMN " + COL_FXA_DEVICE_ID + " TEXT");
|
||||
db.execSQL("CREATE INDEX idx_fxa_device_id ON " + TBL_CLIENTS + "(" + COL_FXA_DEVICE_ID + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public void wipeDB() {
|
||||
|
@ -160,6 +168,10 @@ public class ClientsDatabase extends CachedSQLiteOpenHelper {
|
|||
cv.put(COL_DEVICE, record.device);
|
||||
}
|
||||
|
||||
if (record.fxaDeviceId != null) {
|
||||
cv.put(COL_FXA_DEVICE_ID, record.fxaDeviceId);
|
||||
}
|
||||
|
||||
String[] args = new String[] { record.guid, profileId };
|
||||
int rowsUpdated = db.update(TBL_CLIENTS, cv, TBL_CLIENTS_KEY, args);
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ public class ClientsDatabaseAccessor {
|
|||
record.formfactor = RepoUtils.optStringFromCursor(cur, ClientsDatabase.COL_FORMFACTOR);
|
||||
record.os = RepoUtils.optStringFromCursor(cur, ClientsDatabase.COL_OS);
|
||||
record.device = RepoUtils.optStringFromCursor(cur, ClientsDatabase.COL_DEVICE);
|
||||
record.fxaDeviceId = RepoUtils.optStringFromCursor(cur, ClientsDatabase.COL_FXA_DEVICE_ID);
|
||||
record.appPackage = RepoUtils.optStringFromCursor(cur, ClientsDatabase.COL_APP_PACKAGE);
|
||||
record.application = RepoUtils.optStringFromCursor(cur, ClientsDatabase.COL_APPLICATION);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче