Skip to content
Permalink
Browse files

cleanup: remove duplicate code

  • Loading branch information...
vuvova committed Jun 13, 2017
1 parent 918e470 commit 5cbbfe9f54f15a5281439dc21f22b599a69b5f87
Showing with 15 additions and 24 deletions.
  1. +14 −23 sql/sql_partition.cc
  2. +1 −1 sql/sql_priv.h
@@ -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

0 comments on commit 5cbbfe9

Please sign in to comment.
You can’t perform that action at this time.