File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -926,14 +926,6 @@ pub trait PostgresStatement {
926926 Err ( err) => fail ! ( "Error executing query:\n {}" , err. to_str( ) )
927927 }
928928 }
929-
930- /// Returns the index of the first result column with the specified name,
931- /// or `None` if not found.
932- fn find_col_named ( & self , col : & str ) -> Option < uint > {
933- do self . result_descriptions ( ) . iter ( ) . position |desc| {
934- desc. name . as_slice ( ) == col
935- }
936- }
937929}
938930
939931/// A statement prepared outside of a transaction.
@@ -1296,9 +1288,11 @@ impl RowIndex for int {
12961288impl < ' self > RowIndex for & ' self str {
12971289 #[ inline]
12981290 fn idx ( & self , stmt : & NormalPostgresStatement ) -> uint {
1299- match stmt. find_col_named ( * self ) {
1300- Some ( idx) => idx,
1301- None => fail ! ( "No column with name {}" , * self )
1291+ for ( i, desc) in stmt. result_descriptions ( ) . iter ( ) . enumerate ( ) {
1292+ if desc. name . as_slice ( ) == * self {
1293+ return i;
1294+ }
13021295 }
1296+ fail ! ( "There is no colnum with name {}" , * self ) ;
13031297 }
13041298}
Original file line number Diff line number Diff line change @@ -459,15 +459,6 @@ fn test_too_many_params() {
459459 & 3i32 as & ToSql ] ) ;
460460}
461461
462- #[ test]
463- fn test_find_col_named( ) {
464- let conn = PostgresConnection :: connect( "postgres://postgres@localhost" ) ;
465- let stmt = conn. prepare( "SELECT 1 as my_id, 'hi' as val" ) ;
466- assert_eq!( Some ( 0 ) , stmt. find_col_named( "my_id" ) ) ;
467- assert_eq!( Some ( 1 ) , stmt. find_col_named( "val" ) ) ;
468- assert_eq!( None , stmt. find_col_named( "asdf" ) ) ;
469- }
470-
471462#[ test]
472463fn test_get_named( ) {
473464 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" ) ;
You can’t perform that action at this time.
0 commit comments