Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
32b3c9f3
Commit
32b3c9f3
authored
Apr 09, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make THDVAR_INT variables to be signed in SELECT in SHOW
parent
ab157e45
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
8 deletions
+27
-8
mysql-test/r/plugin.result
mysql-test/r/plugin.result
+6
-1
mysql-test/t/plugin.test
mysql-test/t/plugin.test
+3
-0
sql/sql_plugin.cc
sql/sql_plugin.cc
+10
-4
sql/sql_show.cc
sql/sql_show.cc
+1
-1
storage/example/ha_example.cc
storage/example/ha_example.cc
+7
-2
No files found.
mysql-test/r/plugin.result
View file @
32b3c9f3
...
...
@@ -40,15 +40,20 @@ SELECT * FROM t1;
a
set global example_ulong_var=500;
set global example_enum_var= e1;
set session example_int_var= -1;
show status like 'example%';
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%';
Variable_name Value
example_double_thdvar 8.500000
example_double_var 8.500000
example_enum_var e1
example_int_var -1
example_ulong_var 500
select @@session.example_int_var;
@@session.example_int_var
-1
UNINSTALL SONAME 'ha_example';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
...
...
mysql-test/t/plugin.test
View file @
32b3c9f3
...
...
@@ -25,9 +25,12 @@ SELECT * FROM t1;
# a couple of tests for variables
set
global
example_ulong_var
=
500
;
set
global
example_enum_var
=
e1
;
set
session
example_int_var
=
-
1
;
show
status
like
'example%'
;
show
variables
like
'example%'
;
select
@@
session
.
example_int_var
;
UNINSTALL
SONAME
'ha_example'
;
--
replace_column
5
#
--
replace_regex
/
\
.
dll
/.
so
/
...
...
sql/sql_plugin.cc
View file @
32b3c9f3
...
...
@@ -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
)
{
switch
(
plugin_var
->
flags
&
PLUGIN_VAR_TYPEMASK
)
{
switch
(
plugin_var
->
flags
&
(
PLUGIN_VAR_TYPEMASK
|
PLUGIN_VAR_UNSIGNED
)
)
{
case
PLUGIN_VAR_BOOL
:
return
SHOW_MY_BOOL
;
case
PLUGIN_VAR_INT
:
return
SHOW_INT
;
return
SHOW_SINT
;
case
PLUGIN_VAR_INT
|
PLUGIN_VAR_UNSIGNED
:
return
SHOW_UINT
;
case
PLUGIN_VAR_LONG
:
return
SHOW_LONG
;
return
SHOW_SLONG
;
case
PLUGIN_VAR_LONG
|
PLUGIN_VAR_UNSIGNED
:
return
SHOW_ULONG
;
case
PLUGIN_VAR_LONGLONG
:
return
SHOW_LONGLONG
;
return
SHOW_SLONGLONG
;
case
PLUGIN_VAR_LONGLONG
|
PLUGIN_VAR_UNSIGNED
:
return
SHOW_ULONGLONG
;
case
PLUGIN_VAR_STR
:
return
SHOW_CHAR_PTR
;
case
PLUGIN_VAR_ENUM
:
...
...
sql/sql_show.cc
View file @
32b3c9f3
...
...
@@ -2703,7 +2703,7 @@ static bool show_status_array(THD *thd, const char *wild,
end
=
int10_to_str
((
long
)
*
(
uint
*
)
value
,
buff
,
10
);
break
;
case
SHOW_SINT
:
end
=
int10_to_str
((
long
)
*
(
u
int
*
)
value
,
buff
,
-
10
);
end
=
int10_to_str
((
long
)
*
(
int
*
)
value
,
buff
,
-
10
);
break
;
case
SHOW_SLONG
:
end
=
int10_to_str
(
*
(
long
*
)
value
,
buff
,
-
10
);
...
...
storage/example/ha_example.cc
View file @
32b3c9f3
...
...
@@ -1081,6 +1081,9 @@ static MYSQL_SYSVAR_ENUM(
0
,
// def
&
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
(
ulong_var
,
srv_ulong_var
,
...
...
@@ -1119,6 +1122,7 @@ static MYSQL_THDVAR_DOUBLE(
static
struct
st_mysql_sys_var
*
example_system_variables
[]
=
{
MYSQL_SYSVAR
(
enum_var
),
MYSQL_SYSVAR
(
ulong_var
),
MYSQL_SYSVAR
(
int_var
),
MYSQL_SYSVAR
(
double_var
),
MYSQL_SYSVAR
(
double_thdvar
),
NULL
...
...
@@ -1131,9 +1135,10 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
var
->
type
=
SHOW_CHAR
;
var
->
value
=
buf
;
// it's of SHOW_VAR_FUNC_BUFF_SIZE bytes
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
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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment