是否可以更改已实例化的 SQL 查询语句SQLiteCursor
?我希望能够通过 setWindow 将给定的固定指定给CursorWindow
,SQLiteCursor
以便将来的查询放置在同一个容器中而不是打开新的容器,但是每个查询都会有所不同。所以这个想法是做类似的事情:
SQLiteDatabase db = openOrCreateDatabase(...);
CursorWindow cursorWindow = new CursorWindow("MyCursorWindow");
SQLiteQuery sqliteQueryObject;
//first query
String query = "SELECT * FROM Table";
sqliteQueryObject = SomeFunctionThatCreatesASQLiteQueryFromAStatement(query)
SQLiteCursor cursor = new SQLiteCursor(db, ...., sqliteQueryObject)
SQLiteCursor.setWindow(cursorWindow);
//subsequent queries
String query = "SELECT * FROM AnotherTable";
sqliteQueryObject = SomeFunctionThatCreatesASQLiteQueryFromAStatement(query)
SQLiteCursor.SomeFunctionToSetANewQuery(sqliteQueryObject);
SQLiteCursor.requery();
在内部,SQLiteCursor
必须在执行之前设置private SQLiteQuery mQuery
为新查询requery()
。