Commit 95e7cccf authored by gshchepa/uchum@gleb.loc's avatar gshchepa/uchum@gleb.loc

Merge gleb.loc:/home/uchum/work/bk/5.1-opt-32034

into  gleb.loc:/home/uchum/work/bk/5.1-opt
parents 82ce901d 70f36562
......@@ -17,3 +17,13 @@ UNINSTALL PLUGIN EXAMPLE;
ERROR 42000: PLUGIN EXAMPLE does not exist
UNINSTALL PLUGIN non_exist;
ERROR 42000: PLUGIN non_exist does not exist
#
# Bug#32034: check_func_enum() does not check correct values but set it
# to impossible int val
#
INSTALL PLUGIN example SONAME 'ha_example.so';
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e2;
SET GLOBAL example_enum_var= impossible;
ERROR 42000: Variable 'enum_var' can't be set to the value of 'impossible'
UNINSTALL PLUGIN example;
......@@ -24,3 +24,18 @@ UNINSTALL PLUGIN EXAMPLE;
--error 1305
UNINSTALL PLUGIN non_exist;
--echo #
--echo # Bug#32034: check_func_enum() does not check correct values but set it
--echo # to impossible int val
--echo #
INSTALL PLUGIN example SONAME 'ha_example.so';
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e2;
--error 1231
SET GLOBAL example_enum_var= impossible;
UNINSTALL PLUGIN example;
......@@ -1944,7 +1944,7 @@ static int check_func_enum(THD *thd, struct st_mysql_sys_var *var,
length= sizeof(buff);
if (!(str= value->val_str(value, buff, &length)))
goto err;
if ((result= find_type(typelib, str, length, 1)-1) < 0)
if ((result= (long)find_type(typelib, str, length, 1)-1) < 0)
{
strvalue= str;
goto err;
......
......@@ -848,6 +848,34 @@ int ha_example::create(const char *name, TABLE *table_arg,
struct st_mysql_storage_engine example_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
static ulong srv_enum_var= 0;
const char *enum_var_names[]=
{
"e1", "e2", NullS
};
TYPELIB enum_var_typelib=
{
array_elements(enum_var_names) - 1, "enum_var_typelib",
enum_var_names, NULL
};
static MYSQL_SYSVAR_ENUM(
enum_var, // name
srv_enum_var, // varname
PLUGIN_VAR_RQCMDARG, // opt
"Sample ENUM system variable.", // comment
NULL, // check
NULL, // update
0, // def
&enum_var_typelib); // typelib
static struct st_mysql_sys_var* example_system_variables[]= {
MYSQL_SYSVAR(enum_var),
NULL
};
mysql_declare_plugin(example)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
......@@ -860,7 +888,7 @@ mysql_declare_plugin(example)
example_done_func, /* Plugin Deinit */
0x0001 /* 0.1 */,
NULL, /* status variables */
NULL, /* system variables */
example_system_variables, /* system variables */
NULL /* config options */
}
mysql_declare_plugin_end;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment