Error when trying to update sqlite database in android

后端 未结 1 1475
栀梦
栀梦 2021-01-28 06:08

I had my database working but all the records I have inserted were for checking purpose, now I wanted to delete all the tables and creating new ones, so I tried updating the dat

相关标签:
1条回答
  • 2021-01-28 06:46

    The documentation says:

    If foreign key constraints are enabled, a DROP TABLE command performs an implicit DELETE FROM command before removing the table from the database schema. […] If the implicit DELETE FROM executed as part of a DROP TABLE command violates any immediate foreign key constraints, an error is returned and the table is not dropped.

    Remove the data in the correct order so that all intermediate steps are valid. Or just disable foreign constraint checking (db.setForeignKeyConstraintsEnabled()).

    0 讨论(0)
提交回复
热议问题