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_admin.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_admin.cc')
-rw-r--r-- | sql/sql_admin.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 5b64a792016..d917bd69f72 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -496,7 +496,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, protocol->store(operator_name, system_charset_info); protocol->store(STRING_WITH_LEN("error"), system_charset_info); length= my_snprintf(buff, sizeof(buff), - ER(ER_DROP_PARTITION_NON_EXISTENT), + ER_THD(thd, ER_DROP_PARTITION_NON_EXISTENT), table_name); protocol->store(buff, length, system_charset_info); if(protocol->write()) @@ -545,12 +545,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, DBUG_PRINT("admin", ("open table failed")); if (thd->get_stmt_da()->is_warning_info_empty()) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, - ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE)); + ER_CHECK_NO_SUCH_TABLE, + ER_THD(thd, ER_CHECK_NO_SUCH_TABLE)); /* if it was a view will check md5 sum */ if (table->view && view_check(thd, table, check_opt) == HA_ADMIN_WRONG_CHECKSUM) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, - ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM)); + ER_VIEW_CHECKSUM, ER_THD(thd, ER_VIEW_CHECKSUM)); if (thd->get_stmt_da()->is_error() && table_not_corrupt_error(thd->get_stmt_da()->sql_errno())) result_code= HA_ADMIN_FAILED; @@ -584,7 +585,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, protocol->store(table_name, system_charset_info); protocol->store(operator_name, system_charset_info); protocol->store(STRING_WITH_LEN("error"), system_charset_info); - length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY), + length= my_snprintf(buff, sizeof(buff), ER_THD(thd, ER_OPEN_AS_READONLY), table_name); protocol->store(buff, length, system_charset_info); trans_commit_stmt(thd); @@ -813,7 +814,8 @@ send_result_message: { char buf[MYSQL_ERRMSG_SIZE]; size_t length=my_snprintf(buf, sizeof(buf), - ER(ER_CHECK_NOT_IMPLEMENTED), operator_name); + ER_THD(thd, ER_CHECK_NOT_IMPLEMENTED), + operator_name); protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); } @@ -823,7 +825,8 @@ send_result_message: { char buf[MYSQL_ERRMSG_SIZE]; size_t length= my_snprintf(buf, sizeof(buf), - ER(ER_BAD_TABLE_ERROR), table_name); + ER_THD(thd, ER_BAD_TABLE_ERROR), + table_name); protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); } @@ -968,7 +971,8 @@ send_result_message: case HA_ADMIN_WRONG_CHECKSUM: { protocol->store(STRING_WITH_LEN("note"), system_charset_info); - protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)), + protocol->store(ER_THD(thd, ER_VIEW_CHECKSUM), + strlen(ER_THD(thd, ER_VIEW_CHECKSUM)), system_charset_info); break; } @@ -983,10 +987,12 @@ send_result_message: protocol->store(STRING_WITH_LEN("error"), system_charset_info); if (what_to_upgrade) - length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE), + length= my_snprintf(buf, sizeof(buf), + ER_THD(thd, ER_TABLE_NEEDS_UPGRADE), what_to_upgrade, table->table_name); else - length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_REBUILD), + length= my_snprintf(buf, sizeof(buf), + ER_THD(thd, ER_TABLE_NEEDS_REBUILD), table->table_name); protocol->store(buf, length, system_charset_info); fatal_error=1; |