Show / Hide Table of Contents

Constructor SLTransaction.SLTransaction


Overload

Begins a SQLite transaction and prepares for automatic rollback if not explicitly committed. Usage: using(var trans = new SLTransaction(db)) { ... trans.Commit(); }

public SLTransaction(sqlite db, string sql = "BEGIN", string sqlOfDispose = "ROLLBACK")
Parameters
db  (sqlite)
sql  (string)

SQL to execute now. Default "BEGIN". For nested transaction use "SAVEPOINT name".

sqlOfDispose  (string)

SQL to execute when disposing the SLTransaction variable if not called SLTransaction.Commit or SLTransaction.Rollback. Default "ROLLBACK". For nested transaction use "ROLLBACK TO name". See also: SLTransaction.SqlOfDispose.

Exceptions
SLException

Failed to execute sql.