MCPcopy Create free account
hub / github.com/MariaDB/server / scan_ident_middle

Method scan_ident_middle

sql/sql_lex.cc:2894–2992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2892
2893
2894int Lex_input_stream::scan_ident_middle(THD *thd, Lex_ident_cli_st *str,
2895 CHARSET_INFO **introducer,
2896 my_lex_states *st)
2897{
2898 CHARSET_INFO *const cs= thd->charset();
2899 const uchar *const ident_map= cs->ident_map;
2900 const uchar *const state_map= cs->state_map;
2901 const char *start;
2902 uint length;
2903 uchar c;
2904 bool is_8bit;
2905 bool resolve_introducer= true;
2906 DBUG_ASSERT(m_ptr == m_tok_start + 1); // m_ptr points to the second byte
2907
2908 if (cs->use_mb())
2909 {
2910 is_8bit= true;
2911 int char_length= cs->charlen(get_ptr() - 1, get_end_of_query());
2912 if (char_length <= 0)
2913 {
2914 *st= MY_LEX_CHAR;
2915 return 0;
2916 }
2917 skip_binary(char_length - 1);
2918
2919 while (ident_map[c= yyGet()])
2920 {
2921 char_length= cs->charlen(get_ptr() - 1, get_end_of_query());
2922 if (char_length <= 0)
2923 break;
2924 if (char_length > 1 || (c & 0x80))
2925 resolve_introducer= false;
2926 skip_binary(char_length - 1);
2927 }
2928 }
2929 else
2930 {
2931 is_8bit= get_7bit_or_8bit_ident(thd, &c) || (m_tok_start[0] & 0x80);
2932 resolve_introducer= !is_8bit;
2933 }
2934 length= yyLength();
2935 start= get_ptr();
2936 if (ignore_space)
2937 {
2938 /*
2939 If we find a space then this can't be an identifier. We notice this
2940 below by checking start != lex->ptr.
2941 */
2942 for (; state_map[(uchar) c] == MY_LEX_SKIP ; c= yyGet())
2943 {
2944 if (c == '\n')
2945 yylineno++;
2946 }
2947 }
2948 if (start == get_ptr() && c == '.' && ident_map[(uchar) yyPeek()])
2949 next_state= MY_LEX_IDENT_SEP;
2950 else
2951 { // '(' must follow directly if function

Callers

nothing calls this directly

Calls 6

get_charset_by_csnameFunction · 0.85
charlenMethod · 0.80
get_utf8_flagMethod · 0.80
charsetMethod · 0.45
use_mbMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected