From 5827fe7ce6b136c6f9675329a3f5c68617dcef84 Mon Sep 17 00:00:00 2001 From: Stefania Alborghetti Date: Thu, 27 Oct 2016 10:11:19 +0800 Subject: [PATCH] 12838: expand QUERY/EXECUTE/BATCH flags from [byte] to [int] --- cassandra/protocol.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cassandra/protocol.py b/cassandra/protocol.py index 9f4613d0..753e7050 100644 --- a/cassandra/protocol.py +++ b/cassandra/protocol.py @@ -560,7 +560,10 @@ class QueryMessage(_MessageType): if self.timestamp is not None: flags |= _PROTOCOL_TIMESTAMP - write_byte(f, flags) + if protocol_version >= 5: + write_int(f, flags) + else: + write_byte(f, flags) if self._query_params is not None: write_short(f, len(self._query_params)) @@ -823,7 +826,12 @@ class ExecuteMessage(_MessageType): "3 or higher. Consider setting Cluster.protocol_version to 3.") if self.skip_meta: flags |= _SKIP_METADATA_FLAG - write_byte(f, flags) + + if protocol_version >= 5: + write_int(f, flags) + else: + write_byte(f, flags) + write_short(f, len(self.query_params)) for param in self.query_params: write_value(f, param) @@ -872,7 +880,11 @@ class BatchMessage(_MessageType): flags |= _WITH_SERIAL_CONSISTENCY_FLAG if self.timestamp is not None: flags |= _PROTOCOL_TIMESTAMP - write_byte(f, flags) + + if protocol_version >= 5: + write_int(f, flags) + else: + write_byte(f, flags) if self.serial_consistency_level: write_consistency_level(f, self.serial_consistency_level)