android数据库
private static class DBOpenHelper extends SQLiteOpenHelper { // 继承SQLITEOpenHelper的静态内部类 private static final String DB_CREATE = "create table " + DB_TABLE + " (" + KEY_ID + " integer primary key autoincrement, " + KEY_NAME + " text not null, " + KEY_AGE + " integer," + KEY_HEIGHT + " float);"; //SQL建表语句 public DBOpenHelper(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version); } @Override public void onCreate(SQLiteDatabase _db) { // 创建数据库 // db.execSQL(DB_NAME); _db.execSQL(DB_CREATE); } @Override public void onUpgrade(SQLiteDatabase _db, int oldVersion, int newVersion) { // 更新数据库 _db.execSQL("DROP TABLE IF EXISTS " + DB_TABLE); onCreate(_db); } }