Commit 5cbbfe9f authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: remove duplicate code

parent 918e4703
......@@ -1913,6 +1913,19 @@ static int add_subpartition_by(File fptr)
return err + add_partition_by(fptr);
}
static int add_name_string(File fptr, const char *name)
{
int err;
String name_string("", 0, system_charset_info);
THD *thd= current_thd;
ulonglong save_options= thd->variables.option_bits;
thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE;
append_identifier(thd, &name_string, name, strlen(name));
thd->variables.option_bits= save_options;
err= add_string_object(fptr, &name_string);
return err;
}
static int add_part_field_list(File fptr, List<char> field_list)
{
uint i, num_fields;
......@@ -1924,15 +1937,7 @@ static int add_part_field_list(File fptr, List<char> field_list)
err+= add_begin_parenthesis(fptr);
while (i < num_fields)
{
const char *field_str= part_it++;
String field_string("", 0, system_charset_info);
THD *thd= current_thd;
ulonglong save_options= thd->variables.option_bits;
thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE;
append_identifier(thd, &field_string, field_str,
strlen(field_str));
thd->variables.option_bits= save_options;
err+= add_string_object(fptr, &field_string);
err+= add_name_string(fptr, part_it++);
if (i != (num_fields-1))
err+= add_comma(fptr);
i++;
......@@ -1941,20 +1946,6 @@ static int add_part_field_list(File fptr, List<char> field_list)
return err;
}
static int add_name_string(File fptr, const char *name)
{
int err;
String name_string("", 0, system_charset_info);
THD *thd= current_thd;
ulonglong save_options= thd->variables.option_bits;
thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE;
append_identifier(thd, &name_string, name,
strlen(name));
thd->variables.option_bits= save_options;
err= add_string_object(fptr, &name_string);
return err;
}
static int add_int(File fptr, longlong number)
{
char buff[32];
......
......@@ -121,7 +121,7 @@
#define OPTION_AUTOCOMMIT (1ULL << 8) // THD, user
#define OPTION_BIG_SELECTS (1ULL << 9) // THD, user
#define OPTION_LOG_OFF (1ULL << 10) // THD, user
#define OPTION_QUOTE_SHOW_CREATE (1ULL << 11) // THD, user, unused
#define OPTION_QUOTE_SHOW_CREATE (1ULL << 11) // THD, user
#define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern
#define OPTION_WARNINGS (1ULL << 13) // THD, user
#define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment