关闭与SQLite数据库相关联的所有游标 [英] Closing all cursors associated with sqlite database
问题描述
有没有关闭已用于查询某个数据库所有游标的方法?
Is there a way of closing all cursors that have been used to query a certain database?
我不具备的变量名,需要一个close.all之类code的。
I Don´t have the variable names, need a "close.all" sort of code.
假设,而不是你自己的code你有这些光标,通过外部库(解析离线数据存储)管理的:
Suppose you have some of these cursors, managed by external libraries (Parse Offline DataStore), not by your own code:
Cursor cursorvariablenames = database.rawQuery
("SELECT " + NAME + " FROM " + TABLE_NAME + " WHERE " + DAY_PERIOD[day_counter * 2]
+ " = '" + day + "' AND " + DAY_PERIOD[day_counter * 2 + 1] + " = "
+ Integer.toString(period), null);
我知道sqlite的DB =(ParseOfflineStore)的名称,并希望关闭正在使用或指向朝着这个数据库的所有游标。
I know the name of the sqlite DB = (ParseOfflineStore), and would like to close all cursors that are used by or point toward this DB.
推荐答案
我会回答我的问题,以这样的:有没有办法解决的视线,无论从解析队没有回应。
I'll answer my own question to this: There's no solution at sight, no response from Parse team neither.
我现在用的共享preferences 文件来处理本地数据喂小部件。任何使用解析本地数据存储中会产生成光标误差随着时间的推移。
I am now using SharedPreferences file to handle local data to feed the widget. Any use of Parse Local Datastore will yield into cursor errors over time.
希望这有助于有人遇到同样的问题,而主屏幕小部件和/或服务查询本地SQLite数据库。
Hope this help someone experiencing the same problem while querying local sqlite databases from homescreen widgets and/or services.
这篇关于关闭与SQLite数据库相关联的所有游标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!