Exemplo n.º 1
0
 def recv_results_prepared(self, f, protocol_version, user_type_map):
     self.query_id = read_binary_string(f)
     if ProtocolVersion.uses_prepared_metadata(protocol_version):
         self.result_metadata_id = read_binary_string(f)
     else:
         self.result_metadata_id = None
     self.recv_prepared_metadata(f, protocol_version, user_type_map)
Exemplo n.º 2
0
 def recv_results_prepared(cls, f, protocol_version, user_type_map):
     query_id = read_binary_string(f)
     if ProtocolVersion.uses_prepared_metadata(protocol_version):
         result_metadata_id = read_binary_string(f)
     else:
         result_metadata_id = None
     bind_metadata, pk_indexes, result_metadata, _ = cls.recv_prepared_metadata(f, protocol_version, user_type_map)
     return query_id, bind_metadata, pk_indexes, result_metadata, result_metadata_id
Exemplo n.º 3
0
 def recv_results_prepared(cls, f, protocol_version, user_type_map):
     query_id = read_binary_string(f)
     if ProtocolVersion.uses_prepared_metadata(protocol_version):
         result_metadata_id = read_binary_string(f)
     else:
         result_metadata_id = None
     bind_metadata, pk_indexes, result_metadata, _ = cls.recv_prepared_metadata(f, protocol_version, user_type_map)
     return query_id, bind_metadata, pk_indexes, result_metadata, result_metadata_id
Exemplo n.º 4
0
    def send_body(self, f, protocol_version):
        write_string(f, self.query_id)
        if ProtocolVersion.uses_prepared_metadata(protocol_version):
            write_string(f, self.result_metadata_id)
        if protocol_version == 1:
            if self.serial_consistency_level:
                raise UnsupportedOperation(
                    "Serial consistency levels require the use of protocol version "
                    "2 or higher. Consider setting Cluster.protocol_version to 2 "
                    "to support serial consistency levels.")
            if self.fetch_size or self.paging_state:
                raise UnsupportedOperation(
                    "Automatic query paging may only be used with protocol version "
                    "2 or higher. Consider setting Cluster.protocol_version to 2."
                )
            write_short(f, len(self.query_params))
            for param in self.query_params:
                write_value(f, param)
            write_consistency_level(f, self.consistency_level)
        else:
            write_consistency_level(f, self.consistency_level)
            flags = _VALUES_FLAG
            if self.serial_consistency_level:
                flags |= _WITH_SERIAL_CONSISTENCY_FLAG
            if self.fetch_size:
                flags |= _PAGE_SIZE_FLAG
            if self.paging_state:
                flags |= _WITH_PAGING_STATE_FLAG
            if self.timestamp is not None:
                if protocol_version >= 3:
                    flags |= _PROTOCOL_TIMESTAMP
                else:
                    raise UnsupportedOperation(
                        "Protocol-level timestamps may only be used with protocol version "
                        "3 or higher. Consider setting Cluster.protocol_version to 3."
                    )
            if self.skip_meta:
                flags |= _SKIP_METADATA_FLAG

            if ProtocolVersion.uses_int_query_flags(protocol_version):
                write_uint(f, flags)
            else:
                write_byte(f, flags)

            write_short(f, len(self.query_params))
            for param in self.query_params:
                write_value(f, param)
            if self.fetch_size:
                write_int(f, self.fetch_size)
            if self.paging_state:
                write_longstring(f, self.paging_state)
            if self.serial_consistency_level:
                write_consistency_level(f, self.serial_consistency_level)
            if self.timestamp is not None:
                write_long(f, self.timestamp)
Exemplo n.º 5
0
    def send_body(self, f, protocol_version):
        write_string(f, self.query_id)
        if ProtocolVersion.uses_prepared_metadata(protocol_version):
            write_string(f, self.result_metadata_id)
        if protocol_version == 1:
            if self.serial_consistency_level:
                raise UnsupportedOperation(
                    "Serial consistency levels require the use of protocol version "
                    "2 or higher. Consider setting Cluster.protocol_version to 2 "
                    "to support serial consistency levels.")
            if self.fetch_size or self.paging_state:
                raise UnsupportedOperation(
                    "Automatic query paging may only be used with protocol version "
                    "2 or higher. Consider setting Cluster.protocol_version to 2.")
            write_short(f, len(self.query_params))
            for param in self.query_params:
                write_value(f, param)
            write_consistency_level(f, self.consistency_level)
        else:
            write_consistency_level(f, self.consistency_level)
            flags = _VALUES_FLAG
            if self.serial_consistency_level:
                flags |= _WITH_SERIAL_CONSISTENCY_FLAG
            if self.fetch_size:
                flags |= _PAGE_SIZE_FLAG
            if self.paging_state:
                flags |= _WITH_PAGING_STATE_FLAG
            if self.timestamp is not None:
                if protocol_version >= 3:
                    flags |= _PROTOCOL_TIMESTAMP
                else:
                    raise UnsupportedOperation(
                        "Protocol-level timestamps may only be used with protocol version "
                        "3 or higher. Consider setting Cluster.protocol_version to 3.")
            if self.skip_meta:
                flags |= _SKIP_METADATA_FLAG

            if ProtocolVersion.uses_int_query_flags(protocol_version):
                write_uint(f, flags)
            else:
                write_byte(f, flags)

            write_short(f, len(self.query_params))
            for param in self.query_params:
                write_value(f, param)
            if self.fetch_size:
                write_int(f, self.fetch_size)
            if self.paging_state:
                write_longstring(f, self.paging_state)
            if self.serial_consistency_level:
                write_consistency_level(f, self.serial_consistency_level)
            if self.timestamp is not None:
                write_long(f, self.timestamp)
Exemplo n.º 6
0
 def send_body(self, f, protocol_version):
     write_string(f, self.query_id)
     if ProtocolVersion.uses_prepared_metadata(protocol_version):
         write_string(f, self.result_metadata_id)
     self._write_query_params(f, protocol_version)