开发者

Can I query inside a SQLite Transaction?

I'm using the SQLite3 database system in the Android library.

I need to execute a query during a transaction to see if there is a similar entry already there. If there is, I have to perform some other logic and adjustments before I add a 开发者_JAVA百科new row.

Can I execute a query within a transaction and get the result back immediately?


The answer should be yes, BUT only if you're doing queries in the same thread the transaction was started in. Even if you use the same database connection, queries fail completely if performed on different threads when you're inside transaction (despite transaction mode).


Yes it is safe to do so.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜