简体   繁体   中英

How to upgrade\convert a Sqlite database on an Android device

I have a user who reports that he has a HTC Desire running Android v 2.2.2 and a HTC Flyer tablet running Android v 2.3.4.

Any databases (Sqlite) that are created by my app on his tablet cannot be read on his phone. Any databases created on his phone can be read on either device. (Hope I got that the right way round but hopefully you get the idea)

I guess this is because of different versions of the database engine. Is there a way to handle this and to convert one database to the same format as the other allowing both devices to open the database regardless of which device created it?

I did find this link which suggest using the command line to do the conversion. Not very helpful on a device though. http://www.sqlite.org/formatchng.html

It seems the problem is that WAL mode was turned on. http://www.sqlite.org/wal.html

WAL is supposed to default to Off (and on all my Nexus devices it does).

I can only assume some manufacturers thought it would be fun to default the setting to On and therefore make the databases incompatible with earlier versions.

Wal mode is not supported in any version of SQLite earlier than 3.7.0 and if attempted, databases cannot be opened if this flag is set on them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM