/*public class TanngoBaseHelper extends SQLiteOpenHelper {
private static final int VERSION = 1; private static final String DATABASE_NAME = "tanngoBase.db"; public TanngoBaseHelper(Context context) { super(context, DATABASE_NAME, null, VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table" + TanngoTable.NAME + "(" + " _id integer primary key autoincrement," + TanngoTable.Columns.UUID + "," + TanngoTable.Columns.WORD + "," + TanngoTable.Columns.MEAN + "," + TanngoTable.Columns.DATE + "," + TanngoTable.Columns.SOLVED + ")" ); } @Override public void nUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { }
}*/public class TanngoBaseHelper extends SQLiteOpenHelper {
private static final int VERSION = 2; private static final String DATABASE_NAME = "tanngoBase.db"; public TanngoBaseHelper(Context context) { super(context, DATABASE_NAME, null, VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table " + TanngoTable.NAME + "(" + " _id integer primary key autoincrement, " + TanngoTable.Columns.UUID + ", " + TanngoTable.Columns.WORD + ", " + TanngoTable.Columns.MEAN + ", " + TanngoTable.Columns.DATE + ", " + TanngoTable.Columns.SOLVED + ")" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { }
}
那个VERSION标识了当前数据库版本,可以在onUpgrade中进行数据库字段的修改和扩充。
VERSION代表了数据库的版本,在更新数据库的时候发生改变。 可能会有软件版本不同 他们的数据库版本也是不同的,数据库里的字段也是不同的