Android cannot upgrade my database when first query is using readonly database

前端 未结 3 1427
轻奢々
轻奢々 2021-01-16 06:14

So I\'ve been so far relying heavily on the automated (well almost) onCreate / onUpgrade method of my SQLite database. It was all work

相关标签:
3条回答
  • 2021-01-16 06:33

    In my case there was a syntax error: one of the fields was a SQL reserved word. But to see that error message about the syntax I had to add

    dbHelper.getWritableDatabase().close();
    

    to MainActivity.onCreate().

    0 讨论(0)
  • 2021-01-16 06:41

    Workaround I used: have a method at the "start" of my application that does just getWritableDatabase() and closes it, so that it triggers all the needed create / update if necessary.

    0 讨论(0)
  • 2021-01-16 06:52

    Some time column name is repeating during create statement..

    create table tbl (Col1 TEXT,Col2 INTEGER,Col3 INTEGER,Col1 INTEGER,Col5 INTEGER); 
    

    Like here Col1 is repeat twice...

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