Skip to content

Commit 3e9b96b

Browse files
committed
MDEV-18794 append_drop_column() small refactoring
Bogus if() logic inside the func.
1 parent dac1280 commit 3e9b96b

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

sql/sql_table.cc

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7824,16 +7824,13 @@ blob_length_by_type(enum_field_types type)
78247824
}
78257825

78267826

7827-
static void append_drop_column(THD *thd, bool dont, String *str,
7828-
Field *field)
7827+
static inline
7828+
void append_drop_column(THD *thd, String *str, Field *field)
78297829
{
7830-
if (!dont)
7831-
{
7832-
if (str->length())
7833-
str->append(STRING_WITH_LEN(", "));
7834-
str->append(STRING_WITH_LEN("DROP COLUMN "));
7835-
append_identifier(thd, str, &field->field_name);
7836-
}
7830+
if (str->length())
7831+
str->append(STRING_WITH_LEN(", "));
7832+
str->append(STRING_WITH_LEN("DROP COLUMN "));
7833+
append_identifier(thd, str, &field->field_name);
78377834
}
78387835

78397836

@@ -8088,7 +8085,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
80888085
field->invisible < INVISIBLE_SYSTEM)
80898086
{
80908087
StringBuffer<NAME_LEN*3> tmp;
8091-
append_drop_column(thd, false, &tmp, field);
8088+
append_drop_column(thd, &tmp, field);
80928089
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
80938090
goto err;
80948091
}
@@ -8141,10 +8138,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
81418138
!vers_system_invisible)
81428139
{
81438140
StringBuffer<NAME_LEN*3> tmp;
8144-
append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_START_FLAG,
8145-
&tmp, table->vers_start_field());
8146-
append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_END_FLAG,
8147-
&tmp, table->vers_end_field());
8141+
if (!(dropped_sys_vers_fields & VERS_SYS_START_FLAG))
8142+
append_drop_column(thd, &tmp, table->vers_start_field());
8143+
if (!(dropped_sys_vers_fields & VERS_SYS_END_FLAG))
8144+
append_drop_column(thd, &tmp, table->vers_end_field());
81488145
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
81498146
goto err;
81508147
}

0 commit comments

Comments
 (0)