diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /plugin/user_variables/mysql-test | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugin/user_variables/mysql-test')
4 files changed, 102 insertions, 0 deletions
diff --git a/plugin/user_variables/mysql-test/user_variables/basic.result b/plugin/user_variables/mysql-test/user_variables/basic.result new file mode 100644 index 00000000..07f51ee5 --- /dev/null +++ b/plugin/user_variables/mysql-test/user_variables/basic.result @@ -0,0 +1,62 @@ +SELECT PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_AUTHOR, PLUGIN_DESCRIPTION, PLUGIN_LICENSE, LOAD_OPTION, PLUGIN_MATURITY FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='user_variables'; +PLUGIN_NAME user_variables +PLUGIN_VERSION 1.0 +PLUGIN_STATUS ACTIVE +PLUGIN_TYPE INFORMATION SCHEMA +PLUGIN_AUTHOR Sergey Vojtovich +PLUGIN_DESCRIPTION User-defined variables +PLUGIN_LICENSE GPL +LOAD_OPTION ON +PLUGIN_MATURITY Stable +SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES; +Table Create Table +user_variables CREATE TEMPORARY TABLE `user_variables` ( + `VARIABLE_NAME` varchar(64) NOT NULL, + `VARIABLE_VALUE` varchar(2048), + `VARIABLE_TYPE` varchar(64) NOT NULL, + `CHARACTER_SET_NAME` varchar(32) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +FLUSH USER_VARIABLES; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; +COUNT(*) +0 +SET @int_var=1; +SET @uint_var=CAST(2 AS UNSIGNED INTEGER); +SET @str_var='Value of string variable'; +SET @utf8str_var=_utf8 'UTF8 string value'; +SET @double_var=CAST(1 AS DOUBLE); +SET @dec_var=CAST(1 AS DECIMAL(20, 10)); +SET @time_var=CAST('2016-02-25' AS DATE); +SET @' @#^%'='Value of variable with odd name'; +SET @''='Value of variable with empty name'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '='Value of variable with empty name'' at line 1 +SET @null_var=NULL; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; +COUNT(*) +9 +SELECT * FROM INFORMATION_SCHEMA.USER_VARIABLES ORDER BY VARIABLE_NAME; +VARIABLE_NAME VARIABLE_VALUE VARIABLE_TYPE CHARACTER_SET_NAME + @#^% Value of variable with odd name VARCHAR latin1 +dec_var 1.0000000000 DECIMAL latin1 +double_var 1 DOUBLE latin1 +int_var 1 INT latin1 +null_var NULL VARCHAR binary +str_var Value of string variable VARCHAR latin1 +time_var 2016-02-25 VARCHAR latin1 +uint_var 2 INT UNSIGNED latin1 +utf8str_var UTF8 string value VARCHAR utf8mb3 +SHOW USER_VARIABLES; +Variable_name Value + @#^% Value of variable with odd name +dec_var 1.0000000000 +double_var 1 +int_var 1 +null_var NULL +str_var Value of string variable +time_var 2016-02-25 +uint_var 2 +utf8str_var UTF8 string value +FLUSH USER_VARIABLES; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; +COUNT(*) +0 diff --git a/plugin/user_variables/mysql-test/user_variables/basic.test b/plugin/user_variables/mysql-test/user_variables/basic.test new file mode 100644 index 00000000..7432f653 --- /dev/null +++ b/plugin/user_variables/mysql-test/user_variables/basic.test @@ -0,0 +1,25 @@ +query_vertical SELECT PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_AUTHOR, PLUGIN_DESCRIPTION, PLUGIN_LICENSE, LOAD_OPTION, PLUGIN_MATURITY FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='user_variables'; +SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES; + +FLUSH USER_VARIABLES; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; + +SET @int_var=1; +SET @uint_var=CAST(2 AS UNSIGNED INTEGER); +SET @str_var='Value of string variable'; +SET @utf8str_var=_utf8 'UTF8 string value'; +SET @double_var=CAST(1 AS DOUBLE); +SET @dec_var=CAST(1 AS DECIMAL(20, 10)); +SET @time_var=CAST('2016-02-25' AS DATE); +SET @' @#^%'='Value of variable with odd name'; +--error ER_PARSE_ERROR +SET @''='Value of variable with empty name'; +SET @null_var=NULL; + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; +SELECT * FROM INFORMATION_SCHEMA.USER_VARIABLES ORDER BY VARIABLE_NAME; +--sorted_result +SHOW USER_VARIABLES; + +FLUSH USER_VARIABLES; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES; diff --git a/plugin/user_variables/mysql-test/user_variables/suite.opt b/plugin/user_variables/mysql-test/user_variables/suite.opt new file mode 100644 index 00000000..6140014d --- /dev/null +++ b/plugin/user_variables/mysql-test/user_variables/suite.opt @@ -0,0 +1 @@ +--plugin-load-add=$USER_VARIABLES_SO --plugin-user-variables=ON diff --git a/plugin/user_variables/mysql-test/user_variables/suite.pm b/plugin/user_variables/mysql-test/user_variables/suite.pm new file mode 100644 index 00000000..b927bf40 --- /dev/null +++ b/plugin/user_variables/mysql-test/user_variables/suite.pm @@ -0,0 +1,14 @@ +package My::Suite::User_variables; + +@ISA = qw(My::Suite); + +return "No USER_VARIABLES plugin" unless + $ENV{USER_VARIABLES_SO} or + $::mysqld_variables{'user-variables'} eq "ON"; + +return "Not run for embedded server" if $::opt_embedded_server and + $ENV{USER_VARIABLES_SO}; + +sub is_default { 1 } + +bless { }; |