• Dmitry Lenev's avatar
    This patch is prerequisite for the 2nd milestone of WL#148 "Foreign keys" · c0221b0e
    Dmitry Lenev authored
    storing and restoring information about foreign keys in the .FRM files and
    properly displaying it in SHOW CREATE TABLE output and I_S tables.
    
    The idea of this patch is to change type of Key_part_spec::field_name and
    Key::name to LEX_STRING in order to avoid extra strlen() calls during
    semantic analysis and statement execution, particularly, in code to be
    implemented on the 2nd milestone of WL#148.
    
    Note that since we are not using LEX_STRING everywhere yet (e.g. in
    Create_field and KEY) and we want to limit scope of our changes we
    have to do strlen() in places where we create Key and Key_part_spec
    instances from objects using plain (char*) for strings. These calls
    will go away during the process of further (char*) -> LEX_STRING
    refactoring.
    
    We have introduced these changes in 6.0 and backported them to 5.5
    tree to make people aware of these changes as early as possible and
    to simplify merges with mysql-fk and mysql-6.1-fk trees.
    
    No test case is needed since this patch does not introduce any
    user visible changes.
    
    sql/sql_class.cc:
      Key_part_spec::field_name is now LEX_STRING. Adjusted code accordingly.
    sql/sql_class.h:
      Changed type of Key_part_spec::field_name and Key::name to LEX_STRING in
      order to avoid extra strlen() calls in code responsible for semantic
      analysis and statement execution (e.g. in future code responsible for
      saving/restoring info about foreign keys).
    sql/sql_lex.cc:
      Moved null_lex_str from sql_yacc.yy to sql_lex.cc and added its
      declaration to sql_lex.h to make it accessible in other SQL-layer
      modules (e.g. sql_parse.cc).
    sql/sql_lex.h:
      Made null_lex_str accessible from outside of sql_lex.cc.
    sql/sql_parse.cc:
      Key_part_spec::field_name and Key::name are now LEX_STRING. Adjusted
      code accordingly.
    sql/sql_table.cc:
      Adjusted code to accomodate change of type to LEX_STRING for
      Key_part_spec::field_name and Key::name.
    sql/sql_yacc.yy:
      Now Key::name and Key_part_spec::field_name are LEX_STRINGs. Adjusted
      grammar to be able properly initialize them. This should allow us to
      save on some strlen() calls during later stages of statement execution.
    c0221b0e
sql_yacc.yy 409 KB