void ReleaseSavepoint(string savepointName).This method, as its name suggests, creates a new Savepoint within the Transaction. void AddSavepoint(string savepointName).The four extension methods defined for the SQLiteTransaction object are: Any Release or Rollback of a Savepoint will act upon the most recent one with a matching name. It is important to note that all Savepoint names are case-insensitive, and do not have to be unique. There are also two BeginTransaction extension methods for the SQLiteConnection object, that take an additional string savepointName parameter, and automatically add the named Savepoint to the newly created Transaction. There are four extension methods defined for the SQLiteTransaction object. Most of the manipulation of Savepoints is handled in extension methods on the SQLiteTransaction object. There are no special objects as far as usage of the extension is concerned. In fact, the code all exists in a single static extension class. Rather than putting it into a class library, just include the file into your projects and start using it (although you may build it into a separate library if you so desire). Using the CodeĪll of the code required is in a single. This is consistent with the way transactions work in general (with or without Savepoints). The resulting updates to the database are therefore only written when a COMMIT is issued, and the entire transaction is aborted if a ROLLBACK is issued, regardless of any Releases or Rollbacks of Savepoints within the transaction. In order to alleviate any confusion, the module is set up so that Savepoints can only be created within the context of a transaction. BackgroundĪlthough SAVEPOINT commands can be issued directly on a database connection without a current transaction, doing so implicitly creates a transaction and alters the way the RELEASE command works. The documentation explaining how all this works can be found here ^. However, it does allow for a transaction to be marked with intermediate savepoints, which emulate nested transactions to a degree. SQLite does not inherently allow nested transactions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |