在写入时从 sqlite 数据库中原子读取
是否可以在写入时从 sqlite 数据库中读取数据?
人们将如何实现这一目标呢?
谢谢!
Is it possible to read from a sqlite database while it is being written to?
How would one go about accomplishing this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读SQLite 常见问题解答的此部分以及这个。
基本上,由于数据库不受“适当的”DBMS(即服务器)控制,因此它的用途受到限制。例如,您必须等到一项事务完成后才能开始另一项事务。幸运的是,SQLite 库在开始对数据库执行操作之前会进行一些检查,以查看数据库是否正在被另一个库处理的连接修改。
Read this section of the SQLite FAQ's and also this one.
Basically, since the database isn't controlled by a "proper" DBMS (i.e. a server) there a limitations as to what can be done with it. For instance, you have to wait until one transaction is completed before starting another. Fortunately, the SQLite library does some checking to see if the database is being modified by another library-handled connection before it starts doing stuff to the database.