@@ -1006,6 +1006,31 @@ impl<'conn> PostgresTransaction<'conn> {
10061006 } )
10071007 }
10081008
1009+ /// Executes a prepared statement, returning a lazily loaded iterator over
1010+ /// the resulting rows.
1011+ ///
1012+ /// No more than `row_limit` rows will be stored in memory at a time. Rows
1013+ /// will be pulled from the database in batches of `row_limit` as needed.
1014+ /// If `row_limit` is less than or equal to 0, `lazy_query` is equivalent
1015+ /// to `query`.
1016+ pub fn lazy_query < ' trans , ' stmt > ( & ' trans self ,
1017+ stmt : & ' stmt PostgresStatement ,
1018+ params : & [ & ToSql ] ,
1019+ row_limit : i32 )
1020+ -> PostgresResult < PostgresLazyRows
1021+ < ' trans , ' stmt > > {
1022+ if self . conn as * const _ != stmt. conn as * const _ {
1023+ return Err ( PgWrongConnection ) ;
1024+ }
1025+ check_desync ! ( self . conn) ;
1026+ stmt. lazy_query ( row_limit, params) . map ( |result| {
1027+ PostgresLazyRows {
1028+ _trans : self ,
1029+ result : result
1030+ }
1031+ } )
1032+ }
1033+
10091034 /// Determines if the transaction is currently set to commit or roll back.
10101035 pub fn will_commit ( & self ) -> bool {
10111036 self . commit . get ( )
@@ -1035,31 +1060,6 @@ impl<'conn> PostgresTransaction<'conn> {
10351060 self . finished = true ;
10361061 self . finish_inner ( )
10371062 }
1038-
1039- /// Executes a prepared statement, returning a lazily loaded iterator over
1040- /// the resulting rows.
1041- ///
1042- /// No more than `row_limit` rows will be stored in memory at a time. Rows
1043- /// will be pulled from the database in batches of `row_limit` as needed.
1044- /// If `row_limit` is less than or equal to 0, `lazy_query` is equivalent
1045- /// to `query`.
1046- pub fn lazy_query < ' trans , ' stmt > ( & ' trans self ,
1047- stmt : & ' stmt PostgresStatement ,
1048- params : & [ & ToSql ] ,
1049- row_limit : i32 )
1050- -> PostgresResult < PostgresLazyRows
1051- < ' trans , ' stmt > > {
1052- if self . conn as * const _ != stmt. conn as * const _ {
1053- return Err ( PgWrongConnection ) ;
1054- }
1055- check_desync ! ( self . conn) ;
1056- stmt. lazy_query ( row_limit, params) . map ( |result| {
1057- PostgresLazyRows {
1058- _trans : self ,
1059- result : result
1060- }
1061- } )
1062- }
10631063}
10641064
10651065/// A prepared statement
0 commit comments