diff options
author | Monty <monty@mariadb.org> | 2015-07-06 20:24:14 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-07-06 20:24:14 +0300 |
commit | 7332af49e4ce125a5e316e7e0c82d44df4af54c4 (patch) | |
tree | 179f863cbb314d7610bf12e1b0ffb785d6ea26e9 /sql/sql_trigger.cc | |
parent | 8d4d185a08cd758d552d233c26f68af4caa28388 (diff) | |
download | mariadb-git-7332af49e4ce125a5e316e7e0c82d44df4af54c4.tar.gz |
- Renaming variables so that they don't shadow others (After this patch one can compile with -Wshadow and get much fewer warnings)
- Changed ER(ER_...) to ER_THD(thd, ER_...) when thd was known or if there was many calls to current_thd in the same function.
- Changed ER(ER_..) to ER_THD_OR_DEFAULT(current_thd, ER...) in some places where current_thd is not necessary defined.
- Removing calls to current_thd when we have access to thd
Part of this is optimization (not calling current_thd when not needed),
but part is bug fixing for error condition when current_thd is not defined
(For example on startup and end of mysqld)
Notable renames done as otherwise a lot of functions would have to be changed:
- In JOIN structure renamed:
examined_rows -> join_examined_rows
record_count -> join_record_count
- In Field, renamed new_field() to make_new_field()
Other things:
- Added DBUG_ASSERT(thd == tmp_thd) in Item_singlerow_subselect() just to be safe.
- Removed old 'tab' prefix in JOIN_TAB::save_explain_data() and use members directly
- Added 'thd' as argument to a few functions to avoid calling current_thd.
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r-- | sql/sql_trigger.cc | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 54a68da28c9..58fd7aeb7dc 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -159,7 +159,7 @@ Trigger_creation_ctx::create(THD *thd, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_TRG_INVALID_CREATION_CTX, - ER(ER_TRG_INVALID_CREATION_CTX), + ER_THD(thd, ER_TRG_INVALID_CREATION_CTX), (const char *) db_name, (const char *) table_name); } @@ -340,11 +340,11 @@ public: m_trigger_name= &thd->lex->spname->m_name; if (m_trigger_name) my_snprintf(m_message, sizeof(m_message), - ER(ER_ERROR_IN_TRIGGER_BODY), + ER_THD(thd, ER_ERROR_IN_TRIGGER_BODY), m_trigger_name->str, message); else my_snprintf(m_message, sizeof(m_message), - ER(ER_ERROR_IN_UNKNOWN_TRIGGER_BODY), message); + ER_THD(thd, ER_ERROR_IN_UNKNOWN_TRIGGER_BODY), message); return true; } return false; @@ -801,7 +801,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, else if (lex->create_info.if_not_exists()) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), + ER_TRG_ALREADY_EXISTS, + ER_THD(thd, ER_TRG_ALREADY_EXISTS), trigname_buff); LEX_STRING trg_definer_tmp; build_trig_stmt_query(thd, tables, stmt_query, @@ -1042,7 +1043,8 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, } } - my_message(ER_TRG_DOES_NOT_EXIST, ER(ER_TRG_DOES_NOT_EXIST), MYF(0)); + my_message(ER_TRG_DOES_NOT_EXIST, ER_THD(thd, ER_TRG_DOES_NOT_EXIST), + MYF(0)); return 1; } @@ -1086,8 +1088,8 @@ bool Table_triggers_list::prepare_record1_accessors(TABLE *table) QQ: it is supposed that it is ok to use this function for field cloning... */ - if (!(*old_fld= (*fld)->new_field(&table->mem_root, table, - table == (*fld)->table))) + if (!(*old_fld= (*fld)->make_new_field(&table->mem_root, table, + table == (*fld)->table))) return 1; (*old_fld)->move_field_offset((my_ptrdiff_t)(table->record[1] - table->record[0])); @@ -1275,7 +1277,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_TRG_NO_CREATION_CTX, - ER(ER_TRG_NO_CREATION_CTX), + ER_THD(thd, ER_TRG_NO_CREATION_CTX), (const char*) db, (const char*) table_name); @@ -1458,7 +1460,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, */ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER), + ER_TRG_NO_DEFINER, + ER_THD(thd, ER_TRG_NO_DEFINER), (const char*) db, (const char*) sp->m_name.str); @@ -1732,7 +1735,7 @@ bool add_table_for_trigger(THD *thd, push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_TRG_DOES_NOT_EXIST, - ER(ER_TRG_DOES_NOT_EXIST)); + ER_THD(thd, ER_TRG_DOES_NOT_EXIST)); *table= NULL; @@ -2327,13 +2330,14 @@ process_unknown_string(const char *&unknown_key, uchar* base, unknown_key[INVALID_SQL_MODES_LENGTH] == '=' && !memcmp(unknown_key, STRING_WITH_LEN("sql_modes"))) { + THD *thd= current_thd; const char *ptr= unknown_key + INVALID_SQL_MODES_LENGTH + 1; DBUG_PRINT("info", ("sql_modes affected by BUG#14090 detected")); - push_warning_printf(current_thd, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_OLD_FILE_FORMAT, - ER(ER_OLD_FILE_FORMAT), + ER_THD(thd, ER_OLD_FILE_FORMAT), (char *)path, "TRIGGER"); if (get_file_options_ulllist(ptr, end, unknown_key, base, &sql_modes_parameters, mem_root)) @@ -2368,13 +2372,14 @@ process_unknown_string(const char *&unknown_key, uchar* base, unknown_key[INVALID_TRIGGER_TABLE_LENGTH] == '=' && !memcmp(unknown_key, STRING_WITH_LEN("trigger_table"))) { + THD *thd= current_thd; const char *ptr= unknown_key + INVALID_TRIGGER_TABLE_LENGTH + 1; DBUG_PRINT("info", ("trigger_table affected by BUG#15921 detected")); - push_warning_printf(current_thd, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_OLD_FILE_FORMAT, - ER(ER_OLD_FILE_FORMAT), + ER_THD(thd, ER_OLD_FILE_FORMAT), (char *)path, "TRIGGER"); if (!(ptr= parse_escaped_string(ptr, end, mem_root, trigger_table_value))) |