如何在 FMDB Sqlite 中复制 FMResultset
我尝试从方法返回 FMResult 对象的引用,并尝试从返回的对象访问值,但无法访问。
那么任何人都可以建议如何从方法返回 FMResult 对象并从外部访问它。
提前致谢.....
I tried to return the reference of FMResult object from a method and trying to access values from the returned object and couldn't able to access.
So can anyone suggest how to return the FMResult object from method and access it from outside.
Thanks in advance.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FMResultSet
对象非常短暂。来来去去都很快。如果您需要将结果集中的信息保留任何形式的延长时间(例如,比当前方法更长),那么您应该提取您关心的值并自行保存它们。FMResultSet
objects are pretty transient. The come and go very quickly. If you need to preserve information from a result set for any sort of extended period of time (like, longer than your current method), then you should extract the values you care about and save them yourself.您可以在其他地方使用对 FMResultSet 的引用,但它必须在运行原始查询的同一线程上使用。
此外,您只能迭代结果集一次。迭代后,它将自动关闭 sqlite 语句,您将无法再访问结果。
如果这没有给您任何线索,请发布所有相关代码。
You can use a reference to a FMResultSet elsewhere, however it must be used on the same thread where the original query was ran.
Also, you can only iterate over the result set once. After you iterate, it will automatically close the sqlite statement and you will no longer be able to access the results.
If that doesn't give you any clues, post all the relevant code.