MCPcopy Create free account
hub / github.com/Tencent/phxsql / DealWithQuery

Method DealWithQuery

phxbinlogsvr/core/repl/replication_slave.cpp:229–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229int ReplicationSlave::DealWithQuery(vector<string> &send_buffer) {
230 //field count
231 {
232 string recv_buff;
233 int ret = ReceivePkg(&recv_buff);
234 if (ret)
235 return ret;
236 send_buffer.push_back(recv_buff);
237 const char *pos = recv_buff.c_str() + 4;
238 if (recv_buff.size() < 5 || *pos == 0) {
239 ColorLogError("%s field count empty, return", __func__);
240 return OK;
241 }
242 }
243 //first read the meta data of fiedls
244 int ret = 0;
245 while (ret == 0) {
246 string recv_buff;
247 int ret = ReceivePkg(&recv_buff);
248 if (ret == 0)
249 send_buffer.push_back(recv_buff);
250 if (recv_buff.size() < 5)
251 ret = BUFFER_FAIL;
252 if (ret || IsQuerryEnd(recv_buff.c_str() + 4, recv_buff.size() - 4)) {
253 break;
254 }
255 }
256
257 //read the data
258 while (ret == 0) {
259 string recv_buff;
260 int ret = ReceivePkg(&recv_buff);
261 if (recv_buff.size() < 5)
262 ret = BUFFER_FAIL;
263 if (ret == OK) {
264 if (ctx_->IsSelfConn()) {
265 PraseCommand((char *) recv_buff.c_str() + 4, recv_buff.size() - 4);
266 }
267 if (ret) {
268 return ret;
269 }
270 send_buffer.push_back(recv_buff);
271 }
272 if (ret || IsQuerryEnd(recv_buff.c_str() + 4, recv_buff.size() - 4)) {
273 break;
274 }
275 }
276
277 return ret;
278}
279
280bool ReWriteCommand(const char *key_pos, const uint8_t key_size, char *value_pos, uint8_t value_size,
281 const string &check_key, string *old_value) {

Callers

nothing calls this directly

Calls 2

ColorLogErrorFunction · 0.85
IsSelfConnMethod · 0.80

Tested by

no test coverage detected