mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-18767 Port "MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS" to sql_yacc_ora.yy
This commit is contained in:
41
mysql-test/include/install_plugin_if_exists.inc
Normal file
41
mysql-test/include/install_plugin_if_exists.inc
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
--echo #
|
||||||
|
--echo # MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
|
||||||
|
--echo #
|
||||||
|
--echo # INSTALL IF NOT EXISTS PLUGIN name SONAME library /
|
||||||
|
--echo # UNINSTALL IF EXISTS PLUGIN|SONAME name
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
|
||||||
|
--replace_regex /\.dll/.so/
|
||||||
|
--error ER_PLUGIN_INSTALLED
|
||||||
|
INSTALL PLUGIN example SONAME 'ha_example';
|
||||||
|
|
||||||
|
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
|
||||||
|
SHOW WARNINGS;
|
||||||
|
|
||||||
|
UNINSTALL PLUGIN IF EXISTS example;
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
|
||||||
|
UNINSTALL PLUGIN IF EXISTS example;
|
||||||
|
SHOW WARNINGS;
|
||||||
|
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
UNINSTALL PLUGIN example;
|
||||||
|
|
||||||
|
INSTALL SONAME 'ha_example';
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
|
||||||
|
UNINSTALL SONAME IF EXISTS 'ha_example';
|
||||||
|
|
||||||
|
--replace_regex /\.dll/.so/
|
||||||
|
UNINSTALL SONAME IF EXISTS 'ha_example';
|
||||||
|
--replace_regex /\.dll/.so/
|
||||||
|
SHOW WARNINGS;
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
|
||||||
|
--replace_regex /\.dll/.so/
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
UNINSTALL SONAME 'ha_example';
|
@ -332,6 +332,8 @@ RENAME TABLE t1 TO t2;
|
|||||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
|
||||||
|
#
|
||||||
# INSTALL IF NOT EXISTS PLUGIN name SONAME library /
|
# INSTALL IF NOT EXISTS PLUGIN name SONAME library /
|
||||||
# UNINSTALL IF EXISTS PLUGIN|SONAME name
|
# UNINSTALL IF EXISTS PLUGIN|SONAME name
|
||||||
#
|
#
|
||||||
|
@ -266,42 +266,4 @@ UNINSTALL PLUGIN example;
|
|||||||
RENAME TABLE t1 TO t2;
|
RENAME TABLE t1 TO t2;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--source include/install_plugin_if_exists.inc
|
||||||
--echo # INSTALL IF NOT EXISTS PLUGIN name SONAME library /
|
|
||||||
--echo # UNINSTALL IF EXISTS PLUGIN|SONAME name
|
|
||||||
--echo #
|
|
||||||
|
|
||||||
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
|
||||||
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
|
|
||||||
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
|
||||||
|
|
||||||
--replace_regex /\.dll/.so/
|
|
||||||
--error ER_PLUGIN_INSTALLED
|
|
||||||
INSTALL PLUGIN example SONAME 'ha_example';
|
|
||||||
|
|
||||||
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
|
|
||||||
SHOW WARNINGS;
|
|
||||||
|
|
||||||
UNINSTALL PLUGIN IF EXISTS example;
|
|
||||||
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
|
||||||
|
|
||||||
UNINSTALL PLUGIN IF EXISTS example;
|
|
||||||
SHOW WARNINGS;
|
|
||||||
|
|
||||||
--error 1305
|
|
||||||
UNINSTALL PLUGIN example;
|
|
||||||
|
|
||||||
INSTALL SONAME 'ha_example';
|
|
||||||
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
|
||||||
|
|
||||||
UNINSTALL SONAME IF EXISTS 'ha_example';
|
|
||||||
|
|
||||||
--replace_regex /\.dll/.so/
|
|
||||||
UNINSTALL SONAME IF EXISTS 'ha_example';
|
|
||||||
--replace_regex /\.dll/.so/
|
|
||||||
SHOW WARNINGS;
|
|
||||||
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
|
||||||
|
|
||||||
--replace_regex /\.dll/.so/
|
|
||||||
--error 1305
|
|
||||||
UNINSTALL SONAME 'ha_example';
|
|
||||||
|
48
mysql-test/suite/compat/oracle/r/plugin.result
Normal file
48
mysql-test/suite/compat/oracle/r/plugin.result
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
SET sql_mode=ORACLE;
|
||||||
|
#
|
||||||
|
# MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
|
||||||
|
#
|
||||||
|
# INSTALL IF NOT EXISTS PLUGIN name SONAME library /
|
||||||
|
# UNINSTALL IF EXISTS PLUGIN|SONAME name
|
||||||
|
#
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE
|
||||||
|
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE
|
||||||
|
EXAMPLE ACTIVE STORAGE ENGINE
|
||||||
|
INSTALL PLUGIN example SONAME 'ha_example';
|
||||||
|
ERROR HY000: Plugin 'example' already installed
|
||||||
|
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
|
||||||
|
Warnings:
|
||||||
|
Note 1968 Plugin 'example' already installed
|
||||||
|
SHOW WARNINGS;
|
||||||
|
Level Code Message
|
||||||
|
Note 1968 Plugin 'example' already installed
|
||||||
|
UNINSTALL PLUGIN IF EXISTS example;
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE
|
||||||
|
UNINSTALL PLUGIN IF EXISTS example;
|
||||||
|
Warnings:
|
||||||
|
Note 1305 PLUGIN example does not exist
|
||||||
|
SHOW WARNINGS;
|
||||||
|
Level Code Message
|
||||||
|
Note 1305 PLUGIN example does not exist
|
||||||
|
UNINSTALL PLUGIN example;
|
||||||
|
ERROR 42000: PLUGIN example does not exist
|
||||||
|
INSTALL SONAME 'ha_example';
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE
|
||||||
|
EXAMPLE ACTIVE STORAGE ENGINE
|
||||||
|
UNUSABLE ACTIVE DAEMON
|
||||||
|
UNINSTALL SONAME IF EXISTS 'ha_example';
|
||||||
|
UNINSTALL SONAME IF EXISTS 'ha_example';
|
||||||
|
Warnings:
|
||||||
|
Note 1305 SONAME ha_example.so does not exist
|
||||||
|
SHOW WARNINGS;
|
||||||
|
Level Code Message
|
||||||
|
Note 1305 SONAME ha_example.so does not exist
|
||||||
|
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
|
||||||
|
PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE
|
||||||
|
UNINSTALL SONAME 'ha_example';
|
||||||
|
ERROR 42000: SONAME ha_example.so does not exist
|
3
mysql-test/suite/compat/oracle/t/plugin.test
Normal file
3
mysql-test/suite/compat/oracle/t/plugin.test
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
SET sql_mode=ORACLE;
|
||||||
|
|
||||||
|
--source include/install_plugin_if_exists.inc
|
@ -10160,3 +10160,50 @@ exit:
|
|||||||
return having;
|
return having;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LEX::stmt_install_plugin(const DDL_options_st &opt,
|
||||||
|
const Lex_ident_sys_st &name,
|
||||||
|
const LEX_CSTRING &soname)
|
||||||
|
{
|
||||||
|
create_info.init();
|
||||||
|
if (add_create_options_with_check(opt))
|
||||||
|
return true;
|
||||||
|
sql_command= SQLCOM_INSTALL_PLUGIN;
|
||||||
|
comment= name;
|
||||||
|
ident= soname;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LEX::stmt_install_plugin(const LEX_CSTRING &soname)
|
||||||
|
{
|
||||||
|
sql_command= SQLCOM_INSTALL_PLUGIN;
|
||||||
|
comment= null_clex_str;
|
||||||
|
ident= soname;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LEX::stmt_uninstall_plugin_by_name(const DDL_options_st &opt,
|
||||||
|
const Lex_ident_sys_st &name)
|
||||||
|
{
|
||||||
|
check_opt.init();
|
||||||
|
if (add_create_options_with_check(opt))
|
||||||
|
return true;
|
||||||
|
sql_command= SQLCOM_UNINSTALL_PLUGIN;
|
||||||
|
comment= name;
|
||||||
|
ident= null_clex_str;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LEX::stmt_uninstall_plugin_by_soname(const DDL_options_st &opt,
|
||||||
|
const LEX_CSTRING &soname)
|
||||||
|
{
|
||||||
|
check_opt.init();
|
||||||
|
if (add_create_options_with_check(opt))
|
||||||
|
return true;
|
||||||
|
sql_command= SQLCOM_UNINSTALL_PLUGIN;
|
||||||
|
comment= null_clex_str;
|
||||||
|
ident= soname;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -4391,6 +4391,16 @@ public:
|
|||||||
bool parsed_create_view(SELECT_LEX_UNIT *unit, int check);
|
bool parsed_create_view(SELECT_LEX_UNIT *unit, int check);
|
||||||
bool select_finalize(st_select_lex_unit *expr);
|
bool select_finalize(st_select_lex_unit *expr);
|
||||||
void relink_hack(st_select_lex *select_lex);
|
void relink_hack(st_select_lex *select_lex);
|
||||||
|
|
||||||
|
bool stmt_install_plugin(const DDL_options_st &opt,
|
||||||
|
const Lex_ident_sys_st &name,
|
||||||
|
const LEX_CSTRING &soname);
|
||||||
|
void stmt_install_plugin(const LEX_CSTRING &soname);
|
||||||
|
|
||||||
|
bool stmt_uninstall_plugin_by_name(const DDL_options_st &opt,
|
||||||
|
const Lex_ident_sys_st &name);
|
||||||
|
bool stmt_uninstall_plugin_by_soname(const DDL_options_st &opt,
|
||||||
|
const LEX_CSTRING &soname);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -17994,42 +17994,25 @@ opt_migrate:
|
|||||||
install:
|
install:
|
||||||
INSTALL_SYM PLUGIN_SYM opt_if_not_exists ident SONAME_SYM TEXT_STRING_sys
|
INSTALL_SYM PLUGIN_SYM opt_if_not_exists ident SONAME_SYM TEXT_STRING_sys
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
if (Lex->stmt_install_plugin($3, $4, $6))
|
||||||
lex->create_info.init();
|
|
||||||
if (lex->add_create_options_with_check($3))
|
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
lex->sql_command= SQLCOM_INSTALL_PLUGIN;
|
|
||||||
lex->comment= $4;
|
|
||||||
lex->ident= $6;
|
|
||||||
}
|
}
|
||||||
| INSTALL_SYM SONAME_SYM TEXT_STRING_sys
|
| INSTALL_SYM SONAME_SYM TEXT_STRING_sys
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
Lex->stmt_install_plugin($3);
|
||||||
lex->sql_command= SQLCOM_INSTALL_PLUGIN;
|
|
||||||
lex->comment= null_clex_str;
|
|
||||||
lex->ident= $3;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
UNINSTALL_SYM PLUGIN_SYM opt_if_exists ident
|
UNINSTALL_SYM PLUGIN_SYM opt_if_exists ident
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
if (Lex->stmt_uninstall_plugin_by_name($3, $4))
|
||||||
lex->check_opt.init();
|
|
||||||
if (lex->add_create_options_with_check($3))
|
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
|
|
||||||
lex->comment= $4;
|
|
||||||
}
|
}
|
||||||
| UNINSTALL_SYM SONAME_SYM opt_if_exists TEXT_STRING_sys
|
| UNINSTALL_SYM SONAME_SYM opt_if_exists TEXT_STRING_sys
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
if (Lex->stmt_uninstall_plugin_by_soname($3, $4))
|
||||||
lex->check_opt.init();
|
|
||||||
if (lex->add_create_options_with_check($3))
|
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
|
|
||||||
lex->comment= null_clex_str;
|
|
||||||
lex->ident= $4;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -18170,44 +18170,36 @@ opt_migrate:
|
|||||||
;
|
;
|
||||||
|
|
||||||
install:
|
install:
|
||||||
INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys
|
INSTALL_SYM PLUGIN_SYM opt_if_not_exists ident SONAME_SYM TEXT_STRING_sys
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
if (Lex->stmt_install_plugin($3, $4, $6))
|
||||||
lex->sql_command= SQLCOM_INSTALL_PLUGIN;
|
MYSQL_YYABORT;
|
||||||
lex->comment= $3;
|
|
||||||
lex->ident= $5;
|
|
||||||
}
|
}
|
||||||
| INSTALL_SYM SONAME_SYM TEXT_STRING_sys
|
| INSTALL_SYM SONAME_SYM TEXT_STRING_sys
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
Lex->stmt_install_plugin($3);
|
||||||
lex->sql_command= SQLCOM_INSTALL_PLUGIN;
|
|
||||||
lex->comment= null_clex_str;
|
|
||||||
lex->ident= $3;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
UNINSTALL_SYM PLUGIN_SYM ident
|
UNINSTALL_SYM PLUGIN_SYM opt_if_exists ident
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
if (Lex->stmt_uninstall_plugin_by_name($3, $4))
|
||||||
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
|
MYSQL_YYABORT;
|
||||||
lex->comment= $3;
|
|
||||||
}
|
}
|
||||||
| UNINSTALL_SYM SONAME_SYM TEXT_STRING_sys
|
| UNINSTALL_SYM SONAME_SYM opt_if_exists TEXT_STRING_sys
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
if (Lex->stmt_uninstall_plugin_by_soname($3, $4))
|
||||||
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
|
MYSQL_YYABORT;
|
||||||
lex->comment= null_clex_str;
|
|
||||||
lex->ident= $3;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */
|
/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */
|
||||||
keep_gcc_happy:
|
keep_gcc_happy:
|
||||||
IMPOSSIBLE_ACTION
|
IMPOSSIBLE_ACTION
|
||||||
{
|
{
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user