summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc64
1 files changed, 34 insertions, 30 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d5be2d455ab..f8702657be7 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1261,7 +1261,7 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) ||
mysql_handle_derived(thd->lex, DT_INIT | DT_PREPARE);
thd->pop_internal_handler();
- if (open_error && (thd->killed || thd->is_error()))
+ if (unlikely(open_error && (thd->killed || thd->is_error())))
goto exit;
}
@@ -3815,17 +3815,19 @@ bool schema_table_store_record(THD *thd, TABLE *table)
{
int error;
- if (thd->killed)
+ if (unlikely(thd->killed))
{
thd->send_kill_message();
return 1;
}
- if ((error= table->file->ha_write_tmp_row(table->record[0])))
+ if (unlikely((error= table->file->ha_write_tmp_row(table->record[0]))))
{
TMP_TABLE_PARAM *param= table->pos_in_table_list->schema_table_param;
- if (create_internal_tmp_table_from_heap(thd, table, param->start_recinfo,
- &param->recinfo, error, 0, NULL))
+ if (unlikely(create_internal_tmp_table_from_heap(thd, table,
+ param->start_recinfo,
+ &param->recinfo, error, 0,
+ NULL)))
return 1;
}
@@ -4590,7 +4592,7 @@ fill_schema_table_by_open(THD *thd, MEM_ROOT *mem_root,
else
{
char buf[NAME_CHAR_LEN + 1];
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
get_table_engine_for_i_s(thd, buf, table_list, &db_name, &table_name);
result= schema_table->process_table(thd, table_list,
@@ -4672,13 +4674,14 @@ static int fill_schema_table_names(THD *thd, TABLE_LIST *tables,
else
table->field[3]->store(STRING_WITH_LEN("ERROR"), cs);
- if (thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
+ if (unlikely(thd->is_error() &&
+ thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE))
{
thd->clear_error();
return 0;
}
}
- if (schema_table_store_record(thd, table))
+ if (unlikely(schema_table_store_record(thd, table)))
return 1;
return 0;
}
@@ -5004,7 +5007,7 @@ public:
if (*level != Sql_condition::WARN_LEVEL_ERROR)
return false;
- if (!thd->get_stmt_da()->is_error())
+ if (likely(!thd->get_stmt_da()->is_error()))
thd->get_stmt_da()->set_error_status(sql_errno, msg, sqlstate, *cond_hdl);
return true; // handled!
}
@@ -5129,9 +5132,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
Dynamic_array<LEX_CSTRING*> table_names;
int res= make_table_name_list(thd, &table_names, lex,
&plan->lookup_field_vals, db_name);
- if (res == 2) /* Not fatal error, continue */
+ if (unlikely(res == 2)) /* Not fatal error, continue */
continue;
- if (res)
+ if (unlikely(res))
goto err;
for (size_t i=0; i < table_names.elements(); i++)
@@ -5490,13 +5493,13 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
/* Collect table info from the storage engine */
- if(file)
+ if (file)
{
/* If info() fails, then there's nothing else to do */
- if ((info_error= file->info(HA_STATUS_VARIABLE |
- HA_STATUS_TIME |
- HA_STATUS_VARIABLE_EXTRA |
- HA_STATUS_AUTO)) != 0)
+ if (unlikely((info_error= file->info(HA_STATUS_VARIABLE |
+ HA_STATUS_TIME |
+ HA_STATUS_VARIABLE_EXTRA |
+ HA_STATUS_AUTO)) != 0))
{
file->print_error(info_error, MYF(0));
goto err;
@@ -5595,7 +5598,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
}
err:
- if (res || info_error)
+ if (unlikely(res || info_error))
{
/*
If an error was encountered, push a warning, set the TABLE COMMENT
@@ -6527,7 +6530,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
I.e. we are in SELECT FROM INFORMATION_SCHEMA.STATISTICS
rather than in SHOW KEYS
*/
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -6755,7 +6758,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
- if (res && thd->is_error())
+ if (unlikely(res && thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -6791,7 +6794,7 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
DBUG_ENTER("get_schema_constraints_record");
if (res)
{
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -6925,7 +6928,7 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
*/
if (res)
{
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -6989,7 +6992,7 @@ static int get_schema_key_column_usage_record(THD *thd,
DBUG_ENTER("get_schema_key_column_usage_record");
if (res)
{
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -7276,7 +7279,7 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
if (res)
{
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -7688,8 +7691,9 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
TABLE *table= tables->table;
CHARSET_INFO *cs= system_charset_info;
OPEN_TABLE_LIST *open_list;
- if (!(open_list=list_open_tables(thd,thd->lex->select_lex.db.str, wild))
- && thd->is_fatal_error)
+ if (unlikely(!(open_list= list_open_tables(thd, thd->lex->select_lex.db.str,
+ wild))) &&
+ unlikely(thd->is_fatal_error))
DBUG_RETURN(1);
for (; open_list ; open_list=open_list->next)
@@ -7699,7 +7703,7 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
table->field[1]->store(open_list->table, strlen(open_list->table), cs);
table->field[2]->store((longlong) open_list->in_use, TRUE);
table->field[3]->store((longlong) open_list->locked, TRUE);
- if (schema_table_store_record(thd, table))
+ if (unlikely(schema_table_store_record(thd, table)))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
@@ -7828,7 +7832,7 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables,
if (res)
{
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
@@ -8774,7 +8778,7 @@ bool get_schema_tables_result(JOIN *join,
}
}
thd->pop_internal_handler();
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
{
/*
This hack is here, because I_S code uses thd->clear_error() a lot.
@@ -10273,14 +10277,14 @@ static void get_cs_converted_string_value(THD *thd,
try_val.copy(input_str->ptr(), input_str->length(), cs,
thd->variables.character_set_client, &try_conv_error);
- if (!try_conv_error)
+ if (likely(!try_conv_error))
{
String val;
uint conv_error= 0;
val.copy(input_str->ptr(), input_str->length(), cs,
system_charset_info, &conv_error);
- if (!conv_error)
+ if (likely(!conv_error))
{
append_unescaped(output_str, val.ptr(), val.length());
return;