是否可以以只读模式打开锁定的sqlite数据库? [英] Is it possible to open a locked sqlite database in read only mode?

查看:158
本文介绍了是否可以以只读模式打开锁定的sqlite数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用python-sqlite3打开铬站点数据(在〜/ .config / chromium / Default中),但是只要铬运行,它就会被锁定,这是可以理解的,因为可以进行交易。有没有一种方法可以以只读模式打开它,以确保在使用铬的情况下不会破坏数据库的完整性?

I'd like to open the chromium site data (in ~/.config/chromium/Default) with python-sqlite3 but it gets locked whenever chromium is running, which is understandable since transactions may be made. Is there a way to open it in read-only mode, ensuring that I can't corrupt the integrity of the db while chromium is using it?

推荐答案

我相信这取决于交易设置的锁定。

I believe it depends on the lock set by the transaction.

http://www.sqlite.org/lockingv3.html#shared_lock
http://www.sqlite.org/lang_transaction.html

SQLite独占事务将读取和写入均锁定在即时位置并且延期交易仍将允许读者。

SQLite exclusive transactions lock both read and write where immediate and deferred transactions will still allow readers.

因此,这实际上取决于Chromium使用的交易。

So it really depends on the transactions used by Chromium.

这篇关于是否可以以只读模式打开锁定的sqlite数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆