8080 w. write_u16 :: < LittleEndian > ( 0 ) ?; // number of warnings
8181 w. end_packet ( ) ?;
8282
83- write_column_definitions_41 ( pi, w, client_capabilities) ?;
84- write_column_definitions_41 ( ci, w, client_capabilities)
83+ if pi. len ( ) > 0 {
84+ write_column_definitions_41 ( pi, w, client_capabilities, false ) ?;
85+ }
86+ if ci. len ( ) > 0 {
87+ write_column_definitions_41 ( ci, w, client_capabilities, false ) ?;
88+ }
89+ Ok ( ( ) )
8590}
8691
8792/// works for Protocol::ColumnDefinition41 is set
@@ -90,12 +95,12 @@ pub(crate) fn write_column_definitions_41<'a, I, W>(
9095 i : I ,
9196 w : & mut PacketWriter < W > ,
9297 client_capabilities : CapabilityFlags ,
98+ is_com_field_list : bool ,
9399) -> io:: Result < ( ) >
94100where
95101 I : IntoIterator < Item = & ' a Column > ,
96102 W : Write ,
97103{
98- let mut empty = true ;
99104 for c in i {
100105 let c = c. borrow ( ) ;
101106 use crate :: myc:: constants:: UTF8_GENERAL_CI ;
@@ -113,11 +118,13 @@ where
113118 w. write_all ( & [ 0x00 ] ) ?; // decimals
114119 w. write_all ( & [ 0x00 , 0x00 ] ) ?; // unused
115120
121+ if is_com_field_list {
122+ w. write_all ( & [ 0xfb ] ) ?;
123+ }
116124 w. end_packet ( ) ?;
117- empty = false ;
118125 }
119126
120- if !empty && ! client_capabilities. contains ( CapabilityFlags :: CLIENT_DEPRECATE_EOF ) {
127+ if !client_capabilities. contains ( CapabilityFlags :: CLIENT_DEPRECATE_EOF ) {
121128 write_eof_packet ( w, StatusFlags :: empty ( ) )
122129 } else {
123130 Ok ( ( ) )
@@ -137,5 +144,5 @@ where
137144 let i = i. into_iter ( ) ;
138145 w. write_lenenc_int ( i. len ( ) as u64 ) ?;
139146 w. end_packet ( ) ?;
140- write_column_definitions_41 ( i, w, client_capabilities)
147+ write_column_definitions_41 ( i, w, client_capabilities, false )
141148}
0 commit comments