Commit 9472f0f4 authored by Alexander Barkov's avatar Alexander Barkov

Adding "const" qualifier into a few methods and parameters in the LOAD code

Methods:
- Item_user_var_as_out_param::print_for_load()
- sql_exchange::escaped_given(void)

Parameters:
- sql_exchange in write_execute_load_query_log_event()
- sql_exchange in mysql_load()
- sql_exchange in Load_log_event::Load_log_event()

Also, removing cast to "char*" in a few places in
Load_log_event::Load_log_event()
parent d5099814
......@@ -5585,7 +5585,7 @@ bool Item_user_var_as_out_param::get_date(MYSQL_TIME *ltime, ulonglong fuzzy)
}
void Item_user_var_as_out_param::print_for_load(THD *thd, String *str)
void Item_user_var_as_out_param::print_for_load(THD *thd, String *str) const
{
str->append('@');
append_identifier(thd, str, &org_name);
......
......@@ -2507,7 +2507,7 @@ class Item_user_var_as_out_param :public Item
my_decimal *val_decimal(my_decimal *decimal_buffer);
/* fix_fields() binds variable name with its entry structure */
bool fix_fields(THD *thd, Item **ref);
void print_for_load(THD *thd, String *str);
void print_for_load(THD *thd, String *str) const;
void set_null_value(CHARSET_INFO* cs);
void set_value(const char *str, uint length, CHARSET_INFO* cs);
const Type_handler *type_handler() const { return &type_handler_double; }
......
......@@ -6832,7 +6832,7 @@ bool Load_log_event::write_data_body()
Load_log_event::Load_log_event()
*/
Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
Load_log_event::Load_log_event(THD *thd_arg, const sql_exchange *ex,
const char *db_arg, const char *table_name_arg,
List<Item> &fields_arg,
bool is_concurrent_arg,
......@@ -6856,15 +6856,15 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
db_len = (uint32) strlen(db);
table_name_len = (uint32) strlen(table_name);
fname_len = (fname) ? (uint) strlen(fname) : 0;
sql_ex.field_term = (char*) ex->field_term->ptr();
sql_ex.field_term = ex->field_term->ptr();
sql_ex.field_term_len = (uint8) ex->field_term->length();
sql_ex.enclosed = (char*) ex->enclosed->ptr();
sql_ex.enclosed = ex->enclosed->ptr();
sql_ex.enclosed_len = (uint8) ex->enclosed->length();
sql_ex.line_term = (char*) ex->line_term->ptr();
sql_ex.line_term = ex->line_term->ptr();
sql_ex.line_term_len = (uint8) ex->line_term->length();
sql_ex.line_start = (char*) ex->line_start->ptr();
sql_ex.line_start = ex->line_start->ptr();
sql_ex.line_start_len = (uint8) ex->line_start->length();
sql_ex.escaped = (char*) ex->escaped->ptr();
sql_ex.escaped = ex->escaped->ptr();
sql_ex.escaped_len = (uint8) ex->escaped->length();
sql_ex.opt_flags = 0;
sql_ex.cached_new_format = -1;
......
......@@ -2514,7 +2514,7 @@ class Load_log_event: public Log_event
String field_lens_buf;
String fields_buf;
Load_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
Load_log_event(THD* thd, const sql_exchange* ex, const char* db_arg,
const char* table_name_arg,
List<Item>& fields_arg,
bool is_concurrent_arg,
......
......@@ -2945,7 +2945,7 @@ sql_exchange::sql_exchange(const char *name, bool flag,
cs= NULL;
}
bool sql_exchange::escaped_given(void)
bool sql_exchange::escaped_given(void) const
{
return escaped != &default_escaped;
}
......
......@@ -4832,7 +4832,7 @@ class sql_exchange :public Sql_alloc
CHARSET_INFO *cs;
sql_exchange(const char *name, bool dumpfile_flag,
enum_filetype filetype_arg= FILETYPE_CSV);
bool escaped_given(void);
bool escaped_given(void) const;
};
/*
......
......@@ -280,7 +280,7 @@ static int read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
bool ignore_check_option_errors);
#ifndef EMBEDDED_LIBRARY
static bool write_execute_load_query_log_event(THD *, sql_exchange*, const
static bool write_execute_load_query_log_event(THD *, const sql_exchange*, const
char*, const char*, bool, enum enum_duplicates, bool, bool, int);
#endif /* EMBEDDED_LIBRARY */
......@@ -305,7 +305,7 @@ static bool write_execute_load_query_log_event(THD *, sql_exchange*, const
TRUE - error / FALSE - success
*/
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values,
enum enum_duplicates handle_duplicates, bool ignore,
......@@ -803,7 +803,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
#ifndef EMBEDDED_LIBRARY
/* Not a very useful function; just to avoid duplication of code */
static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
static bool write_execute_load_query_log_event(THD *thd, const sql_exchange* ex,
const char* db_arg, /* table's database */
const char* table_name_arg,
bool is_concurrent,
......
......@@ -24,7 +24,7 @@ class Item;
class sql_exchange;
int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values_list,
enum enum_duplicates handle_duplicates, bool ignore,
......
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