是否允许在Android的SQLite的时间创造许多交易 [英] Does it allow to create many transactions at a time in Android SQLite
问题描述
这个文件,它说,SQLite支持交易和嵌套事务。我不知道,它有可能创造出许多不同的事务。
Reading this document, it says that SQLite supports transaction and nested transaction. I wonder that it is possible to create many different transactions.
例如:我有2个线程访问一个数据库连接,它是更多钞票,以每个线程上创建一个交易,他们没有嵌套
For example: I have 2 threads access to a database connection, is it posible to create a transaction on each thread and they are not nested?
推荐答案
使用BEGIN创建的事务... COMMIT不嵌套。对于嵌套
交易,使用保存点,并发布命令。
Transactions created using BEGIN...COMMIT do not nest. For nested transactions, use the SAVEPOINT and RELEASE commands.
我自己也使用与SQLiteDatabase类嵌套事务时,经验丰富的死锁,所以我强烈建议你远离嵌套事务了。从嵌套使用您自己锁prevent您的交易。
I myself have experienced deadlocks when using nested transactions with the SQLiteDatabase class, so I strongly encourage you to stay away from nested transactions. Use your own locks to prevent your transactions from nesting.
这篇关于是否允许在Android的SQLite的时间创造许多交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!