SQLite的事务

来源:互联网 发布:sql 存储过程 事物 编辑:程序博客网 时间:2024/04/29 03:37

        事务(Transsaction)是数据库的逻辑工作单位,由用户定义的一组数据库操作序列组成,序列中的操作要么全做要么全不做。

Transactions can be nested. When the outer transaction is ended all of the work done in that transaction and all of the nested transactions will be committed or rolled back. The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed.

Here is the standard idiom for transactions:    db.beginTransaction();   try {     ...     db.setTransactionSuccessful();   } finally {     db.endTransaction();   }


原创粉丝点击