diff options
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 57da25b5800..c3fc62f5f5d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -637,7 +637,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) protocol_text(this), protocol_binary(this), initial_status_var(0), m_current_stage_key(0), m_psi(0), in_sub_stmt(0), log_all_errors(0), - binlog_unsafe_warning_flags(0), + binlog_unsafe_warning_flags(0), used(0), current_stmt_binlog_format(BINLOG_FORMAT_MIXED), bulk_param(0), table_map_for_update(0), @@ -657,8 +657,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) is_fatal_error(0), transaction_rollback_request(0), is_fatal_sub_stmt_error(false), - rand_used(0), - time_zone_used(0), in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE), @@ -771,11 +769,10 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) security_ctx= &main_security_ctx; no_errors= 0; password= 0; - query_start_sec_part_used= 0; count_cuted_fields= CHECK_FIELD_IGNORE; killed= NOT_KILLED; killed_err= 0; - is_slave_error= thread_specific_used= FALSE; + is_slave_error= FALSE; my_hash_clear(&handler_tables_hash); my_hash_clear(&ull_hash); tmp_table=0; @@ -2099,7 +2096,8 @@ int THD::killed_errno() DBUG_RETURN(ER_QUERY_INTERRUPTED); case KILL_TIMEOUT: case KILL_TIMEOUT_HARD: - DBUG_RETURN(ER_STATEMENT_TIMEOUT); + DBUG_RETURN(slave_thread ? + ER_SLAVE_STATEMENT_TIMEOUT : ER_STATEMENT_TIMEOUT); case KILL_SERVER: case KILL_SERVER_HARD: DBUG_RETURN(ER_SERVER_SHUTDOWN); @@ -2235,13 +2233,13 @@ void THD::cleanup_after_query() thd_progress_end(this); /* - Reset rand_used so that detection of calls to rand() will save random + Reset RAND_USED so that detection of calls to rand() will save random seeds if needed by the slave. - Do not reset rand_used if inside a stored function or trigger because + Do not reset RAND_USED if inside a stored function or trigger because only the call to these operations is logged. Thus only the calling statement needs to detect rand() calls made by its substatements. These - substatements must not set rand_used to 0 because it would remove the + substatements must not set RAND_USED to 0 because it would remove the detection of rand() by the calling statement. */ if (!in_sub_stmt) /* stored functions and triggers are a special case */ @@ -2249,7 +2247,7 @@ void THD::cleanup_after_query() /* Forget those values, for next binlogger: */ stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; auto_inc_intervals_in_cur_stmt_for_binlog.empty(); - rand_used= 0; + used&= ~THD::RAND_USED; #ifndef EMBEDDED_LIBRARY /* Clean possible unused INSERT_ID events by current statement. @@ -7588,7 +7586,7 @@ MYSQL_TIME THD::query_start_TIME() MYSQL_TIME res; variables.time_zone->gmt_sec_to_TIME(&res, query_start()); res.second_part= query_start_sec_part(); - time_zone_used= 1; + used|= TIME_ZONE_USED; return res; } @@ -8327,7 +8325,7 @@ Query_arena_stmt::~Query_arena_stmt() bool THD::timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts, ulong sec_part, date_mode_t fuzzydate) { - time_zone_used= 1; + used|= TIME_ZONE_USED; if (ts == 0 && sec_part == 0) { if (fuzzydate & TIME_NO_ZERO_DATE) @@ -8370,3 +8368,21 @@ THD::charset_collation_context_alter_table(const TABLE_SHARE *s) return Charset_collation_context(get_default_db_collation(this, s->db.str), s->table_charset); } + + +void Charset_loader_server::raise_unknown_collation_error(const char *name) const +{ + ErrConvString err(name, &my_charset_utf8mb4_general_ci); + my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr()); + if (error[0]) + push_warning_printf(current_thd, + Sql_condition::WARN_LEVEL_WARN, + ER_UNKNOWN_COLLATION, "%s", error); +} + + +void Charset_loader_server::raise_not_applicable_error(const char *cs, + const char *cl) const +{ + my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), cl, cs); +} |