将光标还活着后,数据库关闭? [英] Will cursor be still alive after database is closed?
本文介绍了将光标还活着后,数据库关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的code是象下面这样:
My code is like below:
Cursor getResults() {
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor c = qb.query(db, projection, null, null,
null, null, null);
db.close();
return c;
}
我的问题是,db.close()被执行后,将光标C还活着,通航?
My question is, after db.close() is executed, is the cursor c still alive and navigable?
感谢。
推荐答案
没有。你不希望使用游标,而数据库关闭。当你调用关闭()
,它使对象(和它对应光标)无效。
No. You do not want to use a cursor while the database is closed. When you call close()
, it makes the object (and it's corresponding cursor) invalid.
这篇关于将光标还活着后,数据库关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文