数据库时进行原子读取

数据库时进行原子读取

本文介绍了在写入 SQLite 数据库时进行原子读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在写入 sqlite 数据库的同时读取它?

Is it possible to read from a sqlite database while it is being written to?

如何实现这一目标?

谢谢!

推荐答案

阅读本节SQLite 常见问题解答以及这个.

基本上,由于数据库不是由适当的"DBMS(即服务器)控制的,因此可以用它做什么是有限制的.例如,您必须等到一项事务完成后再开始另一项事务.幸运的是,SQLite 库会在开始对数据库执行操作之前进行一些检查,以查看该数据库是否正在被另一个库处理的连接修改.

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.

这篇关于在写入 SQLite 数据库时进行原子读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 19:37