开发者

Why is my Sqlite3 Database on android dropping/losing tables

开发者 https://www.devze.com 2023-04-05 18:25 出处:网络
I have a problem with my Sqlite3 database. I am copying the database over when the application starts for the first time, from the assets folder into the database folder.

I have a problem with my Sqlite3 database. I am copying the database over when the application starts for the first time, from the assets folder into the database folder.

I can see in the DDMS the database file shows with the correct file size (matches with the one on my development assets folder). The database consists of 1 table with around 5000 rows.

However, when I probe the database using the ADB shell/Sqlite3 there is only on开发者_运维知识库e table (android_metadata). What happened to my table of 5000 rows? And why is the file the same size as the original?

The table also has unicode characters in it, but I don't see why that would affect it.


I use a similar method to copy a database (more tables but fewer rows) and have also found that often the database doesn't copy properly (see my question). I haven't yet found a way to ensure that the copying goes correctly, just had to put try/catch blocks around things and asking the user to clear the application data (thus triggering a re-copy) if problems occur. :/

0

精彩评论

暂无评论...
验证码 换一张
取 消