@@ -981,15 +981,14 @@ impl<'conn> PostgresTransaction<'conn> {
981981 stmt : & ' stmt PostgresStatement ,
982982 params : & [ & ToSql ] ,
983983 row_limit : uint )
984- -> Result < PostgresLazyResult < ' trans ,
985- ' stmt > ,
984+ -> Result < PostgresLazyRows < ' trans , ' stmt > ,
986985 PostgresError > {
987986 if self . conn as * PostgresConnection != stmt. conn as * PostgresConnection {
988987 return Err ( PgWrongConnection ) ;
989988 }
990989 check_desync ! ( self . conn) ;
991990 stmt. lazy_query ( row_limit, params) . map ( |result| {
992- PostgresLazyResult {
991+ PostgresLazyRows {
993992 trans : self ,
994993 result : result
995994 }
@@ -1087,14 +1086,14 @@ impl<'conn> PostgresStatement<'conn> {
10871086 }
10881087
10891088 fn lazy_query < ' a > ( & ' a self , row_limit : uint , params : & [ & ToSql ] )
1090- -> Result < PostgresResult < ' a > , PostgresError > {
1089+ -> Result < PostgresRows < ' a > , PostgresError > {
10911090 let id = self . next_portal_id . get ( ) ;
10921091 self . next_portal_id . set ( id + 1 ) ;
10931092 let portal_name = format ! ( "{}_portal_{}" , self . name, id) ;
10941093
10951094 try!( self . inner_execute ( portal_name, row_limit, params) ) ;
10961095
1097- let mut result = PostgresResult {
1096+ let mut result = PostgresRows {
10981097 stmt : self ,
10991098 name : portal_name,
11001099 data : RingBuf :: new ( ) ,
@@ -1187,7 +1186,7 @@ impl<'conn> PostgresStatement<'conn> {
11871186 /// }
11881187 /// ```
11891188 pub fn query < ' a > ( & ' a self , params : & [ & ToSql ] )
1190- -> Result < PostgresResult < ' a > , PostgresError > {
1189+ -> Result < PostgresRows < ' a > , PostgresError > {
11911190 check_desync ! ( self . conn) ;
11921191 self . lazy_query ( 0 , params)
11931192 }
@@ -1212,7 +1211,7 @@ pub struct ResultDescription {
12121211}
12131212
12141213/// An iterator over the resulting rows of a query.
1215- pub struct PostgresResult < ' stmt > {
1214+ pub struct PostgresRows < ' stmt > {
12161215 stmt : & ' stmt PostgresStatement < ' stmt > ,
12171216 name : ~str ,
12181217 data : RingBuf < Vec < Option < ~[ u8 ] > > > ,
@@ -1222,7 +1221,7 @@ pub struct PostgresResult<'stmt> {
12221221}
12231222
12241223#[ unsafe_destructor]
1225- impl < ' stmt > Drop for PostgresResult < ' stmt > {
1224+ impl < ' stmt > Drop for PostgresRows < ' stmt > {
12261225 fn drop ( & mut self ) {
12271226 if !self . finished {
12281227 match self . finish_inner ( ) {
@@ -1234,7 +1233,7 @@ impl<'stmt> Drop for PostgresResult<'stmt> {
12341233 }
12351234}
12361235
1237- impl < ' stmt > PostgresResult < ' stmt > {
1236+ impl < ' stmt > PostgresRows < ' stmt > {
12381237 fn finish_inner ( & mut self ) -> Result < ( ) , PostgresError > {
12391238 check_desync ! ( self . stmt. conn) ;
12401239 try_pg ! ( self . stmt. conn. write_messages( [
@@ -1286,11 +1285,11 @@ impl<'stmt> PostgresResult<'stmt> {
12861285 }
12871286}
12881287
1289- impl < ' stmt > PostgresResult < ' stmt > {
1290- /// Consumes the `PostgresResult `, cleaning up associated state.
1288+ impl < ' stmt > PostgresRows < ' stmt > {
1289+ /// Consumes the `PostgresRows `, cleaning up associated state.
12911290 ///
1292- /// Functionally identical to the `Drop` implementation on
1293- /// `PostgresResult` except that it returns any error to the caller.
1291+ /// Functionally identical to the `Drop` implementation on `PostgresRows`
1292+ /// except that it returns any error to the caller.
12941293 pub fn finish ( mut self ) -> Result < ( ) , PostgresError > {
12951294 self . finished = true ;
12961295 self . finish_inner ( )
@@ -1314,7 +1313,7 @@ impl<'stmt> PostgresResult<'stmt> {
13141313 }
13151314}
13161315
1317- impl < ' stmt > Iterator < PostgresRow < ' stmt > > for PostgresResult < ' stmt > {
1316+ impl < ' stmt > Iterator < PostgresRow < ' stmt > > for PostgresRows < ' stmt > {
13181317 fn next ( & mut self ) -> Option < PostgresRow < ' stmt > > {
13191318 // we'll never hit the network on a non-lazy result
13201319 self . try_next ( ) . map ( |r| r. unwrap ( ) )
@@ -1363,7 +1362,8 @@ impl<'stmt> Container for PostgresRow<'stmt> {
13631362 }
13641363}
13651364
1366- impl < ' stmt , I : RowIndex +Clone +fmt:: Show , T : FromSql > Index < I , T > for PostgresRow < ' stmt > {
1365+ impl < ' stmt , I : RowIndex +Clone +fmt:: Show , T : FromSql > Index < I , T >
1366+ for PostgresRow < ' stmt > {
13671367 /// Retreives the contents of a field of the row.
13681368 ///
13691369 /// A field can be accessed by the name or index of its column, though
@@ -1388,7 +1388,7 @@ impl<'stmt, I: RowIndex+Clone+fmt::Show, T: FromSql> Index<I, T> for PostgresRow
13881388 fn index ( & self , idx : & I ) -> T {
13891389 match self . get ( idx. clone ( ) ) {
13901390 Ok ( ok) => ok,
1391- Err ( err) => fail ! ( "error retrieving row[{}] : {}" , idx, err)
1391+ Err ( err) => fail ! ( "error retrieving row {} : {}" , idx, err)
13921392 }
13931393 }
13941394}
@@ -1435,20 +1435,20 @@ impl<'a> RowIndex for &'a str {
14351435}
14361436
14371437/// A lazily-loaded iterator over the resulting rows of a query
1438- pub struct PostgresLazyResult < ' trans , ' stmt > {
1439- result : PostgresResult < ' stmt > ,
1438+ pub struct PostgresLazyRows < ' trans , ' stmt > {
1439+ result : PostgresRows < ' stmt > ,
14401440 trans : & ' trans PostgresTransaction < ' trans > ,
14411441}
14421442
1443- impl < ' trans , ' stmt > PostgresLazyResult < ' trans , ' stmt > {
1444- /// Like `PostgresResult ::finish`.
1443+ impl < ' trans , ' stmt > PostgresLazyRows < ' trans , ' stmt > {
1444+ /// Like `PostgresRows ::finish`.
14451445 pub fn finish ( self ) -> Result < ( ) , PostgresError > {
14461446 self . result . finish ( )
14471447 }
14481448}
14491449
14501450impl < ' trans , ' stmt > Iterator < Result < PostgresRow < ' stmt > , PostgresError > >
1451- for PostgresLazyResult < ' trans , ' stmt > {
1451+ for PostgresLazyRows < ' trans , ' stmt > {
14521452 fn next ( & mut self ) -> Option < Result < PostgresRow < ' stmt > , PostgresError > > {
14531453 self . result . try_next ( )
14541454 }
0 commit comments