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

Method parse

sql/parse_file.cc:582–763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580
581
582my_bool
583File_parser::parse(uchar* base, MEM_ROOT *mem_root,
584 struct File_option *parameters, uint required,
585 Unknown_key_hook *hook) const
586{
587 uint first_param= 0, found= 0;
588 const char *ptr= start;
589 const char *eol;
590 LEX_STRING *str;
591 List<LEX_STRING> *list;
592 DBUG_ENTER("File_parser::parse");
593
594 while (ptr < end && found < required)
595 {
596 const char *line= ptr;
597 if (*ptr == '#')
598 {
599 // it is comment
600 if (!(ptr= strchr(ptr, '\n')))
601 {
602 my_error(ER_FPARSER_EOF_IN_COMMENT, MYF(0), line);
603 DBUG_RETURN(TRUE);
604 }
605 ptr++;
606 }
607 else
608 {
609 File_option *parameter= parameters+first_param,
610 *parameters_end= parameters+required;
611 int len= 0;
612 for (; parameter < parameters_end; parameter++)
613 {
614 len= parameter->name.length;
615 // check length
616 if (len < (end-ptr) && ptr[len] != '=')
617 continue;
618 // check keyword
619 if (memcmp(parameter->name.str, ptr, len) == 0)
620 break;
621 }
622
623 if (parameter < parameters_end)
624 {
625 found++;
626 /*
627 if we found first parameter, start search from next parameter
628 next time.
629 (this small optimisation should work, because they should be
630 written in same order)
631 */
632 if (parameter == parameters+first_param)
633 first_param++;
634
635 // get value
636 ptr+= (len+1);
637 switch (parameter->type) {
638 case FILE_OPTIONS_STRING:
639 {

Callers

nothing calls this directly

Calls 10

my_errorFunction · 0.85
parse_stringFunction · 0.85
parse_escaped_stringFunction · 0.85
my_strtoll10Function · 0.85
alloc_rootFunction · 0.85
get_file_options_ulllistFunction · 0.85
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected