@@ -101,45 +101,23 @@ impl InnerClient {
101
101
}
102
102
103
103
pub fn set_typeinfo ( & self , statement : & Statement ) {
104
- // We only insert the statement if there isn't already a cached
105
- // statement (this is safe as they are prepared statements for the same
106
- // query).
107
- //
108
- // Note: We need to be sure that we don't drop a Statement while holding
109
- // the state lock as its drop handling will call `with_buf`, which tries
110
- // to take the lock.
111
- let mut cache = self . cached_typeinfo . lock ( ) ;
112
- if cache. typeinfo . is_none ( ) {
113
- cache. typeinfo = Some ( statement. clone ( ) ) ;
114
- }
104
+ self . cached_typeinfo . lock ( ) . typeinfo = Some ( statement. clone ( ) ) ;
115
105
}
116
106
117
107
pub fn typeinfo_composite ( & self ) -> Option < Statement > {
118
108
self . cached_typeinfo . lock ( ) . typeinfo_composite . clone ( )
119
109
}
120
110
121
111
pub fn set_typeinfo_composite ( & self , statement : & Statement ) {
122
- // We only insert the statement if there isn't already a cached
123
- // statement (this is safe as they are prepared statements for the same
124
- // query).
125
- let mut cache = self . cached_typeinfo . lock ( ) ;
126
- if cache. typeinfo_composite . is_none ( ) {
127
- cache. typeinfo_composite = Some ( statement. clone ( ) ) ;
128
- }
112
+ self . cached_typeinfo . lock ( ) . typeinfo_composite = Some ( statement. clone ( ) ) ;
129
113
}
130
114
131
115
pub fn typeinfo_enum ( & self ) -> Option < Statement > {
132
116
self . cached_typeinfo . lock ( ) . typeinfo_enum . clone ( )
133
117
}
134
118
135
119
pub fn set_typeinfo_enum ( & self , statement : & Statement ) {
136
- // We only insert the statement if there isn't already a cached
137
- // statement (this is safe as they are prepared statements for the same
138
- // query).
139
- let mut cache = self . cached_typeinfo . lock ( ) ;
140
- if cache. typeinfo_enum . is_none ( ) {
141
- cache. typeinfo_enum = Some ( statement. clone ( ) ) ;
142
- }
120
+ self . cached_typeinfo . lock ( ) . typeinfo_enum = Some ( statement. clone ( ) ) ;
143
121
}
144
122
145
123
pub fn type_ ( & self , oid : Oid ) -> Option < Type > {
0 commit comments