Reputation: 69
If you use ALTER TABLE to alter a SQLite db, will there be a conflict when the app loads again as it checks to see if the table exists with the original 4 columns and then creates it? Will it see the new table as a different one because it has extra columns, and recreate it and rewrite the old one to go back to having 4 columns again?
I have a list of student names and I want a teacher to input attendance records. I was going to use ALTER TABLE to add the date of the attendance record to the existing table that only starts with 4 columns (ID, first name, last name, teacher). Should I just create a new table without the IF NOT EXISTS code?
Thank you!
Update { var stat:SQLStatement = new SQLStatement(); stat.sqlConnection = conn; stat.text = "CREATE TABLE IF NOT EXISTS sections ( " + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "grade TEXT, " + "teacher TEXT, " + "firstname TEXT, " + "lastname TEXT, " + "gender TEXT)"; stat.addEventListener(SQLEvent.RESULT, onCreate); stat.addEventListener(SQLErrorEvent.ERROR, onDBError); stat.execute(); }
Upvotes: 1
Views: 124