MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / get_next_row

Method get_next_row

libhsclient/hstcpcli.cpp:384–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384const string_ref *
385hstcpcli::get_next_row()
386{
387 if (num_flds == 0) {
388 DBG(fprintf(stderr, "GNR NF 0\n"));
389 return 0;
390 }
391 if (flds.size() < num_flds) {
392 flds.resize(num_flds);
393 }
394 char *start = readbuf.begin() + cur_row_offset;
395 char *const finish = readbuf.begin() + response_end_offset - 1;
396 if (start >= finish) { /* start[0] == nl */
397 DBG(fprintf(stderr, "GNR FIN 0 %p %p\n", start, finish));
398 return 0;
399 }
400 for (size_t i = 0; i < num_flds; ++i) {
401 skip_one(start, finish);
402 char *const fld_begin = start;
403 read_token(start, finish);
404 char *const fld_end = start;
405 char *wp = fld_begin;
406 if (is_null_expression(fld_begin, fld_end)) {
407 /* null */
408 flds[i] = string_ref();
409 } else {
410 unescape_string(wp, fld_begin, fld_end); /* in-place */
411 flds[i] = string_ref(fld_begin, wp);
412 }
413 }
414 cur_row_offset = start - readbuf.begin();
415 return &flds[0];
416}
417
418void
419hstcpcli::response_buf_remove()

Callers 6

hstcpcli_mainFunction · 0.80
op_insertMethod · 0.80
op_deleteMethod · 0.80
op_updateMethod · 0.80
op_readMethod · 0.80
op_readnolockMethod · 0.80

Calls 8

skip_oneFunction · 0.85
read_tokenFunction · 0.85
is_null_expressionFunction · 0.85
string_refClass · 0.85
unescape_stringFunction · 0.85
resizeMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected