Android SQLite Fügen Sie die Spalte hinzu, wenn nicht existiert
Cursor cursor = database.rawQuery("SELECT * FROM MY_TABLE", null); // grab cursor for all data
int deleteStateColumnIndex = cursor.getColumnIndex("MISSING_COLUMN"); // see if the column is there
if (deleteStateColumnIndex < 0) {
// missing_column not there - add it
database.execSQL("ALTER TABLE MY_TABLE ADD COLUMN MISSING_COLUMN int null;");
}
Outrageous Okapi