当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - In database for one user transactions are required?

问题描述:

I have desktop application and the database on desktop too (sqlite). I have all validations I the application. Transactions are required in this case?

Thanks

网友答案:

Transactions are useful to ensure that every part between begin transaction and commit have to run without an error. If a error occurs the whole query has no effect.

This has nothing to do with validation. You can get errors like timeouts.

All the work in the transaction is treated as a single unit. Either it is all performed or none of it is. Consistent means that a completed transaction leaves the database in a consistent internal state.

You can find more information on SQL Team - Introduction to Transactions

网友答案:

Transactions serve multiple purposes; even with a single user isolation can still be a concern if the application is multi-threaded or uses multiple connections for that single user, but perhaps more importantly: it provides atomicity of the update for integrity purposes. This is useful when a power-cut happens in the middle of a big update, or something else goes wrong.

分享给朋友:
您可能感兴趣的文章:
随机阅读: