我在 Android 应用程序中使用 SQLite 数据库,有时在调用 database.rawQuery(String sql, String[] selectionArgs) 时会出现 SQLiteMisuseException。 这很奇怪,因为这个异常是随机出现的,我真的不知道为什么。
关于异常的更多信息:
android.database.sqlite.SQLiteMisuseException: library routine called out of sequence: , while compiling: SELECT PromoGuid, PromoViewCount FROM TablePromoView
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1324)
at com.my.application....
有人遇到过这个错误吗?你能帮我解决一下吗?
提前致谢
PS:抱歉我的英语不好,我来自比利时
最佳答案
check this link .确保在开始其他 Activity 等之前关闭所有打开的数据库连接/游标。
关于调用 database.rawQuery 时出现 Android SQLiteMisuseException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8564609/