Пример #1
0
void AbstractData::encode_buffers(size_t pos, Buffer* buf) const {
  for (ElementVec::const_iterator i = elements_.begin(),
       end = elements_.end(); i != end; ++i) {
    if (!i->is_empty()) {
      pos = i->copy_buffer(CASS_HIGHEST_SUPPORTED_PROTOCOL_VERSION, pos, buf);
    } else {
      pos = buf->encode_int32(pos, -1); // null
    }
  }
}
Пример #2
0
size_t AbstractData::get_buffers_size() const {
  size_t size = 0;
  for (ElementVec::const_iterator i = elements_.begin(),
       end = elements_.end(); i != end; ++i) {
    if (!i->is_empty()) {
      size += i->get_size(CASS_HIGHEST_SUPPORTED_PROTOCOL_VERSION);
    } else {
      size += sizeof(int32_t); // null
    }
  }
  return size;
}
Пример #3
0
int32_t Statement::copy_buffers(int version, BufferVec* bufs, EncodingCache* cache) const {
  int32_t size = 0;
  for (ElementVec::const_iterator i = elements().begin(),
       end = elements().end(); i != end; ++i) {
    if (!i->is_empty()) {
      bufs->push_back(i->get_buffer_cached(version, cache, false));
    } else  {
      bufs->push_back(cass::encode_with_length(CassNull()));
    }
    size += bufs->back().size();
  }
  return size;
}