Skip to content

Commit 4b66c4a

Browse files
committed
PostgresStatement -> Statement
1 parent 2da41be commit 4b66c4a

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/lib.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,9 @@ impl InnerConnection {
567567
}
568568

569569
fn prepare<'a>(&mut self, query: &str, conn: &'a Connection)
570-
-> Result<PostgresStatement<'a>> {
570+
-> Result<Statement<'a>> {
571571
let (stmt_name, param_types, result_desc) = try!(self.raw_prepare(query));
572-
Ok(PostgresStatement {
572+
Ok(Statement {
573573
conn: conn,
574574
name: stmt_name,
575575
param_types: param_types,
@@ -800,7 +800,7 @@ impl Connection {
800800
/// Ok(stmt) => stmt,
801801
/// Err(err) => panic!("Error preparing statement: {}", err)
802802
/// };
803-
pub fn prepare<'a>(&'a self, query: &str) -> Result<PostgresStatement<'a>> {
803+
pub fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>> {
804804
let mut conn = self.conn.borrow_mut();
805805
if conn.trans_depth != 0 {
806806
return Err(PgWrongTransaction);
@@ -1014,7 +1014,7 @@ impl<'conn> PostgresTransaction<'conn> {
10141014
}
10151015

10161016
/// Like `Connection::prepare`.
1017-
pub fn prepare<'a>(&'a self, query: &str) -> Result<PostgresStatement<'a>> {
1017+
pub fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>> {
10181018
let mut conn = self.conn.conn.borrow_mut();
10191019
if conn.trans_depth != self.depth {
10201020
return Err(PgWrongTransaction);
@@ -1071,7 +1071,7 @@ impl<'conn> PostgresTransaction<'conn> {
10711071
/// If `row_limit` is less than or equal to 0, `lazy_query` is equivalent
10721072
/// to `query`.
10731073
pub fn lazy_query<'trans, 'stmt>(&'trans self,
1074-
stmt: &'stmt PostgresStatement,
1074+
stmt: &'stmt Statement,
10751075
params: &[&ToSql],
10761076
row_limit: i32)
10771077
-> Result<PostgresLazyRows<'trans, 'stmt>> {
@@ -1119,7 +1119,7 @@ impl<'conn> PostgresTransaction<'conn> {
11191119
}
11201120

11211121
/// A prepared statement
1122-
pub struct PostgresStatement<'conn> {
1122+
pub struct Statement<'conn> {
11231123
conn: &'conn Connection,
11241124
name: String,
11251125
param_types: Vec<PostgresType>,
@@ -1129,15 +1129,15 @@ pub struct PostgresStatement<'conn> {
11291129
}
11301130

11311131
#[unsafe_destructor]
1132-
impl<'conn> Drop for PostgresStatement<'conn> {
1132+
impl<'conn> Drop for Statement<'conn> {
11331133
fn drop(&mut self) {
11341134
if !self.finished {
11351135
let _ = self.finish_inner();
11361136
}
11371137
}
11381138
}
11391139

1140-
impl<'conn> PostgresStatement<'conn> {
1140+
impl<'conn> Statement<'conn> {
11411141
fn finish_inner(&mut self) -> Result<()> {
11421142
let mut conn = self.conn.conn.borrow_mut();
11431143
check_desync!(conn);
@@ -1298,7 +1298,7 @@ impl<'conn> PostgresStatement<'conn> {
12981298
/// Consumes the statement, clearing it from the Postgres session.
12991299
///
13001300
/// Functionally identical to the `Drop` implementation of the
1301-
/// `PostgresStatement` except that it returns any error to the caller.
1301+
/// `Statement` except that it returns any error to the caller.
13021302
pub fn finish(mut self) -> Result<()> {
13031303
self.finished = true;
13041304
self.finish_inner()
@@ -1316,7 +1316,7 @@ pub struct ResultDescription {
13161316

13171317
/// An iterator over the resulting rows of a query.
13181318
pub struct PostgresRows<'stmt> {
1319-
stmt: &'stmt PostgresStatement<'stmt>,
1319+
stmt: &'stmt Statement<'stmt>,
13201320
name: String,
13211321
data: RingBuf<Vec<Option<Vec<u8>>>>,
13221322
row_limit: i32,
@@ -1447,7 +1447,7 @@ impl<'stmt> Iterator<PostgresRow<'stmt>> for PostgresRows<'stmt> {
14471447

14481448
/// A single result row of a query.
14491449
pub struct PostgresRow<'stmt> {
1450-
stmt: &'stmt PostgresStatement<'stmt>,
1450+
stmt: &'stmt Statement<'stmt>,
14511451
data: Vec<Option<Vec<u8>>>
14521452
}
14531453

@@ -1503,12 +1503,12 @@ impl<'stmt> PostgresRow<'stmt> {
15031503
pub trait RowIndex {
15041504
/// Returns the index of the appropriate column, or `None` if no such
15051505
/// column exists.
1506-
fn idx(&self, stmt: &PostgresStatement) -> Option<uint>;
1506+
fn idx(&self, stmt: &Statement) -> Option<uint>;
15071507
}
15081508

15091509
impl RowIndex for uint {
15101510
#[inline]
1511-
fn idx(&self, stmt: &PostgresStatement) -> Option<uint> {
1511+
fn idx(&self, stmt: &Statement) -> Option<uint> {
15121512
if *self > stmt.result_desc.len() {
15131513
None
15141514
} else {
@@ -1519,7 +1519,7 @@ impl RowIndex for uint {
15191519

15201520
impl<'a> RowIndex for &'a str {
15211521
#[inline]
1522-
fn idx(&self, stmt: &PostgresStatement) -> Option<uint> {
1522+
fn idx(&self, stmt: &Statement) -> Option<uint> {
15231523
stmt.result_descriptions().iter().position(|d| d.name[] == *self)
15241524
}
15251525
}
@@ -1712,7 +1712,7 @@ impl<'a> PostgresCopyInStatement<'a> {
17121712
/// A trait allowing abstraction over connections and transactions
17131713
pub trait GenericConnection {
17141714
/// Like `Connection::prepare`.
1715-
fn prepare<'a>(&'a self, query: &str) -> Result<PostgresStatement<'a>>;
1715+
fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>>;
17161716

17171717
/// Like `Connection::execute`.
17181718
fn execute(&self, query: &str, params: &[&ToSql]) -> Result<uint> {
@@ -1731,7 +1731,7 @@ pub trait GenericConnection {
17311731
}
17321732

17331733
impl GenericConnection for Connection {
1734-
fn prepare<'a>(&'a self, query: &str) -> Result<PostgresStatement<'a>> {
1734+
fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>> {
17351735
self.prepare(query)
17361736
}
17371737

@@ -1750,7 +1750,7 @@ impl GenericConnection for Connection {
17501750
}
17511751

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

0 commit comments

Comments
 (0)