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

Function find_keyword

sql/sql_lex.cc:512–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512static int find_keyword(Lex_input_stream *lip, uint len, bool function)
513{
514 const char *tok= lip->get_tok_start();
515
516 SYMBOL *symbol= get_hash_symbol(tok, len, function);
517 if (symbol)
518 {
519 lip->yylval->symbol.symbol=symbol;
520 lip->yylval->symbol.str= (char*) tok;
521 lip->yylval->symbol.length=len;
522
523 if ((symbol->tok == NOT_SYM) &&
524 (lip->m_thd->variables.sql_mode & MODE_HIGH_NOT_PRECEDENCE))
525 return NOT2_SYM;
526 if ((symbol->tok == OR_OR_SYM) &&
527 !(lip->m_thd->variables.sql_mode & MODE_PIPES_AS_CONCAT))
528 return OR2_SYM;
529
530 return symbol->tok;
531 }
532 return 0;
533}
534
535/*
536 Check if name is a keyword

Callers 1

lex_one_tokenFunction · 0.85

Calls 2

get_hash_symbolFunction · 0.85
get_tok_startMethod · 0.80

Tested by

no test coverage detected