transactionSync<T> method

T transactionSync<T>(
  1. T func(
    1. Database
    )
)

Implementation

T transactionSync<T>(T Function(Database) func) {
  this.execute("BEGIN TRANSACTION");
  try {
    final val = func(this);
    this.execute("COMMIT");
    return val;
  } catch (e) {
    this.execute("ROLLBACK");
    throw Exception("sqlite transaction failed: $e");
  }
}