YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/common/ql_resultset.cc
Line
Count
Source (jump to first uncovered line)
1
//--------------------------------------------------------------------------------------------------
2
// Copyright (c) YugaByte, Inc.
3
//--------------------------------------------------------------------------------------------------
4
#include "yb/common/ql_resultset.h"
5
6
#include "yb/common/ql_protocol.pb.h"
7
#include "yb/common/ql_protocol_util.h"
8
#include "yb/common/ql_value.h"
9
10
namespace yb {
11
// TODO(neil) All QL classes in "yb/common" needs to be group under a namespace. Doing that would
12
// result in a number of code changes, so I'll leave this till next diff.
13
// namespace yqlapi
14
15
//--------------------------------------------------------------------------------------------------
16
17
QLRSRowDesc::RSColDesc::RSColDesc(const QLRSColDescPB& desc_pb)
18
23.9M
  : name_(desc_pb.name()), ql_type_(QLType::FromQLTypePB(desc_pb.ql_type())) {}
19
20
7.52M
QLRSRowDesc::QLRSRowDesc(const QLRSRowDescPB& desc_pb) {
21
7.52M
  rscol_descs_.reserve(desc_pb.rscol_descs().size());
22
23.9M
  for (const auto& rscol_desc_pb : desc_pb.rscol_descs()) {
23
23.9M
    rscol_descs_.emplace_back(rscol_desc_pb);
24
23.9M
  }
25
7.52M
}
26
27
7.51M
QLRSRowDesc::~QLRSRowDesc() {
28
7.51M
}
29
30
//--------------------------------------------------------------------------------------------------
31
32
QLResultSet::QLResultSet(const QLRSRowDesc* rsrow_desc, faststring* rows_data)
33
7.55M
    : rsrow_desc_(rsrow_desc), rows_data_(rows_data) {
34
7.55M
  CQLEncodeLength(0, rows_data_);
35
7.55M
}
36
37
7.51M
QLResultSet::~QLResultSet() {
38
7.51M
}
39
40
10.8M
void QLResultSet::AllocateRow() {
41
10.8M
  CQLEncodeLength(CQLDecodeLength(rows_data_->data()) + 1, rows_data_->data());
42
10.8M
}
43
44
0
void QLResultSet::AppendColumn(const size_t index, const QLValue& value) {
45
0
  value.Serialize(rsrow_desc_->rscol_descs()[index].ql_type(), YQL_CLIENT_CQL, rows_data_);
46
0
}
47
48
45.3M
void QLResultSet::AppendColumn(const size_t index, const QLValuePB& value) {
49
45.3M
  QLValue::Serialize(
50
45.3M
      rsrow_desc_->rscol_descs()[index].ql_type(), YQL_CLIENT_CQL, value, rows_data_);
51
45.3M
}
52
53
44.7M
size_t QLResultSet::rsrow_count() const {
54
44.7M
  return CQLDecodeLength(rows_data_->data());
55
44.7M
}
56
57
} // namespace yb