diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
commit | a2a2e32c02643a0cec111511220227703fda1cd5 (patch) | |
tree | 69cc2b631234c2a8e026b9cd4d72676c61c594df /sql/sql_plugin.cc | |
parent | Releasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff) | |
download | mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip |
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r-- | sql/sql_plugin.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index f4ce4a4d..7f4cf2a8 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1875,6 +1875,7 @@ static bool register_builtin(struct st_maria_plugin *plugin, /* called only by plugin_init() */ + static void plugin_load(MEM_ROOT *tmp_root) { TABLE_LIST tables; @@ -1892,6 +1893,8 @@ static void plugin_load(MEM_ROOT *tmp_root) new_thd->thread_stack= (char*) &tables; new_thd->store_globals(); + new_thd->set_query_inner((char*) STRING_WITH_LEN("intern:plugin_load"), + default_charset_info); new_thd->db= MYSQL_SCHEMA_NAME; bzero((char*) &new_thd->net, sizeof(new_thd->net)); tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PLUGIN_NAME, 0, TL_READ); @@ -1925,12 +1928,11 @@ static void plugin_load(MEM_ROOT *tmp_root) while (!(error= read_record_info.read_record())) { DBUG_PRINT("info", ("init plugin record")); - String str_name, str_dl; - get_field(tmp_root, table->field[0], &str_name); - get_field(tmp_root, table->field[1], &str_dl); - - LEX_CSTRING name= {str_name.ptr(), str_name.length()}; - LEX_CSTRING dl= {str_dl.ptr(), str_dl.length()}; + DBUG_ASSERT(new_thd == table->field[0]->get_thd()); + DBUG_ASSERT(new_thd == table->field[1]->get_thd()); + DBUG_ASSERT(!(new_thd->variables.sql_mode & MODE_PAD_CHAR_TO_FULL_LENGTH)); + LEX_CSTRING name= table->field[0]->val_lex_string_strmake(tmp_root); + LEX_CSTRING dl= table->field[1]->val_lex_string_strmake(tmp_root); if (!name.length || !dl.length) continue; @@ -3276,7 +3278,12 @@ void plugin_thdvar_init(THD *thd) /* This and all other variable cleanups are here for COM_CHANGE_USER :( */ #ifndef EMBEDDED_LIBRARY thd->session_tracker.sysvars.deinit(thd); + my_free(thd->variables.redirect_url); + thd->variables.redirect_url= 0; #endif + my_free((char*) thd->variables.default_master_connection.str); + thd->variables.default_master_connection.str= 0; + thd->variables.default_master_connection.length= 0; thd->variables= global_system_variables; @@ -3299,9 +3306,19 @@ void plugin_thdvar_init(THD *thd) intern_plugin_unlock(NULL, old_enforced_table_plugin); mysql_mutex_unlock(&LOCK_plugin); + thd->variables.default_master_connection.str= + my_strndup(key_memory_Sys_var_charptr_value, + global_system_variables.default_master_connection.str, + global_system_variables.default_master_connection.length, + MYF(MY_WME | MY_THREAD_SPECIFIC)); #ifndef EMBEDDED_LIBRARY thd->session_tracker.sysvars.init(thd); + thd->variables.redirect_url= + my_strdup(key_memory_Sys_var_charptr_value, + global_system_variables.redirect_url, + MYF(MY_WME | MY_THREAD_SPECIFIC)); #endif + DBUG_VOID_RETURN; } @@ -3369,7 +3386,12 @@ void plugin_thdvar_cleanup(THD *thd) #ifndef EMBEDDED_LIBRARY thd->session_tracker.sysvars.deinit(thd); + my_free(thd->variables.redirect_url); + thd->variables.redirect_url= 0; #endif + my_free((char*) thd->variables.default_master_connection.str); + thd->variables.default_master_connection.str= 0; + thd->variables.default_master_connection.length= 0; mysql_mutex_lock(&LOCK_plugin); |