• Alexander Barkov's avatar
    Removing some duplicate code in THD::convert_string() & friends · 4a126bf3
    Alexander Barkov authored
    1. Adding THD::convert_string(LEX_CSTRING *to,...) as a wrapper
       for convert_string(LEX_STRING *to,...), as LEX_CSTRING
       is now frequently used for conversion purpose.
       This reduced duplicate code in TEXT_STRING_sys,
       TEXT_STRING_literal, TEXT_STRING_filesystem grammar rules in *.yy
    
    2. Adding yet another THD::convert_string() with an extra parameter
       "bool simple_copy_is_possible". This even more reduced
       repeatable code in the mentioned grammar rules in *.yy
    
    3. Deriving Lex_ident_cli_st from Lex_string_with_metadata_st,
       as they have very similar functionality. Moving m_quote
       from Lex_ident_cli_st to Lex_string_with_metadata_st,
       as m_quote will be used later to optimize string literals anyway
       (e.g. avoid redundant copying on the tokenizer stage).
       Adjusting Lex_input_stream::get_text() accordingly.
    
    4. Moving the reminders of the code in TEXT_STRING_sys, TEXT_STRING_literal,
       TEXT_STRING_filesystem grammar rules as new methods in THD:
       - make_text_string_sys()
       - make_text_string_connection()
       - make_text_string_filesystem()
       and changing *.yy to use these new methods.
       This reduced the amount of similar code in
       sql_yacc.yy and sql_yacc_ora.yy.
    
    5. Removing duplicate code in Lex_input_stream::body_utf8_append_ident():
       by reusing THD::make_text_string_sys(). Thanks to #3 and #4.
    
    6. Making THD members charset_is_system_charset,
       charset_is_collation_connection, charset_is_character_set_filesystem
       private, as they are not needed externally any more.
    4a126bf3
sql_yacc.yy 537 KB