示例#1
0
 @Override
 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
   Log.d(TAG, "onUpgrade()");
   for (Table table : DbMetadata.sTableList) {
     String sql = DbHelper.getDropTableStatement(table);
     db.execSQL(sql);
   }
   onCreate(db);
 }
示例#2
0
  @Override
  public void onCreate(SQLiteDatabase db) {
    Log.d(TAG, "onCreate()");

    for (Table table : DbMetadata.sTableList) {
      String sql = DbHelper.getCreateTableStatement(table);
      db.execSQL(sql);
    }

    Set<String> keySet = DbMetadata.sValueMap.keySet();
    for (String table : keySet) {
      ArrayList<ContentValues> valueList = DbMetadata.sValueMap.get(table);
      if (valueList == null) {
        continue;
      }
      for (ContentValues value : valueList) {
        db.insert(table, null, value);
      }
    }
  }