Use the commit method in readme

This commit is contained in:
Steven Fackler 2015-12-06 17:20:47 -08:00
parent 8c7e8c5830
commit 2b7323c05e

View File

@ -131,14 +131,12 @@ The `transaction` method will start a new transaction. It returns a
transaction: transaction:
```rust ```rust
let trans = try!(conn.transaction()); let trans = try!(conn.transaction());
try!(trans.execute(...)); try!(trans.execute(...));
let stmt = try!(trans.prepare(...)); let stmt = try!(trans.prepare(...));
// ...
if the_coast_is_clear { try!(trans.commit());
trans.set_commit();
}
try!(trans.finish());
``` ```
The transaction will be active until the `Transaction` object falls out of The transaction will be active until the `Transaction` object falls out of
scope. A transaction will roll back by default. Nested transactions are scope. A transaction will roll back by default. Nested transactions are