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

Function get_quoted_token

sql/sql_lex.cc:592–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590*/
591
592static LEX_STRING get_quoted_token(Lex_input_stream *lip,
593 uint skip,
594 uint length, char quote)
595{
596 LEX_STRING tmp;
597 const char *from, *end;
598 char *to;
599 lip->yyUnget(); // ptr points now after last token char
600 tmp.length= lip->yytoklen=length;
601 tmp.str=(char*) lip->m_thd->alloc(tmp.length+1);
602 from= lip->get_tok_start() + skip;
603 to= tmp.str;
604 end= to+length;
605
606 lip->m_cpp_text_start= lip->get_cpp_tok_start() + skip;
607 lip->m_cpp_text_end= lip->m_cpp_text_start + length;
608
609 for ( ; to != end; )
610 {
611 if ((*to++= *from++) == quote)
612 {
613 from++; // Skip double quotes
614 lip->m_cpp_text_start++;
615 }
616 }
617 *to= 0; // End null for safety
618 return tmp;
619}
620
621
622/*

Callers 1

lex_one_tokenFunction · 0.85

Calls 4

yyUngetMethod · 0.80
get_tok_startMethod · 0.80
get_cpp_tok_startMethod · 0.80
allocMethod · 0.45

Tested by

no test coverage detected