@@ -288,17 +288,19 @@ impl PostgresConnection {
288
288
resp => fail!(" Bad response: %?", resp.to_str())
289
289
});
290
290
291
- match_read_message!(self, {
292
- RowDescription {_} | NoData => (),
291
+ let result_desc = match_read_message!(self, {
292
+ RowDescription { descriptions } => descriptions,
293
+ NoData => ~[],
293
294
resp => fail!(" Bad response: %?", resp.to_str())
294
- })
295
+ });
295
296
296
297
self.wait_for_ready();
297
298
298
299
Ok(PostgresStatement {
299
300
conn: self,
300
301
name: stmt_name,
301
302
param_types: param_types,
303
+ result_desc: result_desc,
302
304
next_portal_id: Cell::new(0)
303
305
})
304
306
}
@@ -350,12 +352,10 @@ impl PostgresConnection {
350
352
}
351
353
352
354
fn wait_for_ready(&self) {
353
- loop {
354
- match_read_message!(self, {
355
- ReadyForQuery {_} => break,
356
- resp => fail!(" Bad response: %?", resp.to_str())
357
- })
358
- }
355
+ match_read_message!(self, {
356
+ ReadyForQuery {_} => (),
357
+ resp => fail!(" Bad response: %?", resp.to_str())
358
+ })
359
359
}
360
360
}
361
361
@@ -404,6 +404,7 @@ pub struct PostgresStatement<'self> {
404
404
priv conn: &'self PostgresConnection,
405
405
priv name: ~str,
406
406
priv param_types: ~[Oid],
407
+ priv result_desc: ~[RowDescriptionEntry],
407
408
priv next_portal_id: Cell<uint>
408
409
}
409
410
@@ -594,8 +595,8 @@ impl<'self> Iterator<PostgresRow> for PostgresResult<'self> {
594
595
self.execute();
595
596
}
596
597
597
- do self.data.pop_front().chain |row| {
598
- Some( PostgresRow { data: row })
598
+ do self.data.pop_front().map_move |row| {
599
+ PostgresRow { data: row }
599
600
}
600
601
}
601
602
}
0 commit comments