MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / parse_quoted_escaped_string

Function parse_quoted_escaped_string

sql/parse_file.cc:478–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476*/
477
478static const char *
479parse_quoted_escaped_string(const char *ptr, const char *end,
480 MEM_ROOT *mem_root, LEX_STRING *str)
481{
482 const char *eol;
483 uint result_len= 0;
484 bool escaped= 0;
485
486 // starting '
487 if (*(ptr++) != '\'')
488 return 0;
489
490 // find ending '
491 for (eol= ptr; (*eol != '\'' || escaped) && eol < end; eol++)
492 {
493 if (!(escaped= (*eol == '\\' && !escaped)))
494 result_len++;
495 }
496
497 // process string
498 if (eol >= end ||
499 !(str->str= (char*) alloc_root(mem_root, result_len + 1)) ||
500 read_escaped_string(ptr, eol, str))
501 return 0;
502
503 return eol+1;
504}
505
506
507/**

Callers 1

parseMethod · 0.85

Calls 2

alloc_rootFunction · 0.85
read_escaped_stringFunction · 0.85

Tested by

no test coverage detected