예제 #1
0
    def _merge_values(self, values):
        """Merge values into rows.

        :type values: list of :class:`~google.protobuf.struct_pb2.Value`
        :param values: non-chunked values from partial result set.
        """
        width = len(self.fields)
        for value in values:
            index = len(self._current_row)
            field = self.fields[index]
            self._current_row.append(_parse_value(value, field.type_))
            if len(self._current_row) == width:
                self._rows.append(self._current_row)
                self._current_row = []
예제 #2
0
    def _merge_chunk(self, value):
        """Merge pending chunk with next value.

        :type value: :class:`~google.protobuf.struct_pb2.Value`
        :param value: continuation of chunked value from previous
                      partial result set.

        :rtype: :class:`~google.protobuf.struct_pb2.Value`
        :returns: the merged value
        """
        current_column = len(self._current_row)
        field = self.fields[current_column]
        merged = _merge_by_type(self._pending_chunk, value, field.type_)
        self._pending_chunk = None
        return _parse_value(merged, field.type_)
예제 #3
0
    def _callFUT(self, *args, **kw):
        from google.cloud.spanner_v1._helpers import _parse_value

        return _parse_value(*args, **kw)