Sqlite issues with HTC Desire HD

前端 未结 2 690
北海茫月
北海茫月 2020-12-01 13:38

Recently I have been getting a lot of complaints about the HTC Desire series and it failing while invoking sql statements. I have received reports from users with log snapsh

2条回答
  •  北海茫月
    2020-12-01 13:57

    Short answer: try removing SQLiteDatabase.OPEN_READONLY.

    Longer answer:

    The "WAL" is the write-ahead log, a relatively new feature in SQLite as I understand it. The SQLite docs on WAL say "It is not possible to open read-only WAL databases." Now, that appears to be more in the context of read-only media, but it might hold true for OPEN_READONLY.

    I'd be somewhat surprised if this helps, as it presumes that:

    • WAL is not used in standard Android
    • HTC enabled WAL in those two devices
    • Something special about your environment (e.g., the binary database you're schlepping out of assets) is causing this problem where an ordinary read-only database still works fine, as I cannot imagine that those devices would have passed compatibility tests with broken read-only database support

    But, I would think it is at least worth a shot.

    You might also consider switching from packaging the binary database to packaging the SQL statements to build/populate the database and executing them. While this will be slower (much slower if you don't use transactions), it might be less prone to database file-specific issues.

提交回复
热议问题