Esempio n. 1
0
  public void rollback_transaction_after_exception() {
    using (var db = new session().start_transaction()) {
      db.execute("update users set email = '*****@*****.**' where id = 5");
      throw new Exception("This exception should cause rollback");
      db.commit();
    }
    
    var user = new session()
      .one<user>("where id = 5");

    assert(user.email == "*****@*****.**");
  }
Esempio n. 2
0
  public void commit_transaction() {
    using (var db = new session().start_transaction()) {
      db.execute("update users set email = '*****@*****.**' where id = 4");
      db.commit();
    }

    var user = new session()
      .param("@id", 4)
      .one<user>("where id=@id");

    assert(user.email == "*****@*****.**");
  }