Skip to content

Commit c8fd698

Browse files
committed
Change Sysvar
1 parent c21fe14 commit c8fd698

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

sql/sql_table.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10039,6 +10039,11 @@ bool mysql_create_table(THD *thd, Table_ref *create_table,
1003910039
Foreign_key_parents_invalidator fk_invalidator;
1004010040
DBUG_TRACE;
1004110041

10042+
if (thd->variables.my_flag) {
10043+
my_error(ER_ILLEGAL_HA, MYF(0),"Fail on CREATE TABLE");
10044+
return true;
10045+
}
10046+
1004210047
handlerton *actual_hton = get_viable_handlerton_for_create(
1004310048
thd, create_table->table_name, *create_info);
1004410049
if (actual_hton == nullptr) return true;

sql/sys_vars.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,6 +3462,14 @@ static const char *optimizer_switch_names[] = {
34623462
"derived_condition_pushdown",
34633463
"default",
34643464
NullS};
3465+
3466+
3467+
static Sys_var_bool Sys_my_flag(
3468+
"my_flag",
3469+
"Custom flag to control CREATE TABLE behaviour",
3470+
HINT_UPDATEABLE SESSION_VAR(my_flag), CMD_LINE(OPT_ARG),
3471+
DEFAULT(false));
3472+
34653473
static Sys_var_flagset Sys_optimizer_switch(
34663474
"optimizer_switch",
34673475
"optimizer_switch=option=val[,option=val...], where option is one of "

sql/system_variables.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ enum class Explain_format_type : ulong {
201201
*/
202202

203203
struct System_variables {
204+
bool my_flag;
204205
/*
205206
How dynamically allocated system variables are handled:
206207

0 commit comments

Comments
 (0)