File tree 2 files changed +7
-11
lines changed
2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ use log::debug;
12
12
use postgres_protocol:: message:: backend:: Message ;
13
13
use postgres_protocol:: message:: frontend;
14
14
use std:: future:: Future ;
15
- use std:: num:: { NonZeroI16 , NonZeroU32 } ;
16
15
use std:: pin:: Pin ;
17
16
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
18
17
use std:: sync:: Arc ;
@@ -98,8 +97,8 @@ pub async fn prepare(
98
97
let type_ = get_type ( client, field. type_oid ( ) ) . await ?;
99
98
let column = Column {
100
99
name : field. name ( ) . to_string ( ) ,
101
- table_oid : NonZeroU32 :: new ( field. table_oid ( ) ) ,
102
- column_id : NonZeroI16 :: new ( field. column_id ( ) ) ,
100
+ table_oid : Some ( field. table_oid ( ) ) . filter ( |n| * n != 0 ) ,
101
+ column_id : Some ( field. column_id ( ) ) . filter ( |n| * n != 0 ) ,
103
102
r#type : type_,
104
103
} ;
105
104
columns. push ( column) ;
Original file line number Diff line number Diff line change @@ -3,10 +3,7 @@ use crate::codec::FrontendMessage;
3
3
use crate :: connection:: RequestMessages ;
4
4
use crate :: types:: Type ;
5
5
use postgres_protocol:: message:: frontend;
6
- use std:: {
7
- num:: { NonZeroI16 , NonZeroU32 } ,
8
- sync:: { Arc , Weak } ,
9
- } ;
6
+ use std:: sync:: { Arc , Weak } ;
10
7
11
8
struct StatementInner {
12
9
client : Weak < InnerClient > ,
@@ -68,8 +65,8 @@ impl Statement {
68
65
#[ derive( Debug ) ]
69
66
pub struct Column {
70
67
pub ( crate ) name : String ,
71
- pub ( crate ) table_oid : Option < NonZeroU32 > ,
72
- pub ( crate ) column_id : Option < NonZeroI16 > ,
68
+ pub ( crate ) table_oid : Option < u32 > ,
69
+ pub ( crate ) column_id : Option < i16 > ,
73
70
pub ( crate ) r#type : Type ,
74
71
}
75
72
@@ -80,12 +77,12 @@ impl Column {
80
77
}
81
78
82
79
/// Returns the OID of the underlying database table.
83
- pub fn table_oid ( & self ) -> Option < NonZeroU32 > {
80
+ pub fn table_oid ( & self ) -> Option < u32 > {
84
81
self . table_oid
85
82
}
86
83
87
84
/// Return the column ID within the underlying database table.
88
- pub fn column_id ( & self ) -> Option < NonZeroI16 > {
85
+ pub fn column_id ( & self ) -> Option < i16 > {
89
86
self . column_id
90
87
}
91
88
You can’t perform that action at this time.
0 commit comments