mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
This commit is contained in:
@ -296,10 +296,10 @@ public:
|
||||
sys_var_pluginvar *cast_pluginvar() { return this; }
|
||||
uchar* real_value_ptr(THD *thd, enum_var_type type);
|
||||
TYPELIB* plugin_var_typelib(void);
|
||||
uchar* do_value_ptr(THD *thd, enum_var_type type, const LEX_STRING *base);
|
||||
uchar* session_value_ptr(THD *thd, const LEX_STRING *base)
|
||||
uchar* do_value_ptr(THD *thd, enum_var_type type, const LEX_CSTRING *base);
|
||||
uchar* session_value_ptr(THD *thd, const LEX_CSTRING *base)
|
||||
{ return do_value_ptr(thd, OPT_SESSION, base); }
|
||||
uchar* global_value_ptr(THD *thd, const LEX_STRING *base)
|
||||
uchar* global_value_ptr(THD *thd, const LEX_CSTRING *base)
|
||||
{ return do_value_ptr(thd, OPT_GLOBAL, base); }
|
||||
uchar *default_value_ptr(THD *thd)
|
||||
{ return do_value_ptr(thd, OPT_DEFAULT, 0); }
|
||||
@ -364,7 +364,7 @@ bool check_valid_path(const char *path, size_t len)
|
||||
return prefix < len;
|
||||
}
|
||||
|
||||
static void fix_dl_name(MEM_ROOT *root, LEX_STRING *dl)
|
||||
static void fix_dl_name(MEM_ROOT *root, LEX_CSTRING *dl)
|
||||
{
|
||||
const size_t so_ext_len= sizeof(SO_EXT) - 1;
|
||||
if (my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len,
|
||||
@ -444,7 +444,7 @@ static int item_val_real(struct st_mysql_value *value, double *buf)
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
|
||||
static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *dl)
|
||||
static struct st_plugin_dl *plugin_dl_find(const LEX_CSTRING *dl)
|
||||
{
|
||||
uint i;
|
||||
struct st_plugin_dl *tmp;
|
||||
@ -500,7 +500,7 @@ static void free_plugin_mem(struct st_plugin_dl *p)
|
||||
if (p->handle)
|
||||
dlclose(p->handle);
|
||||
#endif
|
||||
my_free(p->dl.str);
|
||||
my_free(const_cast<char*>(p->dl.str));
|
||||
if (p->allocated)
|
||||
my_free(p->plugins);
|
||||
}
|
||||
@ -720,7 +720,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
||||
}
|
||||
#endif /* HAVE_DLOPEN */
|
||||
|
||||
static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
|
||||
static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
char dlpath[FN_REFLEN];
|
||||
@ -739,7 +739,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
|
||||
plugin directory are used (to make this even remotely secure).
|
||||
*/
|
||||
if (check_valid_path(dl->str, dl->length) ||
|
||||
check_string_char_length((LEX_STRING *) dl, 0, NAME_CHAR_LEN,
|
||||
check_string_char_length((LEX_CSTRING *) dl, 0, NAME_CHAR_LEN,
|
||||
system_charset_info, 1) ||
|
||||
plugin_dir_len + dl->length + 1 >= FN_REFLEN)
|
||||
{
|
||||
@ -832,10 +832,12 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
|
||||
static_cast<int>(plugin_dl.dl.length));
|
||||
goto ret;
|
||||
}
|
||||
plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length,
|
||||
files_charset_info, dl->str, dl->length, system_charset_info,
|
||||
&dummy_errors);
|
||||
plugin_dl.dl.str[plugin_dl.dl.length]= 0;
|
||||
plugin_dl.dl.length= copy_and_convert((char*) plugin_dl.dl.str,
|
||||
plugin_dl.dl.length,
|
||||
files_charset_info, dl->str,
|
||||
dl->length, system_charset_info,
|
||||
&dummy_errors);
|
||||
((char*) plugin_dl.dl.str)[plugin_dl.dl.length]= 0;
|
||||
/* Add this dll to array */
|
||||
if (! (tmp= plugin_dl_insert_or_reuse(&plugin_dl)))
|
||||
{
|
||||
@ -878,7 +880,8 @@ static void plugin_dl_del(struct st_plugin_dl *plugin_dl)
|
||||
}
|
||||
|
||||
|
||||
static struct st_plugin_int *plugin_find_internal(const LEX_STRING *name, int type)
|
||||
static struct st_plugin_int *plugin_find_internal(const LEX_CSTRING *name,
|
||||
int type)
|
||||
{
|
||||
uint i;
|
||||
DBUG_ENTER("plugin_find_internal");
|
||||
@ -905,7 +908,7 @@ static struct st_plugin_int *plugin_find_internal(const LEX_STRING *name, int ty
|
||||
}
|
||||
|
||||
|
||||
static SHOW_COMP_OPTION plugin_status(const LEX_STRING *name, int type)
|
||||
static SHOW_COMP_OPTION plugin_status(const LEX_CSTRING *name, int type)
|
||||
{
|
||||
SHOW_COMP_OPTION rc= SHOW_OPTION_NO;
|
||||
struct st_plugin_int *plugin;
|
||||
@ -922,7 +925,7 @@ static SHOW_COMP_OPTION plugin_status(const LEX_STRING *name, int type)
|
||||
}
|
||||
|
||||
|
||||
bool plugin_is_ready(const LEX_STRING *name, int type)
|
||||
bool plugin_is_ready(const LEX_CSTRING *name, int type)
|
||||
{
|
||||
bool rc= FALSE;
|
||||
if (plugin_status(name, type) == SHOW_OPTION_YES)
|
||||
@ -933,7 +936,7 @@ bool plugin_is_ready(const LEX_STRING *name, int type)
|
||||
|
||||
SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type)
|
||||
{
|
||||
LEX_STRING plugin_name= { (char *) name, len };
|
||||
LEX_CSTRING plugin_name= { name, len };
|
||||
return plugin_status(&plugin_name, type);
|
||||
}
|
||||
|
||||
@ -1017,7 +1020,7 @@ plugin_ref plugin_lock(THD *thd, plugin_ref ptr)
|
||||
}
|
||||
|
||||
|
||||
plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type)
|
||||
plugin_ref plugin_lock_by_name(THD *thd, const LEX_CSTRING *name, int type)
|
||||
{
|
||||
LEX *lex= thd ? thd->lex : 0;
|
||||
plugin_ref rc= NULL;
|
||||
@ -1060,7 +1063,7 @@ static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin)
|
||||
Requires that a write-lock is held on LOCK_system_variables_hash
|
||||
*/
|
||||
static bool plugin_add(MEM_ROOT *tmp_root,
|
||||
const LEX_STRING *name, LEX_STRING *dl, int report)
|
||||
const LEX_CSTRING *name, LEX_CSTRING *dl, int report)
|
||||
{
|
||||
struct st_plugin_int tmp, *maybe_dupe;
|
||||
struct st_maria_plugin *plugin;
|
||||
@ -1527,7 +1530,7 @@ int plugin_init(int *argc, char **argv, int flags)
|
||||
MEM_ROOT tmp_root;
|
||||
bool reaped_mandatory_plugin= false;
|
||||
bool mandatory= true;
|
||||
LEX_STRING MyISAM= { C_STRING_WITH_LEN("MyISAM") };
|
||||
LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
|
||||
DBUG_ENTER("plugin_init");
|
||||
|
||||
if (initialized)
|
||||
@ -1650,7 +1653,7 @@ int plugin_init(int *argc, char **argv, int flags)
|
||||
char path[FN_REFLEN + 1];
|
||||
build_table_filename(path, sizeof(path) - 1, "mysql", "plugin", reg_ext, 0);
|
||||
char engine_name_buf[NAME_CHAR_LEN + 1];
|
||||
LEX_STRING maybe_myisam= { engine_name_buf, 0 };
|
||||
LEX_CSTRING maybe_myisam= { engine_name_buf, 0 };
|
||||
bool is_sequence;
|
||||
Table_type frm_type= dd_frm_type(NULL, path, &maybe_myisam, &is_sequence);
|
||||
/* if mysql.plugin table is MyISAM - load it right away */
|
||||
@ -1809,8 +1812,8 @@ static void plugin_load(MEM_ROOT *tmp_root)
|
||||
get_field(tmp_root, table->field[0], &str_name);
|
||||
get_field(tmp_root, table->field[1], &str_dl);
|
||||
|
||||
LEX_STRING name= {(char *)str_name.ptr(), str_name.length()};
|
||||
LEX_STRING dl= {(char *)str_dl.ptr(), str_dl.length()};
|
||||
LEX_CSTRING name= {str_name.ptr(), str_name.length()};
|
||||
LEX_CSTRING dl= {str_dl.ptr(), str_dl.length()};
|
||||
|
||||
/*
|
||||
there're no other threads running yet, so we don't need a mutex.
|
||||
@ -1873,14 +1876,16 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list)
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
||||
name.str= 0; // load everything
|
||||
if (plugin_add(tmp_root, &name, &dl, REPORT_TO_LOG))
|
||||
if (plugin_add(tmp_root, (LEX_CSTRING*) &name, (LEX_CSTRING*) &dl,
|
||||
REPORT_TO_LOG))
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
{
|
||||
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
if (plugin_add(tmp_root, &name, &dl, REPORT_TO_LOG))
|
||||
if (plugin_add(tmp_root, (LEX_CSTRING*) &name, (LEX_CSTRING*) &dl,
|
||||
REPORT_TO_LOG))
|
||||
goto error;
|
||||
}
|
||||
mysql_mutex_unlock(&LOCK_plugin);
|
||||
@ -2048,7 +2053,7 @@ void plugin_shutdown(void)
|
||||
|
||||
That is, initialize it, and update mysql.plugin table
|
||||
*/
|
||||
static bool finalize_install(THD *thd, TABLE *table, const LEX_STRING *name,
|
||||
static bool finalize_install(THD *thd, TABLE *table, const LEX_CSTRING *name,
|
||||
int *argc, char **argv)
|
||||
{
|
||||
struct st_plugin_int *tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN);
|
||||
@ -2102,12 +2107,12 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_STRING *name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
|
||||
const LEX_STRING *dl_arg)
|
||||
bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
const LEX_CSTRING *dl_arg)
|
||||
{
|
||||
TABLE_LIST tables;
|
||||
TABLE *table;
|
||||
LEX_STRING dl= *dl_arg;
|
||||
LEX_CSTRING dl= *dl_arg;
|
||||
bool error;
|
||||
int argc=orig_argc;
|
||||
char **argv=orig_argv;
|
||||
@ -2167,7 +2172,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
|
||||
struct st_maria_plugin *plugin;
|
||||
for (plugin= plugin_dl->plugins; plugin->info; plugin++)
|
||||
{
|
||||
LEX_STRING str= { const_cast<char*>(plugin->name), strlen(plugin->name) };
|
||||
LEX_CSTRING str= { plugin->name, strlen(plugin->name) };
|
||||
error|= finalize_install(thd, table, &str, &argc, argv);
|
||||
}
|
||||
}
|
||||
@ -2185,7 +2190,7 @@ err:
|
||||
}
|
||||
|
||||
|
||||
static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
|
||||
static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
|
||||
{
|
||||
struct st_plugin_int *plugin;
|
||||
mysql_mutex_assert_owner(&LOCK_plugin);
|
||||
@ -2241,12 +2246,12 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
|
||||
}
|
||||
|
||||
|
||||
bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
|
||||
const LEX_STRING *dl_arg)
|
||||
bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
const LEX_CSTRING *dl_arg)
|
||||
{
|
||||
TABLE *table;
|
||||
TABLE_LIST tables;
|
||||
LEX_STRING dl= *dl_arg;
|
||||
LEX_CSTRING dl= *dl_arg;
|
||||
bool error= false;
|
||||
DBUG_ENTER("mysql_uninstall_plugin");
|
||||
|
||||
@ -2298,7 +2303,7 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
|
||||
for (struct st_maria_plugin *plugin= plugin_dl->plugins;
|
||||
plugin->info; plugin++)
|
||||
{
|
||||
LEX_STRING str= { const_cast<char*>(plugin->name), strlen(plugin->name) };
|
||||
LEX_CSTRING str= { plugin->name, strlen(plugin->name) };
|
||||
error|= do_uninstall(thd, table, &str);
|
||||
}
|
||||
}
|
||||
@ -2414,7 +2419,7 @@ static bool plugin_dl_foreach_internal(THD *thd, st_plugin_dl *plugin_dl,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool plugin_dl_foreach(THD *thd, const LEX_STRING *dl,
|
||||
bool plugin_dl_foreach(THD *thd, const LEX_CSTRING *dl,
|
||||
plugin_foreach_func *func, void *arg)
|
||||
{
|
||||
bool err= 0;
|
||||
@ -3384,7 +3389,7 @@ TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
|
||||
|
||||
|
||||
uchar* sys_var_pluginvar::do_value_ptr(THD *thd, enum_var_type type,
|
||||
const LEX_STRING *base)
|
||||
const LEX_CSTRING *base)
|
||||
{
|
||||
uchar* result;
|
||||
|
||||
|
Reference in New Issue
Block a user