public class DbHelper extends SQLiteOpenHelper {
private static final int VERSION = 1;
private static final String DBNAME = "sql.db";
private static final String TABLE_SESSION = "sqlinfo";
private static final String CREATE_SESSION = "create table "
+ TABLE_SESSION
+ "(_id integer primary key autoincrement,"
+ "mark integer not null,"
+ "name varchar(20) not null)";
private static final String DROP_SESSION = "drop table " + TABLE_SESSION
+ " if exists";
public DbHelper(Context context, String name, CursorFactory factory,
int version) {
super(context, DBNAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_SESSION);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(DROP_SESSION);
onCreate(db);
}
}