@@ -421,7 +421,8 @@ impl<'self> PostgresTransaction<'self> {
421421}
422422
423423pub trait PostgresStatement {
424- fn num_params(&self) -> uint;
424+ fn param_types<'a>(&'a self) -> &'a [PostgresType];
425+ fn result_descriptions<'a>(&'a self) -> &'a [ResultDescription];
425426 fn update(&self, params: &[&ToSql]) -> uint;
426427 fn try_update(&self, params: &[&ToSql]) -> Result<uint, PostgresDbError>;
427428 fn query<'a>(&'a self, params: &[&ToSql]) -> PostgresResult<'a>;
@@ -438,6 +439,7 @@ pub struct NormalPostgresStatement<'self> {
438439 priv next_portal_id: Cell<uint>
439440}
440441
442+ #[deriving(Eq)]
441443pub struct ResultDescription {
442444 name: ~str,
443445 ty: PostgresType
@@ -548,8 +550,12 @@ impl<'self> NormalPostgresStatement<'self> {
548550}
549551
550552impl<'self> PostgresStatement for NormalPostgresStatement<'self> {
551- fn num_params(&self) -> uint {
552- self.param_types.len()
553+ fn param_types<'a>(&'a self) -> &'a [PostgresType] {
554+ self.param_types.as_slice()
555+ }
556+
557+ fn result_descriptions<'a>(&'a self) -> &'a [ResultDescription] {
558+ self.result_desc.as_slice()
553559 }
554560
555561 fn update(&self, params: &[&ToSql]) -> uint {
@@ -618,8 +624,12 @@ pub struct TransactionalPostgresStatement<'self> {
618624}
619625
620626impl<'self> PostgresStatement for TransactionalPostgresStatement<'self> {
621- fn num_params(&self) -> uint {
622- self.stmt.num_params()
627+ fn param_types<'a>(&'a self) -> &'a [PostgresType] {
628+ self.stmt.param_types()
629+ }
630+
631+ fn result_descriptions<'a>(&'a self) -> &'a [ResultDescription] {
632+ self.stmt.result_descriptions()
623633 }
624634
625635 fn update(&self, params: &[&ToSql]) -> uint {
0 commit comments