| 140 | } |
| 141 | |
| 142 | bool TabletClient::SQLBatchRequestQuery(const std::string& db, const std::string& sql, |
| 143 | std::shared_ptr<::fedb::sdk::SQLRequestRowBatch> row_batch, |
| 144 | brpc::Controller* cntl, |
| 145 | ::fedb::api::SQLBatchRequestQueryResponse* response, |
| 146 | const bool is_debug) { |
| 147 | if (cntl == NULL || response == NULL) return false; |
| 148 | ::fedb::api::SQLBatchRequestQueryRequest request; |
| 149 | request.set_sql(sql); |
| 150 | request.set_db(db); |
| 151 | request.set_is_debug(is_debug); |
| 152 | |
| 153 | const std::set<size_t>& indices_set = row_batch->common_column_indices(); |
| 154 | for (size_t idx : indices_set) { |
| 155 | request.add_common_column_indices(idx); |
| 156 | } |
| 157 | auto& io_buf = cntl->request_attachment(); |
| 158 | if (!EncodeRowBatch(row_batch, &request, &io_buf)) { |
| 159 | return false; |
| 160 | } |
| 161 | |
| 162 | bool ok = client_.SendRequest(&::fedb::api::TabletServer_Stub::SQLBatchRequestQuery, |
| 163 | cntl, &request, response); |
| 164 | if (!ok || response->code() != ::fedb::base::kOk) { |
| 165 | LOG(WARNING) << "fail to query tablet" << response->msg(); |
| 166 | return false; |
| 167 | } |
| 168 | return true; |
| 169 | } |
| 170 | |
| 171 | bool TabletClient::CreateTable(const std::string& name, uint32_t tid, |
| 172 | uint32_t pid, uint64_t abs_ttl, uint64_t lat_ttl, |
nothing calls this directly
no test coverage detected