MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / send_body

Method send_body

cassandra/protocol.py:897–924  ·  view source on GitHub ↗
(self, f, protocol_version)

Source from the content-addressed store, hash-verified

895 self.keyspace = keyspace
896
897 def send_body(self, f, protocol_version):
898 write_longstring(f, self.query)
899
900 flags = 0x00
901
902 if self.keyspace is not None:
903 if ProtocolVersion.uses_keyspace_flag(protocol_version):
904 flags |= _PREPARED_WITH_KEYSPACE_FLAG
905 else:
906 raise UnsupportedOperation(
907 "Keyspaces may only be set on queries with protocol version "
908 "5 or DSE_V2 or higher. Consider setting Cluster.protocol_version.")
909
910 if ProtocolVersion.uses_prepare_flags(protocol_version):
911 write_uint(f, flags)
912 else:
913 # checks above should prevent this, but just to be safe...
914 if flags:
915 raise UnsupportedOperation(
916 "Attempted to set flags with value {flags:0=#8x} on"
917 "protocol version {pv}, which doesn't support flags"
918 "in prepared statements."
919 "Consider setting Cluster.protocol_version to 5 or DSE_V2."
920 "".format(flags=flags, pv=protocol_version))
921
922 if ProtocolVersion.uses_keyspace_flag(protocol_version):
923 if self.keyspace:
924 write_string(f, self.keyspace)
925
926
927class BatchMessage(_MessageType):

Callers 3

test_prepare_messageMethod · 0.95
test_prepare_flagMethod · 0.95

Calls 6

write_longstringFunction · 0.85
write_uintFunction · 0.85
write_stringFunction · 0.85
uses_keyspace_flagMethod · 0.80
uses_prepare_flagsMethod · 0.80

Tested by 3

test_prepare_messageMethod · 0.76
test_prepare_flagMethod · 0.76