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