MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / EncodeRpcRow

Function EncodeRpcRow

src/codec/sql_rpc_row_codec.cc:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73bool EncodeRpcRow(const hybridse::codec::Row& row, butil::IOBuf* buf, size_t* total_size) {
74 if (buf == nullptr) {
75 return false;
76 }
77 *total_size = 0;
78 size_t slice_num = row.GetRowPtrCnt();
79 for (size_t i = 0; i < slice_num; ++i) {
80 int8_t* slice_buf = row.buf(i);
81 size_t slice_size = row.size(i);
82 int code;
83 if (slice_buf == nullptr || slice_size == 0) {
84 char empty_header[6] = {1, 1, 0, 0, 0, 0};
85 code = buf->append(empty_header, 6);
86 *total_size += 6;
87 } else {
88 code = buf->append(slice_buf, slice_size);
89 *total_size += slice_size;
90 }
91 if (code != 0) {
92 LOG(WARNING) << "Append " << i << "th slice of size " << slice_size << " failed";
93 return false;
94 }
95 }
96 return true;
97}
98
99bool EncodeRpcRow(const int8_t* buf, size_t size, butil::IOBuf* io_buf) {
100 int code = io_buf->append(buf, size);

Callers 6

QueryMethod · 0.85
EncodeRowBatchFunction · 0.85
CallProcedureMethod · 0.85
RunRequestQueryMethod · 0.85
TEST_FFunction · 0.85
SubQueryMethod · 0.85

Calls 2

appendMethod · 0.80
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68