From f9e4e8e189e3ea27b6829b0572c66e81af65a43f Mon Sep 17 00:00:00 2001 From: Sandeep Tamhankar Date: Fri, 9 Dec 2016 09:10:25 -0800 Subject: [PATCH] Send a flags field (value 0) in PREPARE messages in v5. * Write flags as a 32-bit unsigned int, not int. --- cassandra/protocol.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cassandra/protocol.py b/cassandra/protocol.py index ac6f74a9..2a7f851a 100644 --- a/cassandra/protocol.py +++ b/cassandra/protocol.py @@ -561,7 +561,7 @@ class QueryMessage(_MessageType): flags |= _PROTOCOL_TIMESTAMP if protocol_version >= 5: - write_int(f, flags) + write_uint(f, flags) else: write_byte(f, flags) @@ -777,7 +777,7 @@ class PrepareMessage(_MessageType): write_longstring(f, self.query) if protocol_version >= 5: # Write the flags byte; with 0 value for now, but this should change in PYTHON-678 - write_int(f, 0) + write_uint(f, 0) class ExecuteMessage(_MessageType): @@ -832,7 +832,7 @@ class ExecuteMessage(_MessageType): flags |= _SKIP_METADATA_FLAG if protocol_version >= 5: - write_int(f, flags) + write_uint(f, flags) else: write_byte(f, flags) @@ -1167,6 +1167,10 @@ def write_int(f, i): f.write(int32_pack(i)) +def write_uint(f, i): + f.write(uint32_pack(i)) + + def write_long(f, i): f.write(uint64_pack(i))