Skip to content
  • Thayumanavar's avatar
    70a8dac7
    WL# 7583 - THD transitional string refactoring. · 70a8dac7
    Thayumanavar authored
    This patch does transitional refactoring of string
    types in the THD class. This will ease on the migration to
    the new strings framework. A number of places in the
    server uses char* instead of const char*. A gradual
    transformation of the server code is required to use
    const char* and use const references to pass objects
    around functions. This will enable the smooth transition
    of the server code to use the new string framework classes.
        
    This changeset is responsible for changing the type of
    db name of the Statement class from a raw char* to
    LEX_CSTRING. This results in set of cascade changes across
    several files. The following data members are modified as
    part of this patch:
          1. sp_name
               LEX_CSTRING m_db
          2. Alter_table_ctx
              const char *db
              const char *table_name
              const char *alias
              const char *new_db
              const char *new_alias
          3. Foreign_key
              LEX_CSTRING ref_db
              LEX_CSTRING ref_table
          4. Statement
              LEX_CSTRING m_db
          5. Table_ident
              LEX_CSTRING db
              LEX_CSTRING table
          6. TABLE_LIST
              const char *db, *table_name, *alias
              LEX_CSTRING view_db
              LEX_CSTRING view_name
          7. Trigger
              LEX_CSTRING m_db_name
              LEX_CSTRING m_subject_table_name
          8. user_var_entry
          LEX_CSTRING m_catalog
        
    The functions which are modified as part of this patch include:
          1. create_embedded_thd
          2. check_embedded_connection
          3. acl_getroot
          4. check_routine_access
          5. acl_authenticate
          6. check_access
          7. mysql_table_grant
          8. get_table_grant
          9. acl_notify_htons
          10. log_loaded_block
          11. decide_logging_format
          12. net_after_header_psi
          13. Event_job_data::execute
          14. Events::update_event
          15. Events::drop_schema_events
          16. filesort
          17. write_schema_op_to_binlog
          18. injectApplyStatusWriteRow
          19. ndb_binlog_thread_func
          20. handler::ha_external_lock
          21. Item_field::fix_fields
          23. Item_func_sp::itemize
          24. Item_func_database::val_str
          25. File_query_log::write_slow
          26. set_thd_db
          27. Query_log_event::Query_log_event
          28. Query_log_event::do_apply_event
          29. Load_log_event::do_apply_event
          30. Log_event::get_db
          31. handle_slave_io
          32. handle_slave_sql
          33. Current_schema_tracker::store
          34. db_load_routine
          35. lock_db_routines
          36. sp_drop_db_routines
          37. sp_load_for_information_schema
          38. sp_head::execute
          39. sp_head::execute_trigger
          40. sp_instr_stmt::exec_core
          41. mysql_admin_table
          42. Alter_table_ctx::Alter_table_ctx
          43. MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT (macro)
          44. MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER (macro)
          45. list_open_tables
          46. open_table
          47. make_cache_key
          48. Query_cache::invalidate
          49. THD::~THD
          50. thd_binlog_filter_ok
          51. db
          52. set_db
          53. reset_db
          54. copy_db_to
          55. Table_ident::Table_ident
          56. Table_ident::change_db
          57. mysql_open_cursor
          58. mysql_change_db_impl
          59. write_to_binlog
          60. get_default_db_collation
          61. mysql_create_db
          62. mysql_alter_db
          63. mysql_rm_db
          64. mysql_change_db_impl
          65. backup_current_db_name
          66. mysql_change_db
          67. mysql_opt_change_db
          68. mysql_upgrade_db
          69. mysql_derived_prepare
          70. Sql_cmd_handler_open::execute
          71. db_is_default_db
          72. mysql_load
          73. write_execute_load_query_log_event
          74. mysql_load
          75. all_tables_not_ok
          76. dispatch_command
          77. mysql_execute_command
          78. mysql_parse
          79. add_table_to_list
          80. plugin_load
          81. Prepared_statement::set_db
          82. Prepared_statement::prepare
          83. Prepared_statement::reprepare
          84. Prepared_statement::swap_prepared_statement
          85. Prepared_statement::execute
          86. mysql_rename_tables
          87. do_rename
          88. close_cached_connection_tables
          89. mysqld_show_create_db
          90. store_create_info
          91. view_store_create_info
          92. List_process_list::operator()
          93. Fill_process_list::operator()
          94. make_table_list
          95. fill_schema_table_by_open
          96. get_all_tables
          97. make_schema_select
          98. get_trigger_table
          99. initialize_information_schema_acl
          100. mysql_rm_table_no_locks
          101. mysql_alter_table
          102. add_table_for_trigger
          103. udf_init
          104. mysql_create_view
          105. mysql_make_view
          106. mysql_drop_view
          107. get_table_category
          108. open_table_def
          109. TABLE_LIST::prepare_view_securety_context
          110. TABLE_LIST::prepare_security
          111. init_one_table
          112. new_nested_join
          113. TABLE_LIST::get_db_name
          114. TABLE_LIST::get_table_name
          115. Table_trigger_dispatcher::Table_trigger_dispatcher
          116. Trigger::create_from_dd
          117. Trigger::execute
          118. Trigger::parse
          119. Trigger::get_db_name
          120. Trigger::get_subject_table_name
          121. Trigger_creation_ctx::create
          122. Trigger_loader::load_triggers
          123. Trigger_loader::drop_all_triggers
          124. my_tz_init
          125. initialize_performance_schema_acl
          126. ParserTest::parse
          127. ACL_internal_schema_registry::register_schema
          128. mysql_routine_grant
          129. Log_to_csv_event_handler::log_slow
          130. sp_exist_routines
          131. create_file
          132. Statement::Statement
          133. end_connection
          134. prepare_new_connection_state
          135. mysql_ha_hash_get_key
          136. init_lex_with_single_table
          137. innobase_get_foreign_key_info
          138. ha_myisammrg::append_create_info
          139. initialize_peformance_schema_acl.
    A new helper function to_lex_cstring(const char*) has been
    introduced which converts a const char* null-terminated 
    string to LEX_CSTRING type.
    70a8dac7
    WL# 7583 - THD transitional string refactoring.
    Thayumanavar authored
    This patch does transitional refactoring of string
    types in the THD class. This will ease on the migration to
    the new strings framework. A number of places in the
    server uses char* instead of const char*. A gradual
    transformation of the server code is required to use
    const char* and use const references to pass objects
    around functions. This will enable the smooth transition
    of the server code to use the new string framework classes.
        
    This changeset is responsible for changing the type of
    db name of the Statement class from a raw char* to
    LEX_CSTRING. This results in set of cascade changes across
    several files. The following data members are modified as
    part of this patch:
          1. sp_name
               LEX_CSTRING m_db
          2. Alter_table_ctx
              const char *db
              const char *table_name
              const char *alias
              const char *new_db
              const char *new_alias
          3. Foreign_key
              LEX_CSTRING ref_db
              LEX_CSTRING ref_table
          4. Statement
              LEX_CSTRING m_db
          5. Table_ident
              LEX_CSTRING db
              LEX_CSTRING table
          6. TABLE_LIST
              const char *db, *table_name, *alias
              LEX_CSTRING view_db
              LEX_CSTRING view_name
          7. Trigger
              LEX_CSTRING m_db_name
              LEX_CSTRING m_subject_table_name
          8. user_var_entry
          LEX_CSTRING m_catalog
        
    The functions which are modified as part of this patch include:
          1. create_embedded_thd
          2. check_embedded_connection
          3. acl_getroot
          4. check_routine_access
          5. acl_authenticate
          6. check_access
          7. mysql_table_grant
          8. get_table_grant
          9. acl_notify_htons
          10. log_loaded_block
          11. decide_logging_format
          12. net_after_header_psi
          13. Event_job_data::execute
          14. Events::update_event
          15. Events::drop_schema_events
          16. filesort
          17. write_schema_op_to_binlog
          18. injectApplyStatusWriteRow
          19. ndb_binlog_thread_func
          20. handler::ha_external_lock
          21. Item_field::fix_fields
          23. Item_func_sp::itemize
          24. Item_func_database::val_str
          25. File_query_log::write_slow
          26. set_thd_db
          27. Query_log_event::Query_log_event
          28. Query_log_event::do_apply_event
          29. Load_log_event::do_apply_event
          30. Log_event::get_db
          31. handle_slave_io
          32. handle_slave_sql
          33. Current_schema_tracker::store
          34. db_load_routine
          35. lock_db_routines
          36. sp_drop_db_routines
          37. sp_load_for_information_schema
          38. sp_head::execute
          39. sp_head::execute_trigger
          40. sp_instr_stmt::exec_core
          41. mysql_admin_table
          42. Alter_table_ctx::Alter_table_ctx
          43. MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT (macro)
          44. MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER (macro)
          45. list_open_tables
          46. open_table
          47. make_cache_key
          48. Query_cache::invalidate
          49. THD::~THD
          50. thd_binlog_filter_ok
          51. db
          52. set_db
          53. reset_db
          54. copy_db_to
          55. Table_ident::Table_ident
          56. Table_ident::change_db
          57. mysql_open_cursor
          58. mysql_change_db_impl
          59. write_to_binlog
          60. get_default_db_collation
          61. mysql_create_db
          62. mysql_alter_db
          63. mysql_rm_db
          64. mysql_change_db_impl
          65. backup_current_db_name
          66. mysql_change_db
          67. mysql_opt_change_db
          68. mysql_upgrade_db
          69. mysql_derived_prepare
          70. Sql_cmd_handler_open::execute
          71. db_is_default_db
          72. mysql_load
          73. write_execute_load_query_log_event
          74. mysql_load
          75. all_tables_not_ok
          76. dispatch_command
          77. mysql_execute_command
          78. mysql_parse
          79. add_table_to_list
          80. plugin_load
          81. Prepared_statement::set_db
          82. Prepared_statement::prepare
          83. Prepared_statement::reprepare
          84. Prepared_statement::swap_prepared_statement
          85. Prepared_statement::execute
          86. mysql_rename_tables
          87. do_rename
          88. close_cached_connection_tables
          89. mysqld_show_create_db
          90. store_create_info
          91. view_store_create_info
          92. List_process_list::operator()
          93. Fill_process_list::operator()
          94. make_table_list
          95. fill_schema_table_by_open
          96. get_all_tables
          97. make_schema_select
          98. get_trigger_table
          99. initialize_information_schema_acl
          100. mysql_rm_table_no_locks
          101. mysql_alter_table
          102. add_table_for_trigger
          103. udf_init
          104. mysql_create_view
          105. mysql_make_view
          106. mysql_drop_view
          107. get_table_category
          108. open_table_def
          109. TABLE_LIST::prepare_view_securety_context
          110. TABLE_LIST::prepare_security
          111. init_one_table
          112. new_nested_join
          113. TABLE_LIST::get_db_name
          114. TABLE_LIST::get_table_name
          115. Table_trigger_dispatcher::Table_trigger_dispatcher
          116. Trigger::create_from_dd
          117. Trigger::execute
          118. Trigger::parse
          119. Trigger::get_db_name
          120. Trigger::get_subject_table_name
          121. Trigger_creation_ctx::create
          122. Trigger_loader::load_triggers
          123. Trigger_loader::drop_all_triggers
          124. my_tz_init
          125. initialize_performance_schema_acl
          126. ParserTest::parse
          127. ACL_internal_schema_registry::register_schema
          128. mysql_routine_grant
          129. Log_to_csv_event_handler::log_slow
          130. sp_exist_routines
          131. create_file
          132. Statement::Statement
          133. end_connection
          134. prepare_new_connection_state
          135. mysql_ha_hash_get_key
          136. init_lex_with_single_table
          137. innobase_get_foreign_key_info
          138. ha_myisammrg::append_create_info
          139. initialize_peformance_schema_acl.
    A new helper function to_lex_cstring(const char*) has been
    introduced which converts a const char* null-terminated 
    string to LEX_CSTRING type.
Loading