I want to add a column to a table in case the column doesn't exist,but SQLite doesn't seem to update the column list in Android
currently i'm using:
DB.execSQL("alter table "+table_name+" add column "+column_name+" text");
DB.rawQuery("select * from "+table_name+" limit 1",null).getColumnNames();
but the string list returned from "getColumnNames" does not contain the column I just created, so when I check again for the same column, it understands the column doesn't exist and tries to create it again, which causes a "duplicated column" exception
Thanks in advance for any help,this is my first question in SO :)
Aucun commentaire:
Enregistrer un commentaire