File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1056,7 +1056,7 @@ impl Buffer {
10561056 self . write_column_key ( name) ?;
10571057 value. serialize (
10581058 & mut self . output ,
1059- self . protocol_version == ProtocolVersion :: V2 ,
1059+ self . protocol_version . supports_binary_encoding ( ) ,
10601060 ) ?;
10611061 Ok ( self )
10621062 }
Original file line number Diff line number Diff line change @@ -91,6 +91,23 @@ pub enum ProtocolVersion {
9191 V2 = 2 ,
9292}
9393
94+ impl ProtocolVersion {
95+ /// Returns `true` if this protocol version supports binary-encoded column values.
96+ ///
97+ /// # Examples
98+ ///
99+ /// ```
100+ /// use questdb::ingress::ProtocolVersion;
101+ ///
102+ /// assert_eq!(ProtocolVersion::V1.supports_binary_encoding(), false);
103+ /// assert_eq!(ProtocolVersion::V2.supports_binary_encoding(), true);
104+ /// ```
105+ #[ inline]
106+ pub fn supports_binary_encoding ( self ) -> bool {
107+ self != ProtocolVersion :: V1
108+ }
109+ }
110+
94111impl Display for ProtocolVersion {
95112 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
96113 match self {
You can’t perform that action at this time.
0 commit comments