Skip to content

Commit 7248912

Browse files
committed
PostgresTransaction -> Transaction
1 parent 4b66c4a commit 7248912

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,9 @@ impl Connection {
842842

843843
/// Begins a new transaction.
844844
///
845-
/// Returns a `PostgresTransaction` object which should be used instead of
845+
/// Returns a `Transaction` object which should be used instead of
846846
/// the connection for the duration of the transaction. The transaction
847-
/// is active until the `PostgresTransaction` object falls out of scope.
847+
/// is active until the `Transaction` object falls out of scope.
848848
///
849849
/// ## Note
850850
/// A transaction will roll back by default. The `set_commit`,
@@ -864,15 +864,15 @@ impl Connection {
864864
/// # Ok(())
865865
/// # }
866866
/// ```
867-
pub fn transaction<'a>(&'a self) -> Result<PostgresTransaction<'a>> {
867+
pub fn transaction<'a>(&'a self) -> Result<Transaction<'a>> {
868868
let mut conn = self.conn.borrow_mut();
869869
check_desync!(conn);
870870
if conn.trans_depth != 0 {
871871
return Err(PgWrongTransaction);
872872
}
873873
try!(conn.quick_query("BEGIN"));
874874
conn.trans_depth += 1;
875-
Ok(PostgresTransaction {
875+
Ok(Transaction {
876876
conn: self,
877877
commit: Cell::new(false),
878878
depth: 1,
@@ -983,23 +983,23 @@ pub enum SslMode {
983983
/// Represents a transaction on a database connection.
984984
///
985985
/// The transaction will roll back by default.
986-
pub struct PostgresTransaction<'conn> {
986+
pub struct Transaction<'conn> {
987987
conn: &'conn Connection,
988988
commit: Cell<bool>,
989989
depth: u32,
990990
finished: bool,
991991
}
992992

993993
#[unsafe_destructor]
994-
impl<'conn> Drop for PostgresTransaction<'conn> {
994+
impl<'conn> Drop for Transaction<'conn> {
995995
fn drop(&mut self) {
996996
if !self.finished {
997997
let _ = self.finish_inner();
998998
}
999999
}
10001000
}
10011001

1002-
impl<'conn> PostgresTransaction<'conn> {
1002+
impl<'conn> Transaction<'conn> {
10031003
fn finish_inner(&mut self) -> Result<()> {
10041004
let mut conn = self.conn.conn.borrow_mut();
10051005
debug_assert!(self.depth == conn.trans_depth);
@@ -1047,15 +1047,15 @@ impl<'conn> PostgresTransaction<'conn> {
10471047
}
10481048

10491049
/// Like `Connection::transaction`.
1050-
pub fn transaction<'a>(&'a self) -> Result<PostgresTransaction<'a>> {
1050+
pub fn transaction<'a>(&'a self) -> Result<Transaction<'a>> {
10511051
let mut conn = self.conn.conn.borrow_mut();
10521052
check_desync!(conn);
10531053
if conn.trans_depth != self.depth {
10541054
return Err(PgWrongTransaction);
10551055
}
10561056
try!(conn.quick_query("SAVEPOINT sp"));
10571057
conn.trans_depth += 1;
1058-
Ok(PostgresTransaction {
1058+
Ok(Transaction {
10591059
conn: self.conn,
10601060
commit: Cell::new(false),
10611061
depth: self.depth + 1,
@@ -1111,7 +1111,7 @@ impl<'conn> PostgresTransaction<'conn> {
11111111
/// Consumes the transaction, commiting or rolling it back as appropriate.
11121112
///
11131113
/// Functionally equivalent to the `Drop` implementation of
1114-
/// `PostgresTransaction` except that it returns any error to the caller.
1114+
/// `Transaction` except that it returns any error to the caller.
11151115
pub fn finish(mut self) -> Result<()> {
11161116
self.finished = true;
11171117
self.finish_inner()
@@ -1527,7 +1527,7 @@ impl<'a> RowIndex for &'a str {
15271527
/// A lazily-loaded iterator over the resulting rows of a query
15281528
pub struct PostgresLazyRows<'trans, 'stmt> {
15291529
result: PostgresRows<'stmt>,
1530-
_trans: &'trans PostgresTransaction<'trans>,
1530+
_trans: &'trans Transaction<'trans>,
15311531
}
15321532

15331533
impl<'trans, 'stmt> PostgresLazyRows<'trans, 'stmt> {
@@ -1724,7 +1724,7 @@ pub trait GenericConnection {
17241724
-> Result<PostgresCopyInStatement<'a>>;
17251725

17261726
/// Like `Connection::transaction`.
1727-
fn transaction<'a>(&'a self) -> Result<PostgresTransaction<'a>>;
1727+
fn transaction<'a>(&'a self) -> Result<Transaction<'a>>;
17281728

17291729
/// Like `Connection::batch_execute`.
17301730
fn batch_execute(&self, query: &str) -> Result<()>;
@@ -1735,7 +1735,7 @@ impl GenericConnection for Connection {
17351735
self.prepare(query)
17361736
}
17371737

1738-
fn transaction<'a>(&'a self) -> Result<PostgresTransaction<'a>> {
1738+
fn transaction<'a>(&'a self) -> Result<Transaction<'a>> {
17391739
self.transaction()
17401740
}
17411741

@@ -1749,12 +1749,12 @@ impl GenericConnection for Connection {
17491749
}
17501750
}
17511751

1752-
impl<'a> GenericConnection for PostgresTransaction<'a> {
1752+
impl<'a> GenericConnection for Transaction<'a> {
17531753
fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>> {
17541754
self.prepare(query)
17551755
}
17561756

1757-
fn transaction<'a>(&'a self) -> Result<PostgresTransaction<'a>> {
1757+
fn transaction<'a>(&'a self) -> Result<Transaction<'a>> {
17581758
self.transaction()
17591759
}
17601760

0 commit comments

Comments
 (0)