sqlite只支持1个事务? [英] sqlite only supports 1 transaction?

查看:159
本文介绍了sqlite只支持1个事务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用ADO.NET(也许我错了,我不知道它的调用)我注意到我只能开始一个连接的事务,并且一个命令似乎有command.Transaction获取我的事务数据,但不开始一个事务本身?事实上,我看到我在System.Data.SQLite中看到这个

While using ADO.NET (maybe i am wrong, i dont know what its called) i notice that i can only begin a transaction with a connection and a command seems to have command.Transaction which gets me the transaction data but doesnt start a transaction itself? Actually while looking i see this in System.Data.SQLite

// Summary:
    //     The transaction associated with this command. SQLite only supports one transaction
    //     per connection, so this property forwards to the command's underlying connection.
    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public SQLiteTransaction Transaction { get; set; }

所以SQLite只支持一个事务周期?我尝试打开另一个连接,但我的事务抛出了一个异常DB被锁定。所以我不能有多于一个连接并发?

So SQLite only supports one transaction period? i tried opening another connection but then my transaction threw an exception about the DB being locked. So i cannot have more then one connection concurrent as well?

推荐答案

每个连接一个事务,但它可以有多个一个连接(每个连接都有自己的活动事务)。

One transaction per connection, yes, but it can have more than one connection (each with its own active transaction).

更新:我不知道共享缓存模式。如果您的连接使用该模式,则只有一个事务可用于使用相同共享缓存的所有连接。请参见 SQLite共享缓存模式

Update: interesting. I didn't know about shared-cache mode. If your connection is using that mode, only one transaction is available for all the connections using the same shared-cache. See SQLite shared-cache mode.

这篇关于sqlite只支持1个事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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