-2

I have created a fts database DATABASE_NAME and a table FTS_VIRTUAL_TABLE.

I can insert and select values.

If I change the name of the table in my code e.g. FTS_VIRTUAL_TABLE_NEW keeping the same database DATABASE_NAME and run the application I get a SQLiteException error: No such table: FTS_VIRTUAL_TABLE_NEW. I wonder, why, since in onCreate method the proper SQL statement exists. Shouldn't the FTS_VIRTUAL_TABLE_NEW have been created?

However if I change not only the name of the table but also the name of the database (i.e. new database) everything works. The app runs normally (of course with no values in the database initially).

I don't understand why I can't only change the name of the table keeping the same database.

4

1 回答 1

0

如果您完全更改数据库模式,则需要增加SQLiteOpenHelper构造函数中使用的数据库版本并在方法中处理升级(即删除和重新创建或修改表)onUpgrade

于 2014-09-26T17:05:25.763 回答