Skip to content

Commit

Permalink
transaction(dg) template method on class Database.
Browse files Browse the repository at this point in the history
  • Loading branch information
codekitchen committed Jun 2, 2009
1 parent d1a45c7 commit db076a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mordor/common/sqlite.d
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ class Database
return new ResultSet(this, stmt);
}

T transaction(T)(T delegate() dg)
{
begin();
scope(success) commit();
scope(failure) rollback();
return dg();
}

void begin()
{
executeUpdate("BEGIN");
Expand Down

0 comments on commit db076a7

Please sign in to comment.