MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / _write_query_params

Method _write_query_params

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

Source from the content-addressed store, hash-verified

542 self.keyspace = keyspace
543
544 def _write_query_params(self, f, protocol_version):
545 write_consistency_level(f, self.consistency_level)
546 flags = 0x00
547 if self.query_params is not None:
548 flags |= _VALUES_FLAG # also v2+, but we're only setting params internally right now
549
550 if self.serial_consistency_level:
551 if protocol_version >= 2:
552 flags |= _WITH_SERIAL_CONSISTENCY_FLAG
553 else:
554 raise UnsupportedOperation(
555 "Serial consistency levels require the use of protocol version "
556 "2 or higher. Consider setting Cluster.protocol_version to 2 "
557 "to support serial consistency levels.")
558
559 if self.fetch_size:
560 if protocol_version >= 2:
561 flags |= _PAGE_SIZE_FLAG
562 else:
563 raise UnsupportedOperation(
564 "Automatic query paging may only be used with protocol version "
565 "2 or higher. Consider setting Cluster.protocol_version to 2.")
566
567 if self.paging_state:
568 if protocol_version >= 2:
569 flags |= _WITH_PAGING_STATE_FLAG
570 else:
571 raise UnsupportedOperation(
572 "Automatic query paging may only be used with protocol version "
573 "2 or higher. Consider setting Cluster.protocol_version to 2.")
574
575 if self.timestamp is not None:
576 flags |= _PROTOCOL_TIMESTAMP_FLAG
577
578 if self.continuous_paging_options:
579 if ProtocolVersion.has_continuous_paging_support(protocol_version):
580 flags |= _PAGING_OPTIONS_FLAG
581 else:
582 raise UnsupportedOperation(
583 "Continuous paging may only be used with protocol version "
584 "ProtocolVersion.DSE_V1 or higher. Consider setting Cluster.protocol_version to ProtocolVersion.DSE_V1.")
585
586 if self.keyspace is not None:
587 if ProtocolVersion.uses_keyspace_flag(protocol_version):
588 flags |= _WITH_KEYSPACE_FLAG
589 else:
590 raise UnsupportedOperation(
591 "Keyspaces may only be set on queries with protocol version "
592 "5 or DSE_V2 or higher. Consider setting Cluster.protocol_version.")
593
594 if ProtocolVersion.uses_int_query_flags(protocol_version):
595 write_uint(f, flags)
596 else:
597 write_byte(f, flags)
598
599 if self.query_params is not None:
600 write_short(f, len(self.query_params))
601 for param in self.query_params:

Callers 2

send_bodyMethod · 0.45
_write_query_paramsMethod · 0.45

Calls 14

_write_paging_optionsMethod · 0.95
write_consistency_levelFunction · 0.85
write_uintFunction · 0.85
write_byteFunction · 0.85
write_shortFunction · 0.85
write_valueFunction · 0.85
write_intFunction · 0.85
write_longstringFunction · 0.85
write_longFunction · 0.85
write_stringFunction · 0.85

Tested by

no test coverage detected