@@ -78,7 +78,7 @@ use std::path::PathBuf;
78
78
79
79
pub use error:: { Error , ConnectError , SqlState , DbError , ErrorPosition } ;
80
80
#[ doc( inline) ]
81
- pub use types:: { Oid , Type , Kind , ToSql , FromSql , SessionInfo } ;
81
+ pub use types:: { Oid , Type , Other , Kind , ToSql , FromSql , SessionInfo } ;
82
82
use io:: { StreamWrapper , NegotiateSsl } ;
83
83
use types:: IsNull ;
84
84
#[ doc( inline) ]
@@ -95,7 +95,6 @@ mod macros;
95
95
mod error;
96
96
pub mod io;
97
97
mod message;
98
- mod ugh_privacy;
99
98
mod priv_io;
100
99
mod url;
101
100
mod util;
@@ -548,7 +547,7 @@ impl InnerConnection {
548
547
conn. cancel_data . secret_key = secret_key;
549
548
}
550
549
ReadyForQuery { .. } => break ,
551
- ErrorResponse { fields } => return ugh_privacy :: dberror_new_connect ( fields) ,
550
+ ErrorResponse { fields } => return DbError :: new_connect ( fields) ,
552
551
_ => return Err ( ConnectError :: BadResponse ) ,
553
552
}
554
553
}
@@ -596,7 +595,7 @@ impl InnerConnection {
596
595
debug_assert ! ( !self . desynchronized) ;
597
596
match try_desync ! ( self , self . stream. read_message( ) ) {
598
597
NoticeResponse { fields } => {
599
- if let Ok ( err) = ugh_privacy :: dberror_new_raw ( fields) {
598
+ if let Ok ( err) = DbError :: new_raw ( fields) {
600
599
self . notice_handler . handle_notice ( err) ;
601
600
}
602
601
Ok ( None )
@@ -659,13 +658,13 @@ impl InnerConnection {
659
658
| AuthenticationSCMCredential
660
659
| AuthenticationGSS
661
660
| AuthenticationSSPI => return Err ( ConnectError :: UnsupportedAuthentication ) ,
662
- ErrorResponse { fields } => return ugh_privacy :: dberror_new_connect ( fields) ,
661
+ ErrorResponse { fields } => return DbError :: new_connect ( fields) ,
663
662
_ => return Err ( ConnectError :: BadResponse )
664
663
}
665
664
666
665
match try!( self . read_message ( ) ) {
667
666
AuthenticationOk => Ok ( ( ) ) ,
668
- ErrorResponse { fields } => return ugh_privacy :: dberror_new_connect ( fields) ,
667
+ ErrorResponse { fields } => return DbError :: new_connect ( fields) ,
669
668
_ => return Err ( ConnectError :: BadResponse )
670
669
}
671
670
}
@@ -693,7 +692,7 @@ impl InnerConnection {
693
692
ParseComplete => { }
694
693
ErrorResponse { fields } => {
695
694
try!( self . wait_for_ready ( ) ) ;
696
- return ugh_privacy :: dberror_new ( fields) ;
695
+ return DbError :: new ( fields) ;
697
696
}
698
697
_ => bad_response ! ( self ) ,
699
698
}
@@ -812,7 +811,7 @@ impl InnerConnection {
812
811
Sync ] ) ) ;
813
812
let resp = match try!( self . read_message ( ) ) {
814
813
CloseComplete => Ok ( ( ) ) ,
815
- ErrorResponse { fields } => ugh_privacy :: dberror_new ( fields) ,
814
+ ErrorResponse { fields } => DbError :: new ( fields) ,
816
815
_ => bad_response ! ( self )
817
816
} ;
818
817
try!( self . wait_for_ready ( ) ) ;
@@ -851,7 +850,7 @@ impl InnerConnection {
851
850
BindComplete => { }
852
851
ErrorResponse { fields } => {
853
852
try!( self . wait_for_ready ( ) ) ;
854
- return ugh_privacy :: dberror_new ( fields) ;
853
+ return DbError :: new ( fields) ;
855
854
}
856
855
_ => bad_response ! ( self )
857
856
}
@@ -871,15 +870,15 @@ impl InnerConnection {
871
870
}
872
871
ErrorResponse { fields } => {
873
872
try!( self . wait_for_ready ( ) ) ;
874
- return ugh_privacy :: dberror_new ( fields) ;
873
+ return DbError :: new ( fields) ;
875
874
}
876
875
_ => bad_response ! ( self )
877
876
} ;
878
877
match try!( self . read_message ( ) ) {
879
878
CommandComplete { .. } => { }
880
879
ErrorResponse { fields } => {
881
880
try!( self . wait_for_ready ( ) ) ;
882
- return ugh_privacy :: dberror_new ( fields) ;
881
+ return DbError :: new ( fields) ;
883
882
}
884
883
_ => bad_response ! ( self )
885
884
}
@@ -894,7 +893,7 @@ impl InnerConnection {
894
893
}
895
894
} ;
896
895
897
- let type_ = Type :: Other ( Box :: new ( ugh_privacy :: new_other ( name, oid, kind) ) ) ;
896
+ let type_ = Type :: Other ( Box :: new ( Other :: new ( name, oid, kind) ) ) ;
898
897
self . unknown_types . insert ( oid, type_. clone ( ) ) ;
899
898
Ok ( type_)
900
899
}
@@ -933,7 +932,7 @@ impl InnerConnection {
933
932
}
934
933
ErrorResponse { fields } => {
935
934
try!( self . wait_for_ready ( ) ) ;
936
- return ugh_privacy :: dberror_new ( fields) ;
935
+ return DbError :: new ( fields) ;
937
936
}
938
937
_ => { }
939
938
}
@@ -1466,7 +1465,7 @@ impl<'conn> Statement<'conn> {
1466
1465
BindComplete => Ok ( ( ) ) ,
1467
1466
ErrorResponse { fields } => {
1468
1467
try!( conn. wait_for_ready ( ) ) ;
1469
- ugh_privacy :: dberror_new ( fields)
1468
+ DbError :: new ( fields)
1470
1469
}
1471
1470
_ => {
1472
1471
conn. desynchronized = true ;
@@ -1527,7 +1526,7 @@ impl<'conn> Statement<'conn> {
1527
1526
DataRow { .. } => { }
1528
1527
ErrorResponse { fields } => {
1529
1528
try!( conn. wait_for_ready ( ) ) ;
1530
- return ugh_privacy :: dberror_new ( fields) ;
1529
+ return DbError :: new ( fields) ;
1531
1530
}
1532
1531
CommandComplete { tag } => {
1533
1532
num = util:: parse_update_count ( tag) ;
@@ -1683,7 +1682,7 @@ fn read_rows(conn: &mut InnerConnection, buf: &mut VecDeque<Vec<Option<Vec<u8>>>
1683
1682
DataRow { row } => buf. push_back ( row) ,
1684
1683
ErrorResponse { fields } => {
1685
1684
try!( conn. wait_for_ready ( ) ) ;
1686
- return ugh_privacy :: dberror_new ( fields) ;
1685
+ return DbError :: new ( fields) ;
1687
1686
}
1688
1687
CopyInResponse { .. } => {
1689
1688
try!( conn. write_messages ( & [
@@ -2133,7 +2132,7 @@ impl<'a> CopyInStatement<'a> {
2133
2132
BindComplete => { } ,
2134
2133
ErrorResponse { fields } => {
2135
2134
try!( conn. wait_for_ready ( ) ) ;
2136
- return ugh_privacy :: dberror_new ( fields) ;
2135
+ return DbError :: new ( fields) ;
2137
2136
}
2138
2137
_ => {
2139
2138
conn. desynchronized = true ;
@@ -2210,7 +2209,7 @@ impl<'a> CopyInStatement<'a> {
2210
2209
CommandComplete { tag } => util:: parse_update_count ( tag) ,
2211
2210
ErrorResponse { fields } => {
2212
2211
try!( conn. wait_for_ready ( ) ) ;
2213
- return ugh_privacy :: dberror_new ( fields) ;
2212
+ return DbError :: new ( fields) ;
2214
2213
}
2215
2214
_ => {
2216
2215
conn. desynchronized = true ;
@@ -2319,3 +2318,13 @@ impl<'a> GenericConnection for Transaction<'a> {
2319
2318
self . is_active ( )
2320
2319
}
2321
2320
}
2321
+
2322
+ trait OtherNew {
2323
+ fn new ( name : String , oid : Oid , kind : Kind ) -> Other ;
2324
+ }
2325
+
2326
+ trait DbErrorNew {
2327
+ fn new_raw ( fields : Vec < ( u8 , String ) > ) -> result:: Result < DbError , ( ) > ;
2328
+ fn new_connect < T > ( fields : Vec < ( u8 , String ) > ) -> result:: Result < T , ConnectError > ;
2329
+ fn new < T > ( fields : Vec < ( u8 , String ) > ) -> Result < T > ;
2330
+ }
0 commit comments