Make THDVAR_INT variables to be signed in SELECT in SHOW
This commit is contained in:
parent
ab157e4556
commit
32b3c9f35d
@ -40,15 +40,20 @@ SELECT * FROM t1;
|
|||||||
a
|
a
|
||||||
set global example_ulong_var=500;
|
set global example_ulong_var=500;
|
||||||
set global example_enum_var= e1;
|
set global example_enum_var= e1;
|
||||||
|
set session example_int_var= -1;
|
||||||
show status like 'example%';
|
show status like 'example%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
example_func_example enum_var is 0, ulong_var is 500, double_var is 8.500000, really
|
example_func_example enum_var is 0, ulong_var is 500, int_var is -1, double_var is 8.500000, really
|
||||||
show variables like 'example%';
|
show variables like 'example%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
example_double_thdvar 8.500000
|
example_double_thdvar 8.500000
|
||||||
example_double_var 8.500000
|
example_double_var 8.500000
|
||||||
example_enum_var e1
|
example_enum_var e1
|
||||||
|
example_int_var -1
|
||||||
example_ulong_var 500
|
example_ulong_var 500
|
||||||
|
select @@session.example_int_var;
|
||||||
|
@@session.example_int_var
|
||||||
|
-1
|
||||||
UNINSTALL SONAME 'ha_example';
|
UNINSTALL SONAME 'ha_example';
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
||||||
|
@ -25,9 +25,12 @@ SELECT * FROM t1;
|
|||||||
# a couple of tests for variables
|
# a couple of tests for variables
|
||||||
set global example_ulong_var=500;
|
set global example_ulong_var=500;
|
||||||
set global example_enum_var= e1;
|
set global example_enum_var= e1;
|
||||||
|
set session example_int_var= -1;
|
||||||
show status like 'example%';
|
show status like 'example%';
|
||||||
show variables like 'example%';
|
show variables like 'example%';
|
||||||
|
|
||||||
|
select @@session.example_int_var;
|
||||||
|
|
||||||
UNINSTALL SONAME 'ha_example';
|
UNINSTALL SONAME 'ha_example';
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
--replace_regex /\.dll/.so/
|
--replace_regex /\.dll/.so/
|
||||||
|
@ -3165,15 +3165,21 @@ static void plugin_vars_free_values(sys_var *vars)
|
|||||||
|
|
||||||
static SHOW_TYPE pluginvar_show_type(st_mysql_sys_var *plugin_var)
|
static SHOW_TYPE pluginvar_show_type(st_mysql_sys_var *plugin_var)
|
||||||
{
|
{
|
||||||
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
|
switch (plugin_var->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_UNSIGNED)) {
|
||||||
case PLUGIN_VAR_BOOL:
|
case PLUGIN_VAR_BOOL:
|
||||||
return SHOW_MY_BOOL;
|
return SHOW_MY_BOOL;
|
||||||
case PLUGIN_VAR_INT:
|
case PLUGIN_VAR_INT:
|
||||||
return SHOW_INT;
|
return SHOW_SINT;
|
||||||
|
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED:
|
||||||
|
return SHOW_UINT;
|
||||||
case PLUGIN_VAR_LONG:
|
case PLUGIN_VAR_LONG:
|
||||||
return SHOW_LONG;
|
return SHOW_SLONG;
|
||||||
|
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED:
|
||||||
|
return SHOW_ULONG;
|
||||||
case PLUGIN_VAR_LONGLONG:
|
case PLUGIN_VAR_LONGLONG:
|
||||||
return SHOW_LONGLONG;
|
return SHOW_SLONGLONG;
|
||||||
|
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED:
|
||||||
|
return SHOW_ULONGLONG;
|
||||||
case PLUGIN_VAR_STR:
|
case PLUGIN_VAR_STR:
|
||||||
return SHOW_CHAR_PTR;
|
return SHOW_CHAR_PTR;
|
||||||
case PLUGIN_VAR_ENUM:
|
case PLUGIN_VAR_ENUM:
|
||||||
|
@ -2703,7 +2703,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||||||
end= int10_to_str((long) *(uint*) value, buff, 10);
|
end= int10_to_str((long) *(uint*) value, buff, 10);
|
||||||
break;
|
break;
|
||||||
case SHOW_SINT:
|
case SHOW_SINT:
|
||||||
end= int10_to_str((long) *(uint*) value, buff, -10);
|
end= int10_to_str((long) *(int*) value, buff, -10);
|
||||||
break;
|
break;
|
||||||
case SHOW_SLONG:
|
case SHOW_SLONG:
|
||||||
end= int10_to_str(*(long*) value, buff, -10);
|
end= int10_to_str(*(long*) value, buff, -10);
|
||||||
|
@ -1081,6 +1081,9 @@ static MYSQL_SYSVAR_ENUM(
|
|||||||
0, // def
|
0, // def
|
||||||
&enum_var_typelib); // typelib
|
&enum_var_typelib); // typelib
|
||||||
|
|
||||||
|
static MYSQL_THDVAR_INT(int_var, PLUGIN_VAR_RQCMDARG, "-1..1",
|
||||||
|
NULL, NULL, 0, -1, 1, 0);
|
||||||
|
|
||||||
static MYSQL_SYSVAR_ULONG(
|
static MYSQL_SYSVAR_ULONG(
|
||||||
ulong_var,
|
ulong_var,
|
||||||
srv_ulong_var,
|
srv_ulong_var,
|
||||||
@ -1119,6 +1122,7 @@ static MYSQL_THDVAR_DOUBLE(
|
|||||||
static struct st_mysql_sys_var* example_system_variables[]= {
|
static struct st_mysql_sys_var* example_system_variables[]= {
|
||||||
MYSQL_SYSVAR(enum_var),
|
MYSQL_SYSVAR(enum_var),
|
||||||
MYSQL_SYSVAR(ulong_var),
|
MYSQL_SYSVAR(ulong_var),
|
||||||
|
MYSQL_SYSVAR(int_var),
|
||||||
MYSQL_SYSVAR(double_var),
|
MYSQL_SYSVAR(double_var),
|
||||||
MYSQL_SYSVAR(double_thdvar),
|
MYSQL_SYSVAR(double_thdvar),
|
||||||
NULL
|
NULL
|
||||||
@ -1131,9 +1135,10 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
|
|||||||
var->type= SHOW_CHAR;
|
var->type= SHOW_CHAR;
|
||||||
var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes
|
var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes
|
||||||
my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE,
|
my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE,
|
||||||
"enum_var is %lu, ulong_var is %lu, "
|
"enum_var is %lu, ulong_var is %lu, int_var is %d, "
|
||||||
"double_var is %f, %.6b", // %b is a MySQL extension
|
"double_var is %f, %.6b", // %b is a MySQL extension
|
||||||
srv_enum_var, srv_ulong_var, srv_double_var, "really");
|
srv_enum_var, srv_ulong_var, THDVAR(thd, int_var),
|
||||||
|
srv_double_var, "really");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user