alvin
11/3/2017 - 11:47 PM

sqliteopenhelper create table

execsql onupgrade

@Override

public final static   String CREATE_BOOK_TABLE = "CREATE TABLE books ( " +
            "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
            "title TEXT, " +
            "author TEXT, " +
            "sales INTEGER )";


public void onCreate(SQLiteDatabase db) {

    // create books table
    db.execSQL(CREATE_BOOK_TABLE);
}

public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  db.execSQL("DROP TABLE IF EXISTS" + TABLE_TODO);
  onCreate(db);
}