summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-06-13 19:29:02 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-05-28 21:00:49 +0300
commit3e9b96b6ff925f83427600956b86a984b726d3af (patch)
tree7c0dd5fe3998a09b5502936aef42c9f10830df52 /sql
parentdac1280a65a97ac49c588d344a33fd7bb49c6737 (diff)
downloadmariadb-git-3e9b96b6ff925f83427600956b86a984b726d3af.tar.gz
MDEV-18794 append_drop_column() small refactoring
Bogus if() logic inside the func.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_table.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2d9e07b9f3e..30b728adf69 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7824,16 +7824,13 @@ blob_length_by_type(enum_field_types type)
}
-static void append_drop_column(THD *thd, bool dont, String *str,
- Field *field)
+static inline
+void append_drop_column(THD *thd, String *str, Field *field)
{
- if (!dont)
- {
- if (str->length())
- str->append(STRING_WITH_LEN(", "));
- str->append(STRING_WITH_LEN("DROP COLUMN "));
- append_identifier(thd, str, &field->field_name);
- }
+ if (str->length())
+ str->append(STRING_WITH_LEN(", "));
+ str->append(STRING_WITH_LEN("DROP COLUMN "));
+ append_identifier(thd, str, &field->field_name);
}
@@ -8088,7 +8085,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
field->invisible < INVISIBLE_SYSTEM)
{
StringBuffer<NAME_LEN*3> tmp;
- append_drop_column(thd, false, &tmp, field);
+ append_drop_column(thd, &tmp, field);
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
goto err;
}
@@ -8141,10 +8138,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
!vers_system_invisible)
{
StringBuffer<NAME_LEN*3> tmp;
- append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_START_FLAG,
- &tmp, table->vers_start_field());
- append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_END_FLAG,
- &tmp, table->vers_end_field());
+ if (!(dropped_sys_vers_fields & VERS_SYS_START_FLAG))
+ append_drop_column(thd, &tmp, table->vers_start_field());
+ if (!(dropped_sys_vers_fields & VERS_SYS_END_FLAG))
+ append_drop_column(thd, &tmp, table->vers_end_field());
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
goto err;
}