Commit 590d4737 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: my_printf_error(ER_xxx, ER(ER_xxx), ... )

only use my_print_error when the error message is not
ER(error_code)
parent 605cf619
......@@ -131,7 +131,7 @@ void my_error(uint nr, myf MyFlags, ...)
Print an error message.
@note
Goes through the (sole) function registered in error_handler_hook
Just like my_error, but for cases when the error message is not ER(error)
@param error error number
@param format format string
......
......@@ -8566,14 +8566,12 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
geom_type != Field::GEOM_GEOMETRYCOLLECTION &&
(uint32) geom_type != wkb_type)
{
my_printf_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER_THD(get_thd(), ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
MYF(0),
Geometry::ci_collection[geom_type]->m_name.str,
Geometry::ci_collection[wkb_type]->m_name.str,
field_name,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[geom_type]->m_name.str,
Geometry::ci_collection[wkb_type]->m_name.str,
field_name,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
goto err_exit;
}
......
......@@ -2765,9 +2765,7 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name,
{
THD *thd= current_thd;
if (thd)
my_printf_error(ER_NO_UNIQUE_LOGFILE,
ER_THD(thd, ER_NO_UNIQUE_LOGFILE),
MYF(ME_FATALERROR), log_name);
my_error(ER_NO_UNIQUE_LOGFILE, MYF(ME_FATALERROR), log_name);
sql_print_error(ER_DEFAULT(ER_NO_UNIQUE_LOGFILE), log_name);
return 1;
}
......@@ -5165,9 +5163,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
/* handle reopening errors */
if (error)
{
my_printf_error(ER_CANT_OPEN_FILE,
ER_THD_OR_DEFAULT(current_thd, ER_CANT_OPEN_FILE),
MYF(ME_FATALERROR), file_to_open, error);
my_error(ER_CANT_OPEN_FILE, MYF(ME_FATALERROR), file_to_open, error);
close_on_error= TRUE;
}
......
......@@ -11710,9 +11710,7 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
For the cases in which a 'BINLOG' statement is set to
execute in a user session
*/
my_printf_error(ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
MYF(0), buf);
my_error(ER_SLAVE_FATAL_ERROR, MYF(0), buf);
}
my_free(memory);
......
......@@ -2511,8 +2511,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
table->table ? (long) table->table->s : (long) -1));
DBUG_EXECUTE_IF("bug43138",
my_printf_error(ER_BAD_TABLE_ERROR,
ER_THD(thd, ER_BAD_TABLE_ERROR), MYF(0),
my_error(ER_BAD_TABLE_ERROR, MYF(0),
table->table_name););
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
......@@ -2524,12 +2523,9 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
{
DBUG_ASSERT(errors);
if (errors == 1 && was_view)
my_printf_error(ER_IT_IS_A_VIEW, ER_THD(thd, ER_IT_IS_A_VIEW), MYF(0),
wrong_tables.c_ptr_safe());
my_error(ER_IT_IS_A_VIEW, MYF(0), wrong_tables.c_ptr_safe());
else if (errors > 1 || !thd->is_error())
my_printf_error(ER_BAD_TABLE_ERROR, ER_THD(thd, ER_BAD_TABLE_ERROR),
MYF(0),
wrong_tables.c_ptr_safe());
my_error(ER_BAD_TABLE_ERROR, MYF(0), wrong_tables.c_ptr_safe());
error= 1;
}
......@@ -2909,8 +2905,7 @@ int prepare_create_field(Column_definition *sql_field,
#ifdef HAVE_SPATIAL
if (!(table_flags & HA_CAN_GEOMETRY))
{
my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED),
MYF(0), "GEOMETRY");
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY");
DBUG_RETURN(1);
}
sql_field->pack_flag=FIELDFLAG_GEOM |
......@@ -2923,7 +2918,7 @@ int prepare_create_field(Column_definition *sql_field,
(*blob_columns)++;
break;
#else
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED), MYF(0),
my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
DBUG_RETURN(1);
#endif /*HAVE_SPATIAL*/
......@@ -2938,8 +2933,7 @@ int prepare_create_field(Column_definition *sql_field,
if ((sql_field->length / sql_field->charset->mbmaxlen) >
MAX_FIELD_CHARLENGTH)
{
my_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH),
MYF(0), sql_field->field_name,
my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name,
static_cast<ulong>(MAX_FIELD_CHARLENGTH));
DBUG_RETURN(1);
}
......@@ -3850,9 +3844,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (!my_strcasecmp(system_charset_info,
column->field_name.str, dup_column->field_name.str))
{
my_printf_error(ER_DUP_FIELDNAME,
ER_THD(thd, ER_DUP_FIELDNAME),MYF(0),
column->field_name.str);
my_error(ER_DUP_FIELDNAME, MYF(0), column->field_name.str);
DBUG_RETURN(TRUE);
}
}
......
......@@ -134,8 +134,7 @@ static void my_parse_error_intern(THD *thd, const char *err_text,
/* Push an error into the error stack */
ErrConvString err(yytext, strlen(yytext),
thd->variables.character_set_client);
my_printf_error(ER_PARSE_ERROR, ER_THD(thd, ER_PARSE_ERROR), MYF(0),
err_text, err.ptr(), lip->yylineno);
my_error(ER_PARSE_ERROR, MYF(0), err_text, err.ptr(), lip->yylineno);
}
......
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