post-review fixes

This commit is contained in:
bell@sanja.is.com.ua 2004-11-12 14:34:00 +02:00
parent 5bf7a8c30b
commit 31f7811183
53 changed files with 938 additions and 593 deletions

View File

@ -1,7 +1,7 @@
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
start slave; start slave;
ERROR HY000: File '/home/bell/mysql/bk/work-error-5.0/mysql-test/var/slave-data/master.info' not found (Errcode: 13) ERROR HY000: File 'TESTDIR/var/slave-data/master.info' not found (Errcode: 13)
start slave; start slave;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';

View File

@ -23,6 +23,7 @@ drop table if exists t1, t2, t3, t4;
# START SLAVE will fail because it can't read the file (mode 000) # START SLAVE will fail because it can't read the file (mode 000)
# (system error 13) # (system error 13)
--replace_result $MYSQL_TEST_DIR TESTDIR
--error 1105 --error 1105
start slave; start slave;
system chmod 600 var/slave-data/master.info; system chmod 600 var/slave-data/master.info;

View File

@ -22,6 +22,18 @@
/* Define some external variables for error handling */ /* Define some external variables for error handling */
/*
WARNING!
my_error family functions have to be used according following rules:
- if message have not parameters use my_message(ER_CODE, ER(ER_CODE), MYF(N))
- if message have only integer parameters, string constants (created
inside program) or string put (and cut if it is need) in some limited
length buffer before passing it as parameter then you can use
my_error(ER_CODE, MYF(N), ...). Never pass string get from user to
my_error.
- in all other cases use my_printf_error(ER_CODE, ER(ER_CODE), MYF(N), ...)
*/
const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0}; const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0};
char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE]; char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];

View File

@ -278,7 +278,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
} }
} }
if (error) if (error)
my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG)); my_message(ER_FILSORT_ABORT, ER(ER_FILSORT_ABORT),
MYF(ME_ERROR+ME_WAITTANG));
else else
statistic_add(thd->status_var.filesort_rows, statistic_add(thd->status_var.filesort_rows,
(ulong) records, &LOCK_status); (ulong) records, &LOCK_status);

View File

@ -462,8 +462,10 @@ innobase_mysql_tmpfile(void)
if (fd2 < 0) { if (fd2 < 0) {
DBUG_PRINT("error",("Got error %d on dup",fd2)); DBUG_PRINT("error",("Got error %d on dup",fd2));
my_errno=errno; my_errno=errno;
my_error(EE_OUT_OF_FILERESOURCES, my_printf_error(EE_OUT_OF_FILERESOURCES,
MYF(ME_BELL+ME_WAITTANG), filename, my_errno); ER(EE_OUT_OF_FILERESOURCES),
MYF(ME_BELL+ME_WAITTANG),
filename, my_errno);
} }
my_close(fd, MYF(MY_WME)); my_close(fd, MYF(MY_WME));
} }

View File

@ -515,7 +515,8 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
if ((error=ndbcluster_commit(thd,trans->ndb_tid))) if ((error=ndbcluster_commit(thd,trans->ndb_tid)))
{ {
if (error == -1) if (error == -1)
my_error(ER_ERROR_DURING_COMMIT, MYF(0)); my_message_(ER_ERROR_DURING_COMMIT, ER(ER_ERROR_DURING_COMMIT),
MYF(0));
error=1; error=1;
} }
if (trans == &thd->transaction.all) if (trans == &thd->transaction.all)
@ -584,7 +585,8 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
if ((error=ndbcluster_rollback(thd, trans->ndb_tid))) if ((error=ndbcluster_rollback(thd, trans->ndb_tid)))
{ {
if (error == -1) if (error == -1)
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0)); my_message(ER_ERROR_DURING_ROLLBACK, ER(ER_ERROR_DURING_ROLLBACK),
MYF(0));
error=1; error=1;
} }
trans->ndb_tid = 0; trans->ndb_tid = 0;
@ -1183,7 +1185,8 @@ void handler::print_error(int error, myf errflag)
str.length(max_length-4); str.length(max_length-4);
str.append("..."); str.append("...");
} }
my_error(ER_DUP_ENTRY,MYF(0),str.c_ptr(),key_nr+1); my_printf_error(ER_DUP_ENTRY, ER(ER_DUP_ENTRY), MYF(0),
str.c_ptr(), key_nr+1);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
textno=ER_DUP_KEY; textno=ER_DUP_KEY;
@ -1205,7 +1208,7 @@ void handler::print_error(int error, myf errflag)
textno=ER_CRASHED_ON_REPAIR; textno=ER_CRASHED_ON_REPAIR;
break; break;
case HA_ERR_OUT_OF_MEM: case HA_ERR_OUT_OF_MEM:
my_error(ER_OUT_OF_RESOURCES,errflag); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), errflag);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
case HA_ERR_WRONG_COMMAND: case HA_ERR_WRONG_COMMAND:
textno=ER_ILLEGAL_HA; textno=ER_ILLEGAL_HA;
@ -1251,9 +1254,13 @@ void handler::print_error(int error, myf errflag)
{ {
const char* engine= table_type(); const char* engine= table_type();
if (temporary) if (temporary)
my_error(ER_GET_TEMPORARY_ERRMSG,MYF(0),error,str.ptr(),engine); my_printf_error(ER_GET_TEMPORARY_ERRMSG,
ER(ER_GET_TEMPORARY_ERRMSG), MYF(0),
error, str.ptr(), engine);
else else
my_error(ER_GET_ERRMSG,MYF(0),error,str.ptr(),engine); my_printf_error(ER_GET_ERRMSG,
ER(ER_GET_ERRMSG), MYF(0),
error, str.ptr(), engine);
} }
else else
my_error(ER_GET_ERRNO,errflag,error); my_error(ER_GET_ERRNO,errflag,error);
@ -1381,7 +1388,9 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
error=table.file->create(name,&table,create_info); error=table.file->create(name,&table,create_info);
VOID(closefrm(&table)); VOID(closefrm(&table));
if (error) if (error)
my_error(ER_CANT_CREATE_TABLE,MYF(ME_BELL+ME_WAITTANG),name,error); my_printf_error(ER_CANT_CREATE_TABLE, ER(ER_CANT_CREATE_TABLE),
MYF(ME_BELL+ME_WAITTANG),
name,error);
DBUG_RETURN(error != 0); DBUG_RETURN(error != 0);
} }

View File

@ -1512,8 +1512,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{ {
if (!(*refer)->fixed) if (!(*refer)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_printf_error(ER_ILLEGAL_REFERENCE, ER(ER_ILLEGAL_REFERENCE),
"forward reference in item list"); MYF(0), name, "forward reference in item list");
return TRUE; return TRUE;
} }
@ -2418,8 +2418,9 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
{ {
if (!(*ref)->fixed) if (!(*ref)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_printf_error(ER_ILLEGAL_REFERENCE,
"forward reference in item list"); ER(ER_ILLEGAL_REFERENCE), MYF(0),
name, "forward reference in item list");
return TRUE; return TRUE;
} }
mark_as_dependent(thd, last, thd->lex->current_select, mark_as_dependent(thd, last, thd->lex->current_select,
@ -2433,8 +2434,9 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
{ {
if (!(*ref)->fixed) if (!(*ref)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_printf_error(ER_ILLEGAL_REFERENCE,
"forward reference in item list"); ER(ER_ILLEGAL_REFERENCE), MYF(0),
name, "forward reference in item list");
return TRUE; return TRUE;
} }
ref= thd->lex->current_select->ref_pointer_array + counter; ref= thd->lex->current_select->ref_pointer_array + counter;
@ -2454,10 +2456,11 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
thd->lex->current_select->having_fix_field))) || thd->lex->current_select->having_fix_field))) ||
!(*ref)->fixed) !(*ref)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_printf_error(ER_ILLEGAL_REFERENCE, ER(ER_ILLEGAL_REFERENCE), MYF(0),
((*ref)->with_sum_func? name,
"reference on group function": ((*ref)->with_sum_func?
"forward reference in item list")); "reference on group function":
"forward reference in item list"));
return TRUE; return TRUE;
} }
max_length= (*ref)->max_length; max_length= (*ref)->max_length;
@ -3115,11 +3118,12 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
*old_derivation= collation.derivation_name(); *old_derivation= collation.derivation_name();
if (item_type == STRING_RESULT && collation.aggregate(item->collation)) if (item_type == STRING_RESULT && collation.aggregate(item->collation))
{ {
my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0), my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
old_cs, old_derivation, ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
item->collation.collation->name, old_cs, old_derivation,
item->collation.derivation_name(), item->collation.collation->name,
"UNION"); item->collation.derivation_name(),
"UNION");
return 1; return 1;
} }

View File

@ -53,10 +53,11 @@ static void agg_cmp_type(Item_result *type, Item **items, uint nitems)
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname)
{ {
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
c1.collation->name,c1.derivation_name(), ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
c2.collation->name,c2.derivation_name(), c1.collation->name,c1.derivation_name(),
fname); c2.collation->name,c2.derivation_name(),
fname);
} }

View File

@ -45,10 +45,11 @@ bool check_reserved_words(LEX_STRING *name)
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname) const char *fname)
{ {
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
c1.collation->name,c1.derivation_name(), ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
c2.collation->name,c2.derivation_name(), c1.collation->name, c1.derivation_name(),
fname); c2.collation->name, c2.derivation_name(),
fname);
} }
static void my_coll_agg_error(DTCollation &c1, static void my_coll_agg_error(DTCollation &c1,
@ -56,11 +57,12 @@ static void my_coll_agg_error(DTCollation &c1,
DTCollation &c3, DTCollation &c3,
const char *fname) const char *fname)
{ {
my_error(ER_CANT_AGGREGATE_3COLLATIONS,MYF(0), my_printf_error(ER_CANT_AGGREGATE_3COLLATIONS,
c1.collation->name,c1.derivation_name(), ER(ER_CANT_AGGREGATE_3COLLATIONS), MYF(0),
c2.collation->name,c2.derivation_name(), c1.collation->name, c1.derivation_name(),
c3.collation->name,c3.derivation_name(), c2.collation->name, c2.derivation_name(),
fname); c3.collation->name, c3.derivation_name(),
fname);
} }
@ -74,7 +76,8 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname)
args[2]->collation, args[2]->collation,
fname); fname);
else else
my_error(ER_CANT_AGGREGATE_NCOLLATIONS,MYF(0),fname); my_printf_error(ER_CANT_AGGREGATE_NCOLLATIONS,
ER(ER_CANT_AGGREGATE_NCOLLATIONS), MYF(0),fname);
} }
@ -3112,7 +3115,8 @@ err:
key=NO_SUCH_KEY; key=NO_SUCH_KEY;
return 0; return 0;
} }
my_error(ER_FT_MATCHING_KEY_NOT_FOUND,MYF(0)); my_message(ER_FT_MATCHING_KEY_NOT_FOUND,
ER(ER_FT_MATCHING_KEY_NOT_FOUND), MYF(0));
return 1; return 1;
} }
@ -3241,7 +3245,8 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
{ {
if (!var->is_struct()) if (!var->is_struct())
{ {
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), base_name->str); my_printf_error(ER_VARIABLE_IS_NOT_STRUCT, ER(ER_VARIABLE_IS_NOT_STRUCT),
MYF(0), base_name->str);
return 0; return 0;
} }
} }

View File

@ -42,10 +42,11 @@ String my_empty_string("",default_charset_info);
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname) const char *fname)
{ {
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
c1.collation->name,c1.derivation_name(), ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
c2.collation->name,c2.derivation_name(), c1.collation->name, c1.derivation_name(),
fname); c2.collation->name, c2.derivation_name(),
fname);
} }
uint nr_of_decimals(const char *str) uint nr_of_decimals(const char *str)
@ -2243,7 +2244,8 @@ void Item_func_set_collation::fix_length_and_dec()
{ {
if (!(set_collation= get_charset_by_name(colname,MYF(0)))) if (!(set_collation= get_charset_by_name(colname,MYF(0))))
{ {
my_error(ER_UNKNOWN_COLLATION, MYF(0), colname); my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
colname);
return; return;
} }
} }
@ -2251,8 +2253,9 @@ void Item_func_set_collation::fix_length_and_dec()
if (!set_collation || if (!set_collation ||
!my_charset_same(args[0]->collation.collation,set_collation)) !my_charset_same(args[0]->collation.collation,set_collation))
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
colname,args[0]->collation.collation->csname); ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
colname, args[0]->collation.collation->csname);
return; return;
} }
collation.set(set_collation, DERIVATION_EXPLICIT); collation.set(set_collation, DERIVATION_EXPLICIT);

View File

@ -167,7 +167,8 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
// We can't substitute aggregate functions like "SELECT (max(i))" // We can't substitute aggregate functions like "SELECT (max(i))"
if (substype() == SINGLEROW_SUBS && (*ref)->with_sum_func) if (substype() == SINGLEROW_SUBS && (*ref)->with_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0)); my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
MYF(0));
return TRUE; return TRUE;
} }
return ret; return ret;

View File

@ -220,7 +220,8 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (!thd->allow_sum_func) if (!thd->allow_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
MYF(0));
return TRUE; return TRUE;
} }
thd->allow_sum_func=0; // No included group funcs thd->allow_sum_func=0; // No included group funcs
@ -255,7 +256,8 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item *item= args[0]; Item *item= args[0];
if (!thd->allow_sum_func) if (!thd->allow_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
MYF(0));
return TRUE; return TRUE;
} }
thd->allow_sum_func=0; // No included group funcs thd->allow_sum_func=0; // No included group funcs
@ -2065,7 +2067,8 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (!thd->allow_sum_func) if (!thd->allow_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
MYF(0));
return TRUE; return TRUE;
} }

View File

@ -430,7 +430,8 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*write_lock_used=table; *write_lock_used=table;
if (table->db_stat & HA_READ_ONLY) if (table->db_stat & HA_READ_ONLY)
{ {
my_error(ER_OPEN_AS_READONLY,MYF(0),table->table_name); my_printf_error(ER_OPEN_AS_READONLY, ER(ER_OPEN_AS_READONLY), MYF(0),
table->table_name);
my_free((gptr) sql_lock,MYF(0)); my_free((gptr) sql_lock,MYF(0));
return 0; return 0;
} }
@ -794,7 +795,8 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
{ {
if (thd->global_read_lock) // This thread had the read locks if (thd->global_read_lock) // This thread had the read locks
{ {
my_error(ER_CANT_UPDATE_WITH_READLOCK,MYF(0)); my_message(ER_CANT_UPDATE_WITH_READLOCK,
ER(ER_CANT_UPDATE_WITH_READLOCK), MYF(0));
(void) pthread_mutex_unlock(&LOCK_open); (void) pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View File

@ -1515,9 +1515,10 @@ err:
if (error) if (error)
{ {
if (my_errno == EFBIG) if (my_errno == EFBIG)
my_error(ER_TRANS_CACHE_FULL, MYF(0)); my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(0));
else else
my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno); my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
name, errno);
write_error=1; write_error=1;
} }
if (file == &log_file) if (file == &log_file)

View File

@ -608,8 +608,8 @@ bool mysql_rename_table(enum db_type base,
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys); bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list, bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
ALTER_INFO *alter_info); ALTER_INFO *alter_info);
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list, bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
Item **conds, uint order_num, ORDER *order); Item **conds, uint order_num, ORDER *order);
bool mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields, bool mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &values,COND *conds, List<Item> &values,COND *conds,
uint order_num, ORDER *order, ha_rows limit, uint order_num, ORDER *order, ha_rows limit,
@ -813,8 +813,10 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table,
bool return_if_owned_by_thd=0); bool return_if_owned_by_thd=0);
bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables); bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
void copy_field_from_tmp_record(Field *field,int offset); void copy_field_from_tmp_record(Field *field,int offset);
int fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors); bool fill_record(THD *thd, List<Item> &fields, List<Item> &values,
int fill_record(Field **field,List<Item> &values, bool ignore_errors); bool ignore_errors);
bool fill_record(THD *thd, Field **field, List<Item> &values,
bool ignore_errors);
OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild); OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild);
inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table, inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,

View File

@ -1145,7 +1145,8 @@ static void server_init(void)
WSADATA WsaData; WSADATA WsaData;
if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData)) if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
{ {
my_error(ER_WSAS_FAILED, MYF(0)); /* errors are not read yet, so we use test here */
my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0));
unireg_abort(1); unireg_abort(1);
} }
} }

View File

@ -350,7 +350,8 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
if (stat_info.st_size > INT_MAX-1) if (stat_info.st_size > INT_MAX-1)
{ {
my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str); my_printf_error(ER_FPARSER_TOO_BIG_FILE,
ER(ER_FPARSER_TOO_BIG_FILE), MYF(0), file_name->str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -412,7 +413,8 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
frm_error: frm_error:
if (bad_format_errors) if (bad_format_errors)
{ {
my_error(ER_FPARSER_BAD_HEADER, MYF(0), file_name->str); my_printf_error(ER_FPARSER_BAD_HEADER, ER(ER_FPARSER_BAD_HEADER), MYF(0),
file_name->str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else else
@ -627,7 +629,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
// it is comment // it is comment
if (!(ptr= strchr(ptr, '\n'))) if (!(ptr= strchr(ptr, '\n')))
{ {
my_error(ER_FPARSER_EOF_IN_COMMENT, MYF(0), line); my_printf_error(ER_FPARSER_EOF_IN_COMMENT,
ER(ER_FPARSER_EOF_IN_COMMENT), MYF(0), line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
ptr++; ptr++;
@ -669,8 +672,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
(LEX_STRING *)(base + (LEX_STRING *)(base +
parameter->offset)))) parameter->offset))))
{ {
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
parameter->name.str, line); ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
break; break;
@ -681,8 +685,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
(LEX_STRING *) (LEX_STRING *)
(base + parameter->offset)))) (base + parameter->offset))))
{ {
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
parameter->name.str, line); ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
break; break;
@ -691,8 +696,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
case FILE_OPTIONS_REV: case FILE_OPTIONS_REV:
if (!(eol= strchr(ptr, '\n'))) if (!(eol= strchr(ptr, '\n')))
{ {
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
parameter->name.str, line); ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
{ {
@ -709,8 +715,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
/* yyyy-mm-dd HH:MM:SS = 19(PARSE_FILE_TIMESTAMPLENGTH) characters */ /* yyyy-mm-dd HH:MM:SS = 19(PARSE_FILE_TIMESTAMPLENGTH) characters */
if (ptr[PARSE_FILE_TIMESTAMPLENGTH] != '\n') if (ptr[PARSE_FILE_TIMESTAMPLENGTH] != '\n')
{ {
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
parameter->name.str, line); ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH); memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH);
@ -763,8 +770,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
break; break;
list_err_w_message: list_err_w_message:
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
parameter->name.str, line); ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
parameter->name.str, line);
list_err: list_err:
if (change_mem) if (change_mem)
my_pthread_setspecific_ptr(THR_MALLOC, sql_mem); my_pthread_setspecific_ptr(THR_MALLOC, sql_mem);
@ -779,8 +787,9 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
// skip unknown parameter // skip unknown parameter
if (!(ptr= strchr(ptr, '\n'))) if (!(ptr= strchr(ptr, '\n')))
{ {
my_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, MYF(0), my_printf_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER,
line); ER(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER), MYF(0),
line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
ptr++; ptr++;

View File

@ -611,7 +611,8 @@ bool Protocol::send_fields(List<Item> *list, int flags)
DBUG_RETURN(prepare_for_send(list)); DBUG_RETURN(prepare_for_send(list));
err: err:
my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */ my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES),
MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }

View File

@ -85,7 +85,8 @@ bool Protocol_cursor::send_fields(List<Item> *list, int flags)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
err: err:
my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */ my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES),
MYF(0)); /* purecov: inspected */
DBUG_RETURN(TRUE); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }

View File

@ -451,8 +451,9 @@ bool show_new_master(THD* thd)
if (translate_master(thd, lex_mi, errmsg)) if (translate_master(thd, lex_mi, errmsg))
{ {
if (errmsg[0]) if (errmsg[0])
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND,
"SHOW NEW MASTER", errmsg); ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0),
"SHOW NEW MASTER", errmsg);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
else else
@ -783,7 +784,7 @@ bool load_master_data(THD* thd)
(error=terminate_slave_threads(active_mi,restart_thread_mask, (error=terminate_slave_threads(active_mi,restart_thread_mask,
1 /*skip lock*/))) 1 /*skip lock*/)))
{ {
my_error(error, MYF(0)); my_message(error, ER(error), MYF(0));
unlock_slave_threads(active_mi); unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi); pthread_mutex_unlock(&LOCK_active_mi);
return TRUE; return TRUE;
@ -791,7 +792,8 @@ bool load_master_data(THD* thd)
if (connect_to_master(thd, &mysql, active_mi)) if (connect_to_master(thd, &mysql, active_mi))
{ {
my_error(error= ER_CONNECT_TO_MASTER, MYF(0), mysql_error(&mysql)); my_printf_error(error= ER_CONNECT_TO_MASTER,
ER(ER_CONNECT_TO_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
@ -803,7 +805,8 @@ bool load_master_data(THD* thd)
if (mysql_real_query(&mysql, "SHOW DATABASES", 14) || if (mysql_real_query(&mysql, "SHOW DATABASES", 14) ||
!(db_res = mysql_store_result(&mysql))) !(db_res = mysql_store_result(&mysql)))
{ {
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); my_printf_error(error = ER_QUERY_ON_MASTER,
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
@ -816,7 +819,7 @@ bool load_master_data(THD* thd)
if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*)))) if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
{ {
my_error(error = ER_OUTOFMEMORY, MYF(0)); my_message(error = ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0));
goto err; goto err;
} }
@ -830,7 +833,8 @@ bool load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW MASTER STATUS",18) || mysql_real_query(&mysql, "SHOW MASTER STATUS",18) ||
!(master_status_res = mysql_store_result(&mysql))) !(master_status_res = mysql_store_result(&mysql)))
{ {
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); my_printf_error(error = ER_QUERY_ON_MASTER,
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
@ -883,7 +887,8 @@ bool load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW TABLES", 11) || mysql_real_query(&mysql, "SHOW TABLES", 11) ||
!(*cur_table_res = mysql_store_result(&mysql))) !(*cur_table_res = mysql_store_result(&mysql)))
{ {
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); my_printf_error(error = ER_QUERY_ON_MASTER,
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
cleanup_mysql_results(db_res, cur_table_res - 1, table_res); cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
goto err; goto err;
} }
@ -921,7 +926,7 @@ bool load_master_data(THD* thd)
if (init_master_info(active_mi, master_info_file, relay_log_info_file, if (init_master_info(active_mi, master_info_file, relay_log_info_file,
0)) 0))
my_error(ER_MASTER_INFO, MYF(0)); my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
strmake(active_mi->master_log_name, row[0], strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name)); sizeof(active_mi->master_log_name));
active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error); active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error);
@ -940,7 +945,8 @@ bool load_master_data(THD* thd)
if (mysql_real_query(&mysql, "UNLOCK TABLES", 13)) if (mysql_real_query(&mysql, "UNLOCK TABLES", 13))
{ {
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql)); my_printf_error(error = ER_QUERY_ON_MASTER,
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
} }
@ -949,7 +955,7 @@ bool load_master_data(THD* thd)
0 /* not only reset, but also reinit */, 0 /* not only reset, but also reinit */,
&errmsg)) &errmsg))
{ {
my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg); my_printf_error(ER_RELAY_LOG_FAIL, ER(ER_RELAY_LOG_FAIL), MYF(0), errmsg);
unlock_slave_threads(active_mi); unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi); pthread_mutex_unlock(&LOCK_active_mi);
return TRUE; return TRUE;

View File

@ -884,8 +884,8 @@ bool sys_var_str::check(THD *thd, set_var *var)
return 0; return 0;
if ((res=(*check_func)(thd, var)) < 0) if ((res=(*check_func)(thd, var)) < 0)
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
var->value->str_value.ptr()); name, var->value->str_value.ptr());
return res; return res;
} }
@ -1159,7 +1159,8 @@ static int check_max_delayed_threads(THD *thd, set_var *var)
val != (longlong) global_system_variables.max_insert_delayed_threads) val != (longlong) global_system_variables.max_insert_delayed_threads)
{ {
char buf[64]; char buf[64];
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf)); my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
MYF(0), var->var->name, llstr(val, buf));
return 1; return 1;
} }
return 0; return 0;
@ -1457,7 +1458,8 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names)
return 0; return 0;
err: err:
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, value); my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
name, value);
return 1; return 1;
} }
@ -1496,7 +1498,8 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
return 0; return 0;
err: err:
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff); my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
MYF(0), name, buff);
return 1; return 1;
} }
@ -1520,8 +1523,9 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
{ {
if (var_type != OPT_DEFAULT) if (var_type != OPT_DEFAULT)
{ {
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), my_printf_error(ER_INCORRECT_GLOBAL_LOCAL_VAR,
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL"); ER(ER_INCORRECT_GLOBAL_LOCAL_VAR), MYF(0),
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
return 0; return 0;
} }
/* As there was no local variable, return the global value */ /* As there was no local variable, return the global value */
@ -1564,7 +1568,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
return tmp; return tmp;
} }
default: default:
my_error(ER_VAR_CANT_BE_READ, MYF(0), name); my_printf_error(ER_VAR_CANT_BE_READ, ER(ER_VAR_CANT_BE_READ), MYF(0),
name);
} }
return 0; return 0;
} }
@ -1676,7 +1681,8 @@ bool sys_var_thd_date_time_format::check(THD *thd, set_var *var)
if (!(format= date_time_format_make(date_time_type, if (!(format= date_time_format_make(date_time_type,
res->ptr(), res->length()))) res->ptr(), res->length())))
{ {
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr()); my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
name, res->c_ptr());
return 1; return 1;
} }
@ -1774,12 +1780,14 @@ bool sys_var_collation::check(THD *thd, set_var *var)
String str(buff,sizeof(buff), system_charset_info), *res; String str(buff,sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str))) if (!(res=var->value->val_str(&str)))
{ {
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
MYF(0), name, "NULL");
return 1; return 1;
} }
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{ {
my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr()); my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
res->c_ptr());
return 1; return 1;
} }
} }
@ -1789,7 +1797,8 @@ bool sys_var_collation::check(THD *thd, set_var *var)
{ {
char buf[20]; char buf[20];
int10_to_str((int) var->value->val_int(), buf, -10); int10_to_str((int) var->value->val_int(), buf, -10);
my_error(ER_UNKNOWN_COLLATION, MYF(0), buf); my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
buf);
return 1; return 1;
} }
} }
@ -1810,7 +1819,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
{ {
if (!nullable) if (!nullable)
{ {
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); my_printf_error(ER_WRONG_VALUE_FOR_VAR,
ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), name, "NULL");
return 1; return 1;
} }
tmp= NULL; tmp= NULL;
@ -1818,7 +1828,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) && else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) &&
!(tmp=get_old_charset_by_name(res->c_ptr()))) !(tmp=get_old_charset_by_name(res->c_ptr())))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); my_printf_error(ER_UNKNOWN_CHARACTER_SET, ER(ER_UNKNOWN_CHARACTER_SET),
MYF(0), res->c_ptr());
return 1; return 1;
} }
} }
@ -2336,7 +2347,7 @@ bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
pthread_mutex_lock(&active_mi->rli.run_lock); pthread_mutex_lock(&active_mi->rli.run_lock);
if (active_mi->rli.slave_running) if (active_mi->rli.slave_running)
{ {
my_error(ER_SLAVE_MUST_STOP, MYF(0)); my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
result=1; result=1;
} }
pthread_mutex_unlock(&active_mi->rli.run_lock); pthread_mutex_unlock(&active_mi->rli.run_lock);
@ -2415,7 +2426,8 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
if (!(var->save_result.time_zone= if (!(var->save_result.time_zone=
my_tz_find(res, thd->lex->time_zone_tables_used))) my_tz_find(res, thd->lex->time_zone_tables_used)))
{ {
my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL"); my_printf_error(ER_UNKNOWN_TIME_ZONE, ER(ER_UNKNOWN_TIME_ZONE), MYF(0),
res ? res->c_ptr() : "NULL");
return 1; return 1;
} }
return 0; return 0;
@ -2697,7 +2709,8 @@ sys_var *find_sys_var(const char *str, uint length)
length ? length : length ? length :
strlen(str)); strlen(str));
if (!var) if (!var)
my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str); my_printf_error(ER_UNKNOWN_SYSTEM_VARIABLE, ER(ER_UNKNOWN_SYSTEM_VARIABLE),
MYF(0), (char*) str);
return var; return var;
} }
@ -2783,9 +2796,8 @@ int set_var::check(THD *thd)
{ {
if (var->check_type(type)) if (var->check_type(type))
{ {
my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE, int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
MYF(0), my_printf_error(err, ER(err), MYF(0), var->name);
var->name);
return -1; return -1;
} }
if ((type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL))) if ((type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)))
@ -2795,7 +2807,7 @@ int set_var::check(THD *thd)
{ {
if (var->check_default(type)) if (var->check_default(type))
{ {
my_error(ER_NO_DEFAULT, MYF(0), var->name); my_printf_error(ER_NO_DEFAULT, ER(ER_NO_DEFAULT), MYF(0), var->name);
return -1; return -1;
} }
return 0; return 0;
@ -2805,7 +2817,8 @@ int set_var::check(THD *thd)
return -1; return -1;
if (var->check_update_type(value->result_type())) if (var->check_update_type(value->result_type()))
{ {
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name); my_printf_error(ER_WRONG_TYPE_FOR_VAR, ER(ER_WRONG_TYPE_FOR_VAR), MYF(0),
var->name);
return -1; return -1;
} }
return var->check(thd, this) ? -1 : 0; return var->check(thd, this) ? -1 : 0;
@ -2828,9 +2841,8 @@ int set_var::light_check(THD *thd)
{ {
if (var->check_type(type)) if (var->check_type(type))
{ {
my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE, int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
MYF(0), my_printf_error(err, ER(err), MYF(0), var->name);
var->name);
return -1; return -1;
} }
if (type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)) if (type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL))
@ -2896,7 +2908,7 @@ int set_var_user::update(THD *thd)
if (user_var_item->update()) if (user_var_item->update())
{ {
/* Give an error if it's not given already */ /* Give an error if it's not given already */
my_error(ER_SET_CONSTANTS_ONLY, MYF(0)); my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), MYF(0));
return -1; return -1;
} }
return 0; return 0;
@ -2957,7 +2969,8 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
value= "unknown"; value= "unknown";
err: err:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value); my_printf_error(ER_UNKNOWN_STORAGE_ENGINE, ER(ER_UNKNOWN_STORAGE_ENGINE),
MYF(0), value);
return 1; return 1;
} }

View File

@ -1489,7 +1489,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
packet_len= my_net_read(net); // read create table statement packet_len= my_net_read(net); // read create table statement
if (packet_len == packet_error) if (packet_len == packet_error)
{ {
my_error(ER_MASTER_NET_READ, MYF(0)); my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (net->read_pos[0] == 255) // error from master if (net->read_pos[0] == 255) // error from master
@ -1498,7 +1498,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
err_msg= (char*) net->read_pos + ((mysql->server_capabilities & err_msg= (char*) net->read_pos + ((mysql->server_capabilities &
CLIENT_PROTOCOL_41) ? CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3); 3+SQLSTATE_LENGTH+1 : 3);
my_error(ER_MASTER, MYF(0), err_msg); my_printf_error(ER_MASTER, ER(ER_MASTER), MYF(0), err_msg);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->command = COM_TABLE_DUMP; thd->command = COM_TABLE_DUMP;
@ -1507,7 +1507,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
if (!(query = thd->strmake((char*) net->read_pos, packet_len))) if (!(query = thd->strmake((char*) net->read_pos, packet_len)))
{ {
sql_print_error("create_table_from_dump: out of memory"); sql_print_error("create_table_from_dump: out of memory");
my_error(ER_GET_ERRNO, MYF(0), "Out of memory"); my_message(ER_GET_ERRNO, "Out of memory", MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->query= query; thd->query= query;
@ -1552,7 +1552,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
/* Copy the data file */ /* Copy the data file */
if (file->net_read_dump(net)) if (file->net_read_dump(net))
{ {
my_error(ER_MASTER_NET_READ, MYF(0)); my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
sql_print_error("create_table_from_dump: failed in\ sql_print_error("create_table_from_dump: failed in\
handler::net_read_dump()"); handler::net_read_dump()");
goto err; goto err;
@ -1572,7 +1572,8 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
error=file->repair(thd,&check_opt) != 0; error=file->repair(thd,&check_opt) != 0;
thd->net.vio = save_vio; thd->net.vio = save_vio;
if (error) if (error)
my_error(ER_INDEX_REBUILD, MYF(0), tables.table->real_name); my_printf_error(ER_INDEX_REBUILD, ER(ER_INDEX_REBUILD), MYF(0),
tables.table->real_name);
err: err:
close_thread_tables(thd); close_thread_tables(thd);
@ -1599,7 +1600,8 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
} }
if (connect_to_master(thd, mysql, mi)) if (connect_to_master(thd, mysql, mi))
{ {
my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql)); my_printf_error(ER_CONNECT_TO_MASTER, ER(ER_CONNECT_TO_MASTER), MYF(0),
mysql_error(mysql));
mysql_close(mysql); mysql_close(mysql);
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View File

@ -1001,7 +1001,8 @@ sp_cache_functions(THD *thd, LEX *lex)
{ {
delete newlex; delete newlex;
thd->lex= oldlex; thd->lex= oldlex;
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", ls->str); my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
"FUNCTION", ls->str);
ret= 1; ret= 1;
break; break;
} }

View File

@ -623,7 +623,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (args->elements != params) if (args->elements != params)
{ {
my_error(ER_SP_WRONG_NO_OF_ARGS, MYF(0), my_printf_error(ER_SP_WRONG_NO_OF_ARGS, ER(ER_SP_WRONG_NO_OF_ARGS), MYF(0),
"PROCEDURE", m_name.str, params, args->elements); "PROCEDURE", m_name.str, params, args->elements);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -893,7 +893,8 @@ sp_head::check_backpatch(THD *thd)
{ {
if (bp->lab->type == SP_LAB_REF) if (bp->lab->type == SP_LAB_REF)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "GOTO", bp->lab->name); my_printf_error(ER_SP_LILABEL_MISMATCH, ER(ER_SP_LILABEL_MISMATCH),
MYF(0), "GOTO", bp->lab->name);
return -1; return -1;
} }
} }
@ -1786,7 +1787,7 @@ sp_instr_error::execute(THD *thd, uint *nextp)
{ {
DBUG_ENTER("sp_instr_error::execute"); DBUG_ENTER("sp_instr_error::execute");
my_error(m_errcode, MYF(0)); my_message(m_errcode, ER(m_errcode), MYF(0));
*nextp= m_ip+1; *nextp= m_ip+1;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }

View File

@ -153,7 +153,8 @@ sp_cursor::pre_open(THD *thd)
{ {
if (m_isopen) if (m_isopen)
{ {
my_error(ER_SP_CURSOR_ALREADY_OPEN, MYF(0)); my_message(ER_SP_CURSOR_ALREADY_OPEN, ER(ER_SP_CURSOR_ALREADY_OPEN),
MYF(0));
return NULL; return NULL;
} }
@ -187,7 +188,7 @@ sp_cursor::close(THD *thd)
{ {
if (! m_isopen) if (! m_isopen)
{ {
my_error(ER_SP_CURSOR_NOT_OPEN, MYF(0)); my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
return -1; return -1;
} }
destroy(); destroy();
@ -217,12 +218,12 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
if (! m_isopen) if (! m_isopen)
{ {
my_error(ER_SP_CURSOR_NOT_OPEN, MYF(0)); my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
return -1; return -1;
} }
if (m_current_row == NULL) if (m_current_row == NULL)
{ {
my_error(ER_SP_FETCH_NO_DATA, MYF(0)); my_message(ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA), MYF(0));
return -1; return -1;
} }
@ -234,7 +235,8 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
if (fldcount >= m_prot->get_field_count()) if (fldcount >= m_prot->get_field_count())
{ {
my_error(ER_SP_WRONG_NO_OF_FETCH_ARGS, MYF(0)); my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
return -1; return -1;
} }
s= row[fldcount]; s= row[fldcount];
@ -260,7 +262,8 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
} }
if (fldcount < m_prot->get_field_count()) if (fldcount < m_prot->get_field_count())
{ {
my_error(ER_SP_WRONG_NO_OF_FETCH_ARGS, MYF(0)); my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
return -1; return -1;
} }
m_current_row= m_current_row->next; m_current_row= m_current_row->next;

View File

@ -1237,7 +1237,8 @@ bool check_change_password(THD *thd, const char *host, const char *user,
} }
if (!thd->slave_thread && !thd->user[0]) if (!thd->slave_thread && !thd->user[0])
{ {
my_error(ER_PASSWORD_ANONYMOUS_USER, MYF(0)); my_message(ER_PASSWORD_ANONYMOUS_USER, ER(ER_PASSWORD_ANONYMOUS_USER),
MYF(0));
return(1); return(1);
} }
uint len=strlen(new_password); uint len=strlen(new_password);
@ -1282,7 +1283,7 @@ bool change_password(THD *thd, const char *host, const char *user,
if (!(acl_user= find_acl_user(host, user))) if (!(acl_user= find_acl_user(host, user)))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
my_error(ER_PASSWORD_NO_MATCH, MYF(0)); my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* update loaded acl entry: */ /* update loaded acl entry: */
@ -1467,7 +1468,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
(byte*) table->field[0]->ptr,0, (byte*) table->field[0]->ptr,0,
HA_READ_KEY_EXACT)) HA_READ_KEY_EXACT))
{ {
my_error(ER_PASSWORD_NO_MATCH,MYF(0)); /* purecov: deadcode */ my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
MYF(0)); /* purecov: deadcode */
DBUG_RETURN(1); /* purecov: deadcode */ DBUG_RETURN(1); /* purecov: deadcode */
} }
store_record(table,record[1]); store_record(table,record[1]);
@ -1549,10 +1551,12 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
if (!create_user) if (!create_user)
{ {
if (what == 'N') if (what == 'N')
my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str); my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRANT),
MYF(0), combo.user.str, combo.host.str);
else else
my_error(ER_NO_PERMISSION_TO_CREATE_USER, MYF(0), my_printf_error(ER_NO_PERMISSION_TO_CREATE_USER,
thd->user, thd->host_or_ip); ER(ER_NO_PERMISSION_TO_CREATE_USER), MYF(0),
thd->user, thd->host_or_ip);
goto end; goto end;
} }
old_row_exists = 0; old_row_exists = 0;
@ -1717,7 +1721,7 @@ static int replace_db_table(TABLE *table, const char *db,
/* Check if there is such a user in user table in memory? */ /* Check if there is such a user in user table in memory? */
if (!find_acl_user(combo.host.str,combo.user.str)) if (!find_acl_user(combo.host.str,combo.user.str))
{ {
my_error(ER_PASSWORD_NO_MATCH,MYF(0)); my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -1729,7 +1733,8 @@ static int replace_db_table(TABLE *table, const char *db,
{ {
if (what == 'N') if (what == 'N')
{ // no row, no revoke { // no row, no revoke
my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str); my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRANT), MYF(0),
combo.user.str, combo.host.str);
goto abort; goto abort;
} }
old_row_exists = 0; old_row_exists = 0;
@ -2036,8 +2041,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
{ {
if (revoke_grant) if (revoke_grant)
{ {
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), my_printf_error(ER_NONEXISTING_TABLE_GRANT,
combo.user.str, combo.host.str, table_name); /* purecov: inspected */ ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
combo.user.str, combo.host.str,
table_name); /* purecov: inspected */
result= -1; /* purecov: inspected */ result= -1; /* purecov: inspected */
continue; /* purecov: inspected */ continue; /* purecov: inspected */
} }
@ -2180,7 +2187,8 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
*/ */
if (!find_acl_user(combo.host.str,combo.user.str)) if (!find_acl_user(combo.host.str,combo.user.str))
{ {
my_error(ER_PASSWORD_NO_MATCH,MYF(0)); /* purecov: deadcode */ my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
MYF(0)); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(-1); /* purecov: deadcode */
} }
@ -2202,9 +2210,10 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
*/ */
if (revoke_grant) if (revoke_grant)
{ // no row, no revoke { // no row, no revoke
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), my_printf_error(ER_NONEXISTING_TABLE_GRANT,
combo.user.str, combo.host.str, ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
table_name); /* purecov: deadcode */ combo.user.str, combo.host.str,
table_name); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(-1); /* purecov: deadcode */
} }
old_row_exists = 0; old_row_exists = 0;
@ -2311,7 +2320,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
} }
if (rights & ~TABLE_ACLS) if (rights & ~TABLE_ACLS)
{ {
my_error(ER_ILLEGAL_GRANT_FOR_TABLE,MYF(0)); my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -2332,8 +2342,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
column->column.length(), 0, 0, 0, 0, column->column.length(), 0, 0, 0, 0,
&unused_field_idx)) &unused_field_idx))
{ {
my_error(ER_BAD_FIELD_ERROR, MYF(0), my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
column->column.c_ptr(), table_list->alias); column->column.c_ptr(), table_list->alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
column_priv|= column->rights; column_priv|= column->rights;
@ -2348,7 +2358,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
fn_format(buf,buf,"","",4+16+32); fn_format(buf,buf,"","",4+16+32);
if (access(buf,F_OK)) if (access(buf,F_OK))
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias); my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
table_list->db, table_list->alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2406,7 +2417,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
if (Str->host.length > HOSTNAME_LENGTH || if (Str->host.length > HOSTNAME_LENGTH ||
Str->user.length > USERNAME_LENGTH) Str->user.length > USERNAME_LENGTH)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
MYF(0));
result= TRUE; result= TRUE;
continue; continue;
} }
@ -2435,8 +2447,9 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{ {
if (revoke_grant) if (revoke_grant)
{ {
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), my_printf_error(ER_NONEXISTING_TABLE_GRANT,
Str->user.str, Str->host.str, table_list->real_name); ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
Str->user.str, Str->host.str, table_list->real_name);
result= TRUE; result= TRUE;
continue; continue;
} }
@ -2581,7 +2594,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
if (Str->host.length > HOSTNAME_LENGTH || if (Str->host.length > HOSTNAME_LENGTH ||
Str->user.length > USERNAME_LENGTH) Str->user.length > USERNAME_LENGTH)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
MYF(0));
result= -1; result= -1;
continue; continue;
} }
@ -2876,11 +2890,12 @@ err:
command= "create view"; command= "create view";
else if (want_access & SHOW_VIEW_ACL) else if (want_access & SHOW_VIEW_ACL)
command= "show create view"; command= "show create view";
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), my_printf_error(ER_TABLEACCESS_DENIED_ERROR,
command, ER(ER_TABLEACCESS_DENIED_ERROR), MYF(0),
thd->priv_user, command,
thd->host_or_ip, thd->priv_user,
table ? table->real_name : "unknown"); thd->host_or_ip,
table ? table->real_name : "unknown");
} }
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -3168,7 +3183,8 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (lex_user->host.length > HOSTNAME_LENGTH || if (lex_user->host.length > HOSTNAME_LENGTH ||
lex_user->user.length > USERNAME_LENGTH) lex_user->user.length > USERNAME_LENGTH)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -3186,8 +3202,9 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
} }
if (counter == acl_users.elements) if (counter == acl_users.elements)
{ {
my_error(ER_NONEXISTING_GRANT, MYF(0), my_printf_error(ER_NONEXISTING_GRANT,
lex_user->user.str, lex_user->host.str); ER(ER_NONEXISTING_GRANT), MYF(0),
lex_user->user.str, lex_user->host.str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -3700,7 +3717,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
close_thread_tables(thd); close_thread_tables(thd);
if (result) if (result)
my_error(ER_DROP_USER, MYF(0)); my_message(ER_DROP_USER, ER(ER_DROP_USER), MYF(0));
DBUG_RETURN(result); DBUG_RETURN(result);
} }
@ -3804,7 +3821,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
/* when this code is deleted, the error slot (error 1268) can be reused, /* when this code is deleted, the error slot (error 1268) can be reused,
as this error code was not present in any MySQL release */ as this error code was not present in any MySQL release */
if (result) if (result)
my_error(ER_REVOKE_GRANTS, MYF(0)); my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
DBUG_RETURN(result); DBUG_RETURN(result);
} }

View File

@ -81,14 +81,18 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
delete pc; delete pc;
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name); my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0),
proc_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
pc->max_tree_elements = (uint) (*param->item)->val_int(); pc->max_tree_elements = (uint) (*param->item)->val_int();
param = param->next; param = param->next;
if (param->next) // no third parameter possible if (param->next) // no third parameter possible
{ {
my_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE, MYF(0), proc_name); my_printf_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE,
ER(ER_WRONG_PARAMCOUNT_TO_PROCEDURE), MYF(0),
proc_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
// second parameter // second parameter
@ -96,7 +100,9 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
delete pc; delete pc;
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name); my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0),
proc_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
pc->max_treemem = (uint) (*param->item)->val_int(); pc->max_treemem = (uint) (*param->item)->val_int();
@ -105,7 +111,8 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
delete pc; delete pc;
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name); my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0), proc_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
// if only one parameter was given, it will be the value of max_tree_elements // if only one parameter was given, it will be the value of max_tree_elements

View File

@ -1224,7 +1224,8 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
next=table->next; next=table->next;
if (!tables || (!db_stat && reopen_table(table,1))) if (!tables || (!db_stat && reopen_table(table,1)))
{ {
my_error(ER_CANT_REOPEN_TABLE,MYF(0),table->table_name); my_printf_error(ER_CANT_REOPEN_TABLE, ER(ER_CANT_REOPEN_TABLE),
MYF(0),table->table_name);
VOID(hash_delete(&open_cache,(byte*) table)); VOID(hash_delete(&open_cache,(byte*) table));
error=1; error=1;
} }
@ -1509,7 +1510,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
{ {
/* Give right error message */ /* Give right error message */
thd->clear_error(); thd->clear_error();
my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno); my_printf_error(ER_NOT_KEYFILE, ER(ER_NOT_KEYFILE), MYF(0),
name, my_errno);
sql_print_error("Error: Couldn't repair table: %s.%s",db,name); sql_print_error("Error: Couldn't repair table: %s.%s",db,name);
if (entry->file) if (entry->file)
closefrm(entry); closefrm(entry);
@ -1574,7 +1576,8 @@ err:
{ {
TABLE_LIST * view= table_desc->belong_to_view; TABLE_LIST * view= table_desc->belong_to_view;
thd->clear_error(); thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0), view->view_db.str, view->view_name.str); my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0),
view->view_db.str, view->view_name.str);
} }
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -2738,8 +2741,9 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
(pos= find_type(&table->keynames, name->ptr(), name->length(), 1)) <= (pos= find_type(&table->keynames, name->ptr(), name->length(), 1)) <=
0) 0)
{ {
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(), my_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS,
table->real_name); ER(ER_KEY_COLUMN_DOES_NOT_EXITS), MYF(0),
name->c_ptr(), table->real_name);
map->set_all(); map->set_all();
return 1; return 1;
} }
@ -2954,9 +2958,10 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
DBUG_RETURN(0); DBUG_RETURN(0);
if (!table_name) if (!table_name)
my_error(ER_NO_TABLES_USED, MYF(0)); my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
else else
my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name); my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
table_name);
err: err:
DBUG_RETURN(1); DBUG_RETURN(1);
@ -3176,8 +3181,25 @@ err_no_arena:
** Returns : 1 if some field has wrong type ** Returns : 1 if some field has wrong type
******************************************************************************/ ******************************************************************************/
int
fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors) /*
Fill fields with given items.
SYNOPSIS
fill_record()
thd thread handler
fields Item_fields list to be filled
values values to fill with
ignore_errors TRUE if we should ignore errors
RETURN
FALSE OK
TRUE error occured
*/
bool
fill_record(THD * thd, List<Item> &fields, List<Item> &values,
bool ignore_errors)
{ {
List_iterator_fast<Item> f(fields),v(values); List_iterator_fast<Item> f(fields),v(values);
Item *value; Item *value;
@ -3192,14 +3214,32 @@ fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
if (rfield == table->next_number_field) if (rfield == table->next_number_field)
table->auto_increment_field_not_null= TRUE; table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors) if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
DBUG_RETURN(1); {
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
DBUG_RETURN(TRUE);
}
} }
DBUG_RETURN(0); DBUG_RETURN(thd->net.report_error);
} }
int /*
fill_record(Field **ptr,List<Item> &values, bool ignore_errors) Fill field buffer with values from Field list
SYNOPSIS
fill_record()
thd thread handler
ptr pointer on pointer to record
values list of fields
ignore_errors TRUE if we should ignore errors
RETURN
FALSE OK
TRUE error occured
*/
bool
fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
{ {
List_iterator_fast<Item> v(values); List_iterator_fast<Item> v(values);
Item *value; Item *value;
@ -3213,9 +3253,12 @@ fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
if (field == table->next_number_field) if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE; table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(field, 0) < 0) && !ignore_errors) if ((value->save_in_field(field, 0) < 0) && !ignore_errors)
DBUG_RETURN(1); {
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
DBUG_RETURN(TRUE);
}
} }
DBUG_RETURN(0); DBUG_RETURN(thd->net.report_error);
} }
@ -3439,7 +3482,8 @@ open_new_frm(const char *path, const char *alias,
{ {
if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE) if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE)
{ {
my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE"); my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
db, table_name, "BASE TABLE");
goto err; goto err;
} }
if (mysql_make_view(parser, table_desc)) if (mysql_make_view(parser, table_desc))
@ -3448,7 +3492,8 @@ open_new_frm(const char *path, const char *alias,
else else
{ {
/* only VIEWs are supported now */ /* only VIEWs are supported now */
my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), path, parser->type()->str); my_printf_error(ER_FRM_UNKNOWN_TYPE, ER(ER_FRM_UNKNOWN_TYPE), MYF(0),
path, parser->type()->str);
goto err; goto err;
} }
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@ -695,8 +695,8 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
key_length + 1); key_length + 1);
if (!new_table) if (!new_table)
{ {
my_error(EE_OUTOFMEMORY, MYF(ME_BELL), my_printf_error(EE_OUTOFMEMORY, ER(EE_OUTOFMEMORY), MYF(ME_BELL),
ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1); ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
killed= KILL_CONNECTION; killed= KILL_CONNECTION;
return 0; return 0;
} }
@ -953,7 +953,8 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
(void) fn_format(path, exchange->file_name, path, "", option); (void) fn_format(path, exchange->file_name, path, "", option);
if (!access(path, F_OK)) if (!access(path, F_OK))
{ {
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name); my_printf_error(ER_FILE_EXISTS_ERROR, ER(ER_FILE_EXISTS_ERROR), MYF(0),
exchange->file_name);
return -1; return -1;
} }
/* Create the file world readable */ /* Create the file world readable */
@ -1184,7 +1185,7 @@ bool select_dump::send_data(List<Item> &items)
} }
if (row_count++ > 1) if (row_count++ > 1)
{ {
my_error(ER_TOO_MANY_ROWS, MYF(0)); my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
goto err; goto err;
} }
while ((item=li++)) while ((item=li++))
@ -1197,7 +1198,8 @@ bool select_dump::send_data(List<Item> &items)
} }
else if (my_b_write(&cache,(byte*) res->ptr(),res->length())) else if (my_b_write(&cache,(byte*) res->ptr(),res->length()))
{ {
my_error(ER_ERROR_ON_WRITE,MYF(0), path, my_errno); my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
path, my_errno);
goto err; goto err;
} }
} }
@ -1356,7 +1358,8 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
if (var_list.elements != list.elements) if (var_list.elements != list.elements)
{ {
my_error(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, MYF(0)); my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
return 1; return 1;
} }
while ((item=li++)) while ((item=li++))
@ -1626,7 +1629,7 @@ bool select_dumpvar::send_data(List<Item> &items)
} }
if (row_count++) if (row_count++)
{ {
my_error(ER_TOO_MANY_ROWS, MYF(0)); my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
while ((zz=my_li++) && (item=it++)) while ((zz=my_li++) && (item=it++))

View File

@ -41,6 +41,7 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN,
CHECK_FIELD_ERROR_FOR_NULL }; CHECK_FIELD_ERROR_FOR_NULL };
extern char internal_table_name[2]; extern char internal_table_name[2];
extern const char **errmesg;
/* log info errors */ /* log info errors */
#define LOG_INFO_EOF -1 #define LOG_INFO_EOF -1
@ -1133,7 +1134,8 @@ public:
} }
inline void send_kill_message() const inline void send_kill_message() const
{ {
my_error(killed_errno(), MYF(0)); int err= killed_errno();
my_message(err, ER(err), MYF(0));
} }
/* return TRUE if we will abort query if we make a warning now */ /* return TRUE if we will abort query if we make a warning now */
inline bool really_abort_on_warning() inline bool really_abort_on_warning()

View File

@ -413,7 +413,8 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
{ {
if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS)) if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS))
{ {
my_error(ER_DB_CREATE_EXISTS,MYF(0),db); my_printf_error(ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), MYF(0),
db);
error= -1; error= -1;
goto exit; goto exit;
} }
@ -423,12 +424,13 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
{ {
if (my_errno != ENOENT) if (my_errno != ENOENT)
{ {
my_error(EE_STAT, MYF(0),path,my_errno); my_printf_error(EE_STAT, ER(EE_STAT), MYF(0), path, my_errno);
goto exit; goto exit;
} }
if (my_mkdir(path,0777,MYF(0)) < 0) if (my_mkdir(path,0777,MYF(0)) < 0)
{ {
my_error(ER_CANT_CREATE_DB,MYF(0),db,my_errno); my_printf_error(ER_CANT_CREATE_DB, ER(ER_CANT_CREATE_DB),
MYF(0), db, my_errno);
error= -1; error= -1;
goto exit; goto exit;
} }
@ -582,7 +584,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
if (!if_exists) if (!if_exists)
{ {
error= -1; error= -1;
my_error(ER_DB_DROP_EXISTS,MYF(0),db); my_printf_error(ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), MYF(0), db);
goto exit; goto exit;
} }
else else
@ -806,7 +808,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
*/ */
if (found_other_files) if (found_other_files)
{ {
my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, EEXIST); my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0),
org_path, EEXIST);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else else
@ -869,7 +872,8 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
*--pos=0; *--pos=0;
if (rmdir(path) < 0 && send_error) if (rmdir(path) < 0 && send_error)
{ {
my_error(ER_DB_DROP_RMDIR, MYF(0), path, errno); my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0),
path, errno);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
@ -985,12 +989,13 @@ bool mysql_change_db(THD *thd, const char *name)
if (!dbname || !(db_length= strlen(dbname))) if (!dbname || !(db_length= strlen(dbname)))
{ {
x_free(dbname); /* purecov: inspected */ x_free(dbname); /* purecov: inspected */
my_error(ER_NO_DB_ERROR, MYF(0)); /* purecov: inspected */ my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
if (check_db_name(dbname)) if (check_db_name(dbname))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), dbname); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname);
x_free(dbname); x_free(dbname);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1003,10 +1008,11 @@ bool mysql_change_db(THD *thd, const char *name)
thd->master_access); thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{ {
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), my_printf_error(ER_DBACCESS_DENIED_ERROR,
thd->priv_user, ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
thd->priv_host, thd->priv_user,
dbname); thd->priv_host,
dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user, thd->priv_user,
thd->priv_host, thd->priv_host,
@ -1021,7 +1027,7 @@ bool mysql_change_db(THD *thd, const char *name)
path[length-1]=0; // remove ending '\' path[length-1]=0; // remove ending '\'
if (access(path,F_OK)) if (access(path,F_OK))
{ {
my_error(ER_BAD_DB_ERROR, MYF(0), dbname); my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname);
my_free(dbname,MYF(0)); my_free(dbname,MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View File

@ -55,7 +55,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
safe_update=test(thd->options & OPTION_SAFE_UPDATES); safe_update=test(thd->options & OPTION_SAFE_UPDATES);
if (safe_update && const_cond) if (safe_update && const_cond)
{ {
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0)); my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -103,7 +104,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0)); my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -259,7 +261,7 @@ cleanup:
send_ok(thd,deleted); send_ok(thd,deleted);
DBUG_PRINT("info",("%d records deleted",deleted)); DBUG_PRINT("info",("%d records deleted",deleted));
} }
DBUG_RETURN(FALSE); DBUG_RETURN(error >= 0 || thd->net.report_error);
} }
@ -287,12 +289,14 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (!table_list->updatable || check_key_in_view(thd, table_list)) if (!table_list->updatable || check_key_in_view(thd, table_list))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE"); my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), MYF(0),
table_list->alias, "DELETE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (unique_table(table_list, table_list->next_independent())) if (unique_table(table_list, table_list->next_independent()))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name); my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0),
table_list->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
select_lex->fix_prepare_information(thd, conds); select_lex->fix_prepare_information(thd, conds);
@ -349,8 +353,8 @@ bool mysql_multi_delete_prepare(THD *thd)
if (!target_tbl->correspondent_table->updatable || if (!target_tbl->correspondent_table->updatable ||
check_key_in_view(thd, target_tbl->correspondent_table)) check_key_in_view(thd, target_tbl->correspondent_table))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), target_tbl->real_name, my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
"DELETE"); MYF(0), target_tbl->real_name, "DELETE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* /*
@ -367,8 +371,8 @@ bool mysql_multi_delete_prepare(THD *thd)
un->check_updateable(target_tbl->correspondent_table->db, un->check_updateable(target_tbl->correspondent_table->db,
target_tbl->correspondent_table->real_name)) target_tbl->correspondent_table->real_name))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
target_tbl->correspondent_table->real_name); MYF(0), target_tbl->correspondent_table->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -729,8 +733,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
db_type table_type; db_type table_type;
if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN) if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN)
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
table_list->real_name); table_list->db, table_list->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!ha_supports_generate(table_type)) if (!ha_supports_generate(table_type))

View File

@ -341,7 +341,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
break; break;
} }
default: default:
my_error(ER_ILLEGAL_HA, MYF(0)); my_message(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0));
goto err; goto err;
} }
@ -370,7 +370,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
if (item->send(thd->protocol, &buffer)) if (item->send(thd->protocol, &buffer))
{ {
protocol->free(); // Free used protocol->free(); // Free used
my_error(ER_OUT_OF_RESOURCES,MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
goto err; goto err;
} }
} }

View File

@ -276,7 +276,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
(iindex_relations= find_type((char*) primary_key_name, (iindex_relations= find_type((char*) primary_key_name,
&relations->keynames, 1+2)-1)<0) &relations->keynames, 1+2)-1)<0)
{ {
my_error(ER_CORRUPT_HELP_DB, 0); my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
rtopic_id= find_fields[help_relation_help_topic_id].field; rtopic_id= find_fields[help_relation_help_topic_id].field;

View File

@ -100,7 +100,8 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
if (check_unique && thd->dupp_field) if (check_unique && thd->dupp_field)
{ {
my_error(ER_FIELD_SPECIFIED_TWICE,MYF(0), thd->dupp_field->field_name); my_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE),
MYF(0), thd->dupp_field->field_name);
return -1; return -1;
} }
if (table->timestamp_field && // Don't set timestamp if used if (table->timestamp_field && // Don't set timestamp if used
@ -291,7 +292,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (fields.elements || !value_count) if (fields.elements || !value_count)
{ {
restore_record(table,default_values); // Get empty record restore_record(table,default_values); // Get empty record
if (fill_record(fields, *values, 0)|| thd->net.report_error) if (fill_record(thd, fields, *values, 0))
{ {
if (values_list.elements != 1 && !thd->net.report_error) if (values_list.elements != 1 && !thd->net.report_error)
{ {
@ -299,14 +300,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
continue; continue;
} }
/* /*
Field::store methods can't send errors
TODO: set thd->abort_on_warning if values_list.elements == 1 TODO: set thd->abort_on_warning if values_list.elements == 1
and check that all items return warning in case of problem with and check that all items return warning in case of problem with
storing field. storing field.
*/ */
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
error=1; error=1;
break; break;
} }
@ -317,16 +314,13 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
restore_record(table,default_values); // Get empty record restore_record(table,default_values); // Get empty record
else else
table->record[0][0]=table->default_values[0]; // Fix delete marker table->record[0][0]=table->default_values[0]; // Fix delete marker
if (fill_record(table->field,*values, 0) || thd->net.report_error) if (fill_record(thd, table->field, *values, 0))
{ {
if (values_list.elements != 1 && ! thd->net.report_error) if (values_list.elements != 1 && ! thd->net.report_error)
{ {
info.records++; info.records++;
continue; continue;
} }
/* Field::store methods can't send errors */
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
error=1; error=1;
break; break;
} }
@ -608,7 +602,8 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
(insert_into_view && (insert_into_view &&
check_view_insertability(table_list, thd->query_id))) check_view_insertability(table_list, thd->query_id)))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "INSERT"); my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
MYF(0), table_list->alias, "INSERT");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
@ -655,7 +650,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
if (unique_table(table_list, table_list->next_independent())) if (unique_table(table_list, table_list->next_independent()))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name); my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
MYF(0), table_list->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
thd->lex->select_lex.first_execution= 0; thd->lex->select_lex.first_execution= 0;
@ -751,13 +747,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
*/ */
store_record(table,insert_values); store_record(table,insert_values);
restore_record(table,record[1]); restore_record(table,record[1]);
if (fill_record(*info->update_fields, *info->update_values, 0)) if (fill_record(thd, *info->update_fields, *info->update_values, 0))
{
/* Field::store methods can't send errors */
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
goto err; goto err;
}
/* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */ /* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */
if (info->view && if (info->view &&
@ -1018,7 +1009,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
{ {
delete tmp; delete tmp;
thd->fatal_error(); thd->fatal_error();
my_error(ER_OUT_OF_RESOURCES,MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
pthread_mutex_unlock(&LOCK_delayed_create); pthread_mutex_unlock(&LOCK_delayed_create);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -1335,7 +1326,8 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg)
if (!(di->table->file->table_flags() & HA_CAN_INSERT_DELAYED)) if (!(di->table->file->table_flags() & HA_CAN_INSERT_DELAYED))
{ {
thd->fatal_error(); thd->fatal_error();
my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.real_name); my_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0),
di->table_list.real_name);
goto end; goto end;
} }
di->table->copy_blobs=1; di->table->copy_blobs=1;
@ -1761,9 +1753,9 @@ bool select_insert::send_data(List<Item> &values)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (fields->elements) if (fields->elements)
fill_record(*fields, values, 1); fill_record(thd, *fields, values, 1);
else else
fill_record(table->field, values, 1); fill_record(thd, table->field, values, 1);
switch (table_list->view_check_option(thd, switch (table_list->view_check_option(thd,
thd->lex->duplicates == DUP_IGNORE)) thd->lex->duplicates == DUP_IGNORE))
{ {
@ -1934,7 +1926,7 @@ bool select_create::send_data(List<Item> &values)
unit->offset_limit_cnt--; unit->offset_limit_cnt--;
return 0; return 0;
} }
fill_record(field, values, 1); fill_record(thd, field, values, 1);
if (thd->net.report_error || write_record(thd, table, &info)) if (thd->net.report_error || write_record(thd, table, &info))
return 1; return 1;
if (table->next_number_field) // Clear for next record if (table->next_number_field) // Clear for next record

View File

@ -1273,7 +1273,7 @@ bool st_select_lex::test_limit()
if (select_limit != HA_POS_ERROR) if (select_limit != HA_POS_ERROR)
{ {
my_error(ER_NOT_SUPPORTED_YET, MYF(0), my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"LIMIT & IN/ALL/ANY/SOME subquery"); "LIMIT & IN/ALL/ANY/SOME subquery");
return(1); return(1);
} }
// We need only 1 row to determinate existence // We need only 1 row to determinate existence

View File

@ -125,7 +125,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (!table_list->updatable || check_key_in_view(thd, table_list)) if (!table_list->updatable || check_key_in_view(thd, table_list))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD"); my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
MYF(0), table_list->alias, "LOAD");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
table= table_list->table; table= table_list->table;
@ -148,7 +149,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (thd->dupp_field) if (thd->dupp_field)
{ {
my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name); my_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE),
MYF(0), thd->dupp_field->field_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (check_that_all_fields_are_given_values(thd, table)) if (check_that_all_fields_are_given_values(thd, table))
@ -222,7 +224,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
((stat_info.st_mode & S_IFREG) == S_IFREG || ((stat_info.st_mode & S_IFREG) == S_IFREG ||
(stat_info.st_mode & S_IFIFO) == S_IFIFO))) (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
{ {
my_error(ER_TEXTFILE_NOT_READABLE,MYF(0),name); my_printf_error(ER_TEXTFILE_NOT_READABLE,
ER(ER_TEXTFILE_NOT_READABLE), MYF(0), name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO) if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)

View File

@ -47,12 +47,13 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
0L))) 0L)))
{ {
error=errno; error=errno;
my_error(ER_NO_FILE_MAPPING,MYF(0), (my_string) name, error); my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0),
(my_string) name, error);
} }
} }
if (map && memcmp(map,magic,magic_length)) if (map && memcmp(map,magic,magic_length))
{ {
my_error(ER_WRONG_MAGIC, MYF(0), name); my_printf_error(ER_WRONG_MAGIC, ER(ER_WRONG_MAGIC), MYF(0), name);
VOID(munmap(map,size)); VOID(munmap(map,size));
map=0; map=0;
} }
@ -111,7 +112,8 @@ mapped_files *map_file(const my_string name,byte *magic,uint magic_length)
{ {
map->use_count++; map->use_count++;
if (!map->map) if (!map->map)
my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error); my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0),
path, map->error);
} }
VOID(pthread_mutex_unlock(&LOCK_mapped_file)); VOID(pthread_mutex_unlock(&LOCK_mapped_file));
return map; return map;

View File

@ -1115,7 +1115,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
if (buff[length-1]!='\n' && !feof(file)) if (buff[length-1]!='\n' && !feof(file))
{ {
net_send_error(thd, ER_NET_PACKET_TOO_LARGE, NullS); net_send_error(thd, ER_NET_PACKET_TOO_LARGE, NullS);
thd->is_fatal_error= 1; thd->fatal_error();
break; break;
} }
while (length && (my_isspace(thd->charset(), buff[length-1]) || while (length && (my_isspace(thd->charset(), buff[length-1]) ||
@ -1192,7 +1192,8 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
if (!db || check_db_name(db)) if (!db || check_db_name(db))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL"); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
db ? db : "NULL");
goto err; goto err;
} }
if (lower_case_table_names) if (lower_case_table_names)
@ -1396,7 +1397,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Small check for incoming packet */ /* Small check for incoming packet */
if ((uint) ((uchar*) db - net->read_pos) > packet_length) if ((uint) ((uchar*) db - net->read_pos) > packet_length)
{ {
my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
break; break;
} }
#endif #endif
@ -1418,7 +1419,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (!(thd->user= my_strdup(user, MYF(0)))) if (!(thd->user= my_strdup(user, MYF(0))))
{ {
thd->user= save_user; thd->user= save_user;
my_error(ER_OUT_OF_RESOURCES, MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
break; break;
} }
@ -1430,7 +1431,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{ {
/* authentication failure, we shall restore old user */ /* authentication failure, we shall restore old user */
if (res > 0) if (res > 0)
my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
x_free(thd->user); x_free(thd->user);
thd->user= save_user; thd->user= save_user;
thd->priv_user= save_priv_user; thd->priv_user= save_priv_user;
@ -1538,7 +1539,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
} }
case COM_FIELD_LIST: // This isn't actually needed case COM_FIELD_LIST: // This isn't actually needed
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
break; break;
#else #else
{ {
@ -1551,7 +1553,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
bzero((char*) &table_list,sizeof(table_list)); bzero((char*) &table_list,sizeof(table_list));
if (!(table_list.db=thd->db)) if (!(table_list.db=thd->db))
{ {
my_error(ER_NO_DB_ERROR, MYF(0)); my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
break; break;
} }
pend= strend(packet); pend= strend(packet);
@ -1604,7 +1606,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
// null test to handle EOM // null test to handle EOM
if (!db || !(alias= thd->strdup(db)) || check_db_name(db)) if (!db || !(alias= thd->strdup(db)) || check_db_name(db))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL"); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
db ? db : "NULL");
break; break;
} }
if (check_access(thd,CREATE_ACL,db,0,1,0)) if (check_access(thd,CREATE_ACL,db,0,1,0))
@ -1621,14 +1624,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* null test to handle EOM */ /* null test to handle EOM */
if (!db || !(alias= thd->strdup(db)) || check_db_name(db)) if (!db || !(alias= thd->strdup(db)) || check_db_name(db))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL"); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME),
MYF(0), db ? db : "NULL");
break; break;
} }
if (check_access(thd,DROP_ACL,db,0,1,0)) if (check_access(thd,DROP_ACL,db,0,1,0))
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
break; break;
} }
mysql_log.write(thd,command,db); mysql_log.write(thd,command,db);
@ -1777,7 +1782,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
send_eof(thd); send_eof(thd);
break; break;
default: default:
my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
break; break;
} }
break; break;
@ -1796,7 +1801,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case COM_DELAYED_INSERT: case COM_DELAYED_INSERT:
case COM_END: case COM_END:
default: default:
my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
break; break;
} }
if (thd->lock || thd->open_tables || thd->derived_tables) if (thd->lock || thd->open_tables || thd->derived_tables)
@ -1808,7 +1813,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* report error issued during command execution */ /* report error issued during command execution */
if (thd->killed_errno() && !thd->net.report_error) if (thd->killed_errno() && !thd->net.report_error)
thd->send_kill_message(); thd->send_kill_message();
if (thd->is_fatal_error || thd->net.report_error) if (thd->net.report_error)
net_send_error(thd); net_send_error(thd);
time_t start_of_query=thd->start_time; time_t start_of_query=thd->start_time;
@ -1958,7 +1963,7 @@ mysql_execute_command(THD *thd)
if (all_tables_not_ok(thd, all_tables)) if (all_tables_not_ok(thd, all_tables))
{ {
/* we warn the slave SQL thread */ /* we warn the slave SQL thread */
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#ifndef TO_BE_DELETED #ifndef TO_BE_DELETED
@ -2159,9 +2164,11 @@ mysql_execute_command(THD *thd)
} }
else else
{ {
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), my_printf_error(ER_UNKNOWN_STMT_HANDLER, ER(ER_UNKNOWN_STMT_HANDLER),
lex->prepared_stmt_name.length, lex->prepared_stmt_name.str, MYF(0),
"DEALLOCATE PREPARE"); lex->prepared_stmt_name.length,
lex->prepared_stmt_name.str,
"DEALLOCATE PREPARE");
goto error; goto error;
} }
break; break;
@ -2354,7 +2361,8 @@ mysql_execute_command(THD *thd)
} }
if (strlen(first_table->real_name) > NAME_LEN) if (strlen(first_table->real_name) > NAME_LEN)
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), first_table->real_name); my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
first_table->real_name);
break; break;
} }
pthread_mutex_lock(&LOCK_active_mi); pthread_mutex_lock(&LOCK_active_mi);
@ -2425,7 +2433,8 @@ mysql_execute_command(THD *thd)
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) && if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
unique_table(create_table, select_tables)) unique_table(create_table, select_tables))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), create_table->real_name); my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
MYF(0), create_table->real_name);
goto create_error; goto create_error;
} }
/* If we create merge table, we have to test tables in merge, too */ /* If we create merge table, we have to test tables in merge, too */
@ -2438,7 +2447,8 @@ mysql_execute_command(THD *thd)
{ {
if (unique_table(tab, select_tables)) if (unique_table(tab, select_tables))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), tab->real_name); my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
MYF(0), tab->real_name);
goto create_error; goto create_error;
} }
} }
@ -2524,7 +2534,8 @@ create_error:
*/ */
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, ER(ER_LOCK_OR_ACTIVE_TRANSACTION),
MYF(0));
goto error; goto error;
} }
{ {
@ -2538,14 +2549,16 @@ create_error:
case SQLCOM_ALTER_TABLE: case SQLCOM_ALTER_TABLE:
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
#if defined(DONT_ALLOW_SHOW_COMMANDS) #if defined(DONT_ALLOW_SHOW_COMMANDS)
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
ulong priv=0; ulong priv=0;
if (lex->name && (!lex->name[0] || strlen(lex->name) > NAME_LEN)) if (lex->name && (!lex->name[0] || strlen(lex->name) > NAME_LEN))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), lex->name); my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
lex->name);
goto error; goto error;
} }
if (!select_lex->db) if (!select_lex->db)
@ -2629,7 +2642,8 @@ create_error:
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
case SQLCOM_SHOW_BINLOGS: case SQLCOM_SHOW_BINLOGS:
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
@ -2643,7 +2657,8 @@ create_error:
case SQLCOM_SHOW_CREATE: case SQLCOM_SHOW_CREATE:
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
@ -2841,7 +2856,8 @@ create_error:
*/ */
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error; goto error;
} }
@ -2939,7 +2955,8 @@ create_error:
break; break;
case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_DATABASES:
#if defined(DONT_ALLOW_SHOW_COMMANDS) #if defined(DONT_ALLOW_SHOW_COMMANDS)
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
if ((specialflag & SPECIAL_SKIP_SHOW_DB) && if ((specialflag & SPECIAL_SKIP_SHOW_DB) &&
@ -2985,7 +3002,8 @@ create_error:
break; break;
case SQLCOM_SHOW_LOGS: case SQLCOM_SHOW_LOGS:
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
@ -2998,30 +3016,33 @@ create_error:
case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLES:
/* FALL THROUGH */ /* FALL THROUGH */
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
char *db=select_lex->db ? select_lex->db : thd->db; char *db=select_lex->db ? select_lex->db : thd->db;
if (!db) if (!db)
{ {
my_error(ER_NO_DB_ERROR, MYF(0)); /* purecov: inspected */ my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
MYF(0)); /* purecov: inspected */
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
} }
remove_escape(db); // Fix escaped '_' remove_escape(db); // Fix escaped '_'
if (check_db_name(db)) if (check_db_name(db))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), db); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), db);
goto error; goto error;
} }
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0)) if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
if (!thd->col_access && check_grant_db(thd,db)) if (!thd->col_access && check_grant_db(thd,db))
{ {
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), my_printf_error(ER_DBACCESS_DENIED_ERROR,
thd->priv_user, ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
thd->priv_host, thd->priv_user,
db); thd->priv_host,
db);
goto error; goto error;
} }
/* grant is checked in mysqld_show_tables */ /* grant is checked in mysqld_show_tables */
@ -3047,7 +3068,8 @@ create_error:
case SQLCOM_SHOW_FIELDS: case SQLCOM_SHOW_FIELDS:
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
@ -3068,7 +3090,8 @@ create_error:
case SQLCOM_SHOW_KEYS: case SQLCOM_SHOW_KEYS:
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND),
MYF(0)); /* purecov: inspected */
goto error; goto error;
#else #else
{ {
@ -3104,7 +3127,7 @@ create_error:
if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) || if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) ||
! opt_local_infile) ! opt_local_infile)
{ {
my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND), MYF(0));
goto error; goto error;
} }
if (check_one_table_access(thd, privilege, all_tables)) if (check_one_table_access(thd, privilege, all_tables))
@ -3179,7 +3202,8 @@ create_error:
char *alias; char *alias;
if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name)) if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
lex->name);
break; break;
} }
/* /*
@ -3194,7 +3218,7 @@ create_error:
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name))) !db_ok_with_wild_table(lex->name)))
{ {
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break; break;
} }
#endif #endif
@ -3209,7 +3233,8 @@ create_error:
char *alias; char *alias;
if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name)) if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
lex->name);
break; break;
} }
/* /*
@ -3224,7 +3249,7 @@ create_error:
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name))) !db_ok_with_wild_table(lex->name)))
{ {
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break; break;
} }
#endif #endif
@ -3232,7 +3257,8 @@ create_error:
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error; goto error;
} }
res=mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : lex->name), res=mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : lex->name),
@ -3243,7 +3269,8 @@ create_error:
{ {
if (!strip_sp(lex->name) || check_db_name(lex->name)) if (!strip_sp(lex->name) || check_db_name(lex->name))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
lex->name);
break; break;
} }
/* /*
@ -3258,7 +3285,7 @@ create_error:
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name))) !db_ok_with_wild_table(lex->name)))
{ {
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break; break;
} }
#endif #endif
@ -3266,7 +3293,8 @@ create_error:
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error; goto error;
} }
res=mysql_alter_db(thd,lex->name,&lex->create_info); res=mysql_alter_db(thd,lex->name,&lex->create_info);
@ -3276,14 +3304,16 @@ create_error:
{ {
if (!strip_sp(lex->name) || check_db_name(lex->name)) if (!strip_sp(lex->name) || check_db_name(lex->name))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
lex->name);
break; break;
} }
if (check_access(thd,SELECT_ACL,lex->name,0,1,0)) if (check_access(thd,SELECT_ACL,lex->name,0,1,0))
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error; goto error;
} }
res=mysqld_show_create_db(thd,lex->name,&lex->create_info); res=mysqld_show_create_db(thd,lex->name,&lex->create_info);
@ -3297,7 +3327,8 @@ create_error:
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
if ((sph= sp_find_function(thd, lex->spname))) if ((sph= sp_find_function(thd, lex->spname)))
{ {
my_error(ER_UDF_EXISTS, MYF(0), lex->spname->m_name.str); my_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0),
lex->spname->m_name.str);
goto error; goto error;
} }
if (!(res = mysql_create_function(thd,&lex->udf))) if (!(res = mysql_create_function(thd,&lex->udf)))
@ -3405,7 +3436,8 @@ create_error:
{ {
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)); my_message(ER_ILLEGAL_GRANT_FOR_TABLE, ER(ER_ILLEGAL_GRANT_FOR_TABLE),
MYF(0));
goto error; goto error;
} }
else else
@ -3588,7 +3620,7 @@ create_error:
if (! lex->sphead->m_db.str) if (! lex->sphead->m_db.str)
{ {
my_error(ER_NO_DB_ERROR, MYF(0)); my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
@ -3602,7 +3634,7 @@ create_error:
if (udf) if (udf)
{ {
my_error(ER_UDF_EXISTS, MYF(0), name); my_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0), name);
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
@ -3612,7 +3644,7 @@ create_error:
if (lex->sphead->m_type == TYPE_ENUM_FUNCTION && if (lex->sphead->m_type == TYPE_ENUM_FUNCTION &&
!lex->sphead->m_has_return) !lex->sphead->m_has_return)
{ {
my_error(ER_SP_NORETURN, MYF(0), name); my_printf_error(ER_SP_NORETURN, ER(ER_SP_NORETURN), MYF(0), name);
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
@ -3627,19 +3659,22 @@ create_error:
lex->sphead= 0; lex->sphead= 0;
break; break;
case SP_WRITE_ROW_FAILED: case SP_WRITE_ROW_FAILED:
my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name); my_printf_error(ER_SP_ALREADY_EXISTS, ER(ER_SP_ALREADY_EXISTS), MYF(0),
SP_TYPE_STRING(lex), name);
lex->unit.cleanup(); lex->unit.cleanup();
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
case SP_NO_DB_ERROR: case SP_NO_DB_ERROR:
my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str); my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0),
lex->sphead->m_db.str);
lex->unit.cleanup(); lex->unit.cleanup();
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
default: default:
my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name); my_printf_error(ER_SP_STORE_FAILED, ER(ER_SP_STORE_FAILED), MYF(0),
SP_TYPE_STRING(lex), name);
lex->unit.cleanup(); lex->unit.cleanup();
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
@ -3653,7 +3688,8 @@ create_error:
if (!(sp= sp_find_procedure(thd, lex->spname))) if (!(sp= sp_find_procedure(thd, lex->spname)))
{ {
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PROCEDURE", my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
MYF(0), "PROCEDURE",
lex->spname->m_qname.str); lex->spname->m_qname.str);
goto error; goto error;
} }
@ -3680,7 +3716,7 @@ create_error:
{ {
if (! (thd->client_capabilities & CLIENT_MULTI_RESULTS)) if (! (thd->client_capabilities & CLIENT_MULTI_RESULTS))
{ {
my_error(ER_SP_BADSELECT, MYF(0)); my_message(ER_SP_BADSELECT, ER(ER_SP_BADSELECT), MYF(0));
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
thd->net.no_send_ok= nsok; thd->net.no_send_ok= nsok;
#endif #endif
@ -3751,12 +3787,12 @@ create_error:
send_ok(thd); send_ok(thd);
break; break;
case SP_KEY_NOT_FOUND: case SP_KEY_NOT_FOUND:
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), SP_COM_STRING(lex), my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
default: default:
my_error(ER_SP_CANT_ALTER, MYF(0), SP_COM_STRING(lex), my_printf_error(ER_SP_CANT_ALTER, ER(ER_SP_CANT_ALTER), MYF(0),
lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
} }
break; break;
@ -3818,12 +3854,12 @@ create_error:
send_ok(thd); send_ok(thd);
break; break;
} }
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), SP_COM_STRING(lex), my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
default: default:
my_error(ER_SP_DROP_FAILED, MYF(0), SP_COM_STRING(lex), my_printf_error(ER_SP_DROP_FAILED, ER(ER_SP_DROP_FAILED), MYF(0),
lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
} }
break; break;
@ -3832,13 +3868,14 @@ create_error:
{ {
if (lex->spname->m_name.length > NAME_LEN) if (lex->spname->m_name.length > NAME_LEN)
{ {
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str); my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
lex->spname->m_name.str);
goto error; goto error;
} }
if (sp_show_create_procedure(thd, lex->spname) != SP_OK) if (sp_show_create_procedure(thd, lex->spname) != SP_OK)
{ /* We don't distinguish between errors for now */ { /* We don't distinguish between errors for now */
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
SP_COM_STRING(lex), lex->spname->m_name.str); SP_COM_STRING(lex), lex->spname->m_name.str);
goto error; goto error;
} }
break; break;
@ -3847,13 +3884,14 @@ create_error:
{ {
if (lex->spname->m_name.length > NAME_LEN) if (lex->spname->m_name.length > NAME_LEN)
{ {
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str); my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
lex->spname->m_name.str);
goto error; goto error;
} }
if (sp_show_create_function(thd, lex->spname) != SP_OK) if (sp_show_create_function(thd, lex->spname) != SP_OK)
{ /* We don't distinguish between errors for now */ { /* We don't distinguish between errors for now */
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
SP_COM_STRING(lex), lex->spname->m_name.str); SP_COM_STRING(lex), lex->spname->m_name.str);
goto error; goto error;
} }
break; break;
@ -4029,7 +4067,8 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
{ {
DBUG_PRINT("error",("No database")); DBUG_PRINT("error",("No database"));
if (!no_errors) if (!no_errors)
my_error(ER_NO_DB_ERROR, MYF(0)); /* purecov: tested */ my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
MYF(0)); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */ DBUG_RETURN(TRUE); /* purecov: tested */
} }
@ -4056,10 +4095,13 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
{ // We can never grant this { // We can never grant this
DBUG_PRINT("error",("No possible access")); DBUG_PRINT("error",("No possible access"));
if (!no_errors) if (!no_errors)
my_error(ER_ACCESS_DENIED_ERROR, MYF(0), my_printf_error(ER_ACCESS_DENIED_ERROR,
thd->priv_user, ER(ER_ACCESS_DENIED_ERROR), MYF(0),
thd->priv_host, thd->priv_user,
thd->password ? ER(ER_YES) : ER(ER_NO));/* purecov: tested */ thd->priv_host,
(thd->password ?
ER(ER_YES) :
ER(ER_NO)));/* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */ DBUG_RETURN(TRUE); /* purecov: tested */
} }
@ -4085,10 +4127,13 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_PRINT("error",("Access denied")); DBUG_PRINT("error",("Access denied"));
if (!no_errors) if (!no_errors)
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), my_printf_error(ER_DBACCESS_DENIED_ERROR,
thd->priv_user, ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
thd->priv_host, thd->priv_user,
db ? db : thd->db ? thd->db : "unknown"); /* purecov: tested */ thd->priv_host,
(db ? db : (thd->db ?
thd->db :
"unknown"))); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */ DBUG_RETURN(TRUE); /* purecov: tested */
#endif /* NO_EMBEDDED_ACCESS_CHECKS */ #endif /* NO_EMBEDDED_ACCESS_CHECKS */
} }
@ -4122,7 +4167,8 @@ bool check_global_access(THD *thd, ulong want_access)
if ((thd->master_access & want_access)) if ((thd->master_access & want_access))
return 0; return 0;
get_privilege_desc(command, sizeof(command), want_access); get_privilege_desc(command, sizeof(command), want_access);
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command); my_printf_error(ER_SPECIFIC_ACCESS_DENIED_ERROR,
ER(ER_SPECIFIC_ACCESS_DENIED_ERROR), MYF(0), command);
return 1; return 1;
#endif /* NO_EMBEDDED_ACCESS_CHECKS */ #endif /* NO_EMBEDDED_ACCESS_CHECKS */
} }
@ -4234,7 +4280,8 @@ static bool check_db_used(THD *thd,TABLE_LIST *tables)
{ {
if (!(tables->db=thd->db)) if (!(tables->db=thd->db))
{ {
my_error(ER_NO_DB_ERROR, MYF(0)); /* purecov: tested */ my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
MYF(0)); /* purecov: tested */
return TRUE; /* purecov: tested */ return TRUE; /* purecov: tested */
} }
} }
@ -4272,7 +4319,8 @@ check_sp_definer_access(THD *thd, sp_head *sp)
strncmp(thd->priv_host, hst->str, hst->length) == 0) strncmp(thd->priv_host, hst->str, hst->length) == 0)
return FALSE; /* Both user and host must match */ return FALSE; /* Both user and host must match */
my_error(ER_SP_ACCESS_DENIED_ERROR, MYF(0), sp->m_qname.str); my_printf_error(ER_SP_ACCESS_DENIED_ERROR, ER(ER_SP_ACCESS_DENIED_ERROR),
MYF(0), sp->m_qname.str);
return TRUE; /* Not definer or root */ return TRUE; /* Not definer or root */
} }
@ -4636,7 +4684,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if (strlen(field_name) > NAME_LEN) if (strlen(field_name) > NAME_LEN)
{ {
my_error(ER_TOO_LONG_IDENT, MYF(0), field_name); /* purecov: inspected */ my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
if (type_modifier & PRI_KEY_FLAG) if (type_modifier & PRI_KEY_FLAG)
@ -4667,7 +4716,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
!(((Item_func*)default_value)->functype() == Item_func::NOW_FUNC && !(((Item_func*)default_value)->functype() == Item_func::NOW_FUNC &&
type == FIELD_TYPE_TIMESTAMP)) type == FIELD_TYPE_TIMESTAMP))
{ {
my_error(ER_INVALID_DEFAULT, MYF(0), field_name); my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (default_value->type() == Item::NULL_ITEM) else if (default_value->type() == Item::NULL_ITEM)
@ -4676,20 +4726,23 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) ==
NOT_NULL_FLAG) NOT_NULL_FLAG)
{ {
my_error(ER_INVALID_DEFAULT, MYF(0), field_name); my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
else if (type_modifier & AUTO_INCREMENT_FLAG) else if (type_modifier & AUTO_INCREMENT_FLAG)
{ {
my_error(ER_INVALID_DEFAULT, MYF(0), field_name); my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
if (on_update_value && type != FIELD_TYPE_TIMESTAMP) if (on_update_value && type != FIELD_TYPE_TIMESTAMP)
{ {
my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name); my_printf_error(ER_INVALID_ON_UPDATE, ER(ER_INVALID_ON_UPDATE), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -4815,8 +4868,9 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
res=default_value->val_str(&str); res=default_value->val_str(&str);
if (res->length()) if (res->length())
{ {
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), my_printf_error(ER_BLOB_CANT_HAVE_DEFAULT,
field_name); /* purecov: inspected */ ER(ER_BLOB_CANT_HAVE_DEFAULT), MYF(0),
field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
new_field->def=0; new_field->def=0;
@ -4836,7 +4890,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
uint tmp_length=new_field->length; uint tmp_length=new_field->length;
if (tmp_length > PRECISION_FOR_DOUBLE) if (tmp_length > PRECISION_FOR_DOUBLE)
{ {
my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name); my_printf_error(ER_WRONG_FIELD_SPEC, ER(ER_WRONG_FIELD_SPEC), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (tmp_length > PRECISION_FOR_FLOAT) else if (tmp_length > PRECISION_FOR_FLOAT)
@ -4922,7 +4977,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
{ {
if (interval->count > sizeof(longlong)*8) if (interval->count > sizeof(longlong)*8)
{ {
my_error(ER_TOO_BIG_SET, MYF(0), field_name); /* purecov: inspected */ my_printf_error(ER_TOO_BIG_SET, ER(ER_TOO_BIG_SET), MYF(0),
field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
new_field->pack_length=(interval->count+7)/8; new_field->pack_length=(interval->count+7)/8;
@ -4952,7 +5008,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
&not_used2, &not_used3); &not_used2, &not_used3);
if (thd->cuted_fields) if (thd->cuted_fields)
{ {
my_error(ER_INVALID_DEFAULT, MYF(0), field_name); my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
@ -4978,7 +5035,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
res->strip_sp(); res->strip_sp();
if (!find_type(interval, res->ptr(), res->length(), 0)) if (!find_type(interval, res->ptr(), res->length(), 0))
{ {
my_error(ER_INVALID_DEFAULT, MYF(0), field_name); my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
@ -4992,14 +5050,15 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
type != FIELD_TYPE_STRING && type != FIELD_TYPE_STRING &&
type != FIELD_TYPE_VAR_STRING && type != FIELD_TYPE_GEOMETRY)) type != FIELD_TYPE_VAR_STRING && type != FIELD_TYPE_GEOMETRY))
{ {
my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), field_name, my_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH), MYF(0),
MAX_FIELD_CHARLENGTH); /* purecov: inspected */ field_name, MAX_FIELD_CHARLENGTH);/* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
type_modifier&= AUTO_INCREMENT_FLAG; type_modifier&= AUTO_INCREMENT_FLAG;
if ((~allowed_type_modifier) & type_modifier) if ((~allowed_type_modifier) & type_modifier)
{ {
my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name); my_printf_error(ER_WRONG_FIELD_SPEC, ER(ER_WRONG_FIELD_SPEC), MYF(0),
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!new_field->pack_length) if (!new_field->pack_length)
@ -5129,7 +5188,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if (check_table_name(table->table.str,table->table.length) || if (check_table_name(table->table.str,table->table.length) ||
table->db.str && check_db_name(table->db.str)) table->db.str && check_db_name(table->db.str))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
table->table.str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -5137,7 +5197,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
{ {
if (table->sel) if (table->sel)
{ {
my_error(ER_DERIVED_MUST_HAVE_ALIAS, MYF(0)); my_message(ER_DERIVED_MUST_HAVE_ALIAS,
ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!(alias_str=thd->memdup(alias_str,table->table.length+1))) if (!(alias_str=thd->memdup(alias_str,table->table.length+1)))
@ -5191,7 +5252,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if (!my_strcasecmp(table_alias_charset, alias_str, tables->alias) && if (!my_strcasecmp(table_alias_charset, alias_str, tables->alias) &&
!strcmp(ptr->db, tables->db)) !strcmp(ptr->db, tables->db))
{ {
my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str); /* purecov: tested */ my_printf_error(ER_NONUNIQ_TABLE, ER(ER_NONUNIQ_TABLE), MYF(0),
alias_str); /* purecov: tested */
DBUG_RETURN(0); /* purecov: tested */ DBUG_RETURN(0); /* purecov: tested */
} }
} }
@ -5735,7 +5797,8 @@ static bool append_file_to_dir(THD *thd, const char **filename_ptr,
if (strlen(*filename_ptr)+strlen(table_name) >= FN_REFLEN-1 || if (strlen(*filename_ptr)+strlen(table_name) >= FN_REFLEN-1 ||
!test_if_hard_path(*filename_ptr)) !test_if_hard_path(*filename_ptr))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), *filename_ptr); my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
*filename_ptr);
return 1; return 1;
} }
/* Fix is using unix filename format on dos */ /* Fix is using unix filename format on dos */
@ -5768,7 +5831,8 @@ bool check_simple_select()
char command[80]; char command[80];
strmake(command, thd->lex->yylval->symbol.str, strmake(command, thd->lex->yylval->symbol.str,
min(thd->lex->yylval->symbol.length, sizeof(command)-1)); min(thd->lex->yylval->symbol.length, sizeof(command)-1));
my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command); my_printf_error(ER_CANT_USE_OPTION_HERE, ER(ER_CANT_USE_OPTION_HERE),
MYF(0), command);
return 1; return 1;
} }
return 0; return 0;
@ -5916,7 +5980,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
if (select_lex->item_list.elements != lex->value_list.elements) if (select_lex->item_list.elements != lex->value_list.elements)
{ {
my_error(ER_WRONG_VALUE_COUNT, MYF(0)); my_printf_error(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* /*
@ -5997,7 +6061,8 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if ((thd->options & OPTION_SAFE_UPDATES) && !select_lex->where) if ((thd->options & OPTION_SAFE_UPDATES) && !select_lex->where)
{ {
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0)); my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
for (target_tbl= aux_tables; target_tbl; target_tbl= target_tbl->next_local) for (target_tbl= aux_tables; target_tbl; target_tbl= target_tbl->next_local)
@ -6014,8 +6079,8 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
} }
if (!walk) if (!walk)
{ {
my_error(ER_UNKNOWN_TABLE, MYF(0), target_tbl->real_name, my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
"MULTI DELETE"); target_tbl->real_name, "MULTI DELETE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
walk->lock_type= target_tbl->lock_type; walk->lock_type= target_tbl->lock_type;
@ -6069,7 +6134,7 @@ bool update_precheck(THD *thd, TABLE_LIST *tables)
DBUG_ENTER("update_precheck"); DBUG_ENTER("update_precheck");
if (thd->lex->select_lex.item_list.elements != thd->lex->value_list.elements) if (thd->lex->select_lex.item_list.elements != thd->lex->value_list.elements)
{ {
my_error(ER_WRONG_VALUE_COUNT, MYF(0)); my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(check_db_used(thd, tables) || DBUG_RETURN(check_db_used(thd, tables) ||
@ -6127,7 +6192,7 @@ bool insert_precheck(THD *thd, TABLE_LIST *tables, bool update)
if (lex->select_lex.item_list.elements != lex->value_list.elements) if (lex->select_lex.item_list.elements != lex->value_list.elements)
{ {
my_error(ER_WRONG_VALUE_COUNT, MYF(0)); my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);

View File

@ -1451,7 +1451,7 @@ static int send_prepare_results(Prepared_statement *stmt, bool text_protocol)
All other is not supported yet All other is not supported yet
*/ */
res= -1; res= -1;
my_error(ER_UNSUPPORTED_PS, MYF(0)); my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0));
goto error; goto error;
} }
if (res == 0) if (res == 0)

View File

@ -44,7 +44,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION,MYF(0)); my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -156,7 +157,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
unpack_filename(name, name); unpack_filename(name, name);
if (!access(name,F_OK)) if (!access(name,F_OK))
{ {
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_alias); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
MYF(0), new_alias);
DBUG_RETURN(ren_table); // This can't be skipped DBUG_RETURN(ren_table); // This can't be skipped
} }
sprintf(name,"%s/%s/%s%s",mysql_data_home, sprintf(name,"%s/%s/%s%s",mysql_data_home,
@ -165,7 +167,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
unpack_filename(name, name); unpack_filename(name, name);
if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN) if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN)
{ {
my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno); my_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), MYF(0),
name, my_errno);
if (!skip_error) if (!skip_error)
DBUG_RETURN(ren_table); DBUG_RETURN(ren_table);
} }

View File

@ -296,7 +296,7 @@ bool purge_error_message(THD* thd, int res)
if (errmsg) if (errmsg)
{ {
my_error(errmsg, MYF(0)); my_message(errmsg, ER(errmsg), MYF(0));
return TRUE; return TRUE;
} }
send_ok(thd); send_ok(thd);
@ -867,7 +867,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
if (slave_errno) if (slave_errno)
{ {
if (net_report) if (net_report)
my_error(slave_errno, MYF(0)); my_message(slave_errno, ER(slave_errno), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (net_report) else if (net_report)
@ -917,7 +917,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
if (slave_errno) if (slave_errno)
{ {
if (net_report) if (net_report)
my_error(slave_errno, MYF(0)); my_message(slave_errno, ER(slave_errno), MYF(0));
return 1; return 1;
} }
else if (net_report) else if (net_report)
@ -999,7 +999,7 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
err: err:
unlock_slave_threads(mi); unlock_slave_threads(mi);
if (error) if (error)
my_error(sql_errno, MYF(0), errmsg); my_printf_error(sql_errno, ER(sql_errno), MYF(0), errmsg);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -1063,7 +1063,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
init_thread_mask(&thread_mask,mi,0 /*not inverse*/); init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
if (thread_mask) // We refuse if any slave thread is running if (thread_mask) // We refuse if any slave thread is running
{ {
my_error(ER_SLAVE_MUST_STOP, MYF(0)); my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1073,7 +1073,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
// TODO: see if needs re-write // TODO: see if needs re-write
if (init_master_info(mi, master_info_file, relay_log_info_file, 0)) if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
{ {
my_error(ER_MASTER_INFO, MYF(0)); my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1192,7 +1192,8 @@ bool change_master(THD* thd, MASTER_INFO* mi)
0 /* not only reset, but also reinit */, 0 /* not only reset, but also reinit */,
&errmsg)) &errmsg))
{ {
my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg); my_printf_error(ER_RELAY_LOG_FAIL, ER(ER_RELAY_LOG_FAIL), MYF(0),
errmsg);
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1208,7 +1209,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
0 /*no data lock*/, 0 /*no data lock*/,
&msg, 0)) &msg, 0))
{ {
my_error(ER_RELAY_LOG_INIT, MYF(0), msg); my_printf_error(ER_RELAY_LOG_INIT, ER(ER_RELAY_LOG_INIT), MYF(0), msg);
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1259,7 +1260,8 @@ int reset_master(THD* thd)
{ {
if (!mysql_bin_log.is_open()) if (!mysql_bin_log.is_open())
{ {
my_error(ER_FLUSH_MASTER_BINLOG_CLOSED, MYF(ME_BELL+ME_WAITTANG)); my_message(ER_FLUSH_MASTER_BINLOG_CLOSED,
ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
return 1; return 1;
} }
return mysql_bin_log.reset_logs(thd); return mysql_bin_log.reset_logs(thd);
@ -1401,8 +1403,9 @@ err:
if (errmsg) if (errmsg)
{ {
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND,
"SHOW BINLOG EVENTS", errmsg); ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0),
"SHOW BINLOG EVENTS", errmsg);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1470,7 +1473,7 @@ bool show_binlogs(THD* thd)
if (!mysql_bin_log.is_open()) if (!mysql_bin_log.is_open())
{ {
my_error(ER_NO_BINARY_LOGGING, MYF(0)); my_message(ER_NO_BINARY_LOGGING, ER(ER_NO_BINARY_LOGGING), MYF(0));
return 1; return 1;
} }

View File

@ -377,7 +377,8 @@ JOIN::prepare(Item ***rref_pointer_array,
} }
if (flag == 3) if (flag == 3)
{ {
my_error(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,MYF(0)); my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -404,7 +405,8 @@ JOIN::prepare(Item ***rref_pointer_array,
{ {
if (!test_if_subpart(procedure->group,group_list)) if (!test_if_subpart(procedure->group,group_list))
{ /* purecov: inspected */ { /* purecov: inspected */
my_error(ER_DIFF_GROUPS_PROC, MYF(0)); /* purecov: inspected */ my_message(ER_DIFF_GROUPS_PROC, ER(ER_DIFF_GROUPS_PROC),
MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
} }
} }
@ -417,7 +419,8 @@ JOIN::prepare(Item ***rref_pointer_array,
#endif #endif
if (order && (procedure->flags & PROC_NO_SORT)) if (order && (procedure->flags & PROC_NO_SORT))
{ /* purecov: inspected */ { /* purecov: inspected */
my_error(ER_ORDER_WITH_PROC, MYF(0)); /* purecov: inspected */ my_message(ER_ORDER_WITH_PROC, ER(ER_ORDER_WITH_PROC),
MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
} }
} }
@ -1805,7 +1808,7 @@ Cursor::fetch(ulong num_rows)
if (thd->killed) /* Aborted by user */ if (thd->killed) /* Aborted by user */
{ {
my_error(ER_SERVER_SHUTDOWN,MYF(0)); my_message(ER_SERVER_SHUTDOWN, ER(ER_SERVER_SHUTDOWN), MYF(0));
return -1; return -1;
} }
@ -2209,7 +2212,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
if (s->dependent & s->table->map) if (s->dependent & s->table->map)
{ {
join->tables=0; // Don't use join->table join->tables=0; // Don't use join->table
my_error(ER_WRONG_OUTER_JOIN,MYF(0)); my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
s->key_dependent= s->dependent; s->key_dependent= s->dependent;
@ -5622,7 +5625,8 @@ bool error_if_full_join(JOIN *join)
{ {
if (tab->type == JT_ALL && (!tab->select || !tab->select->quick)) if (tab->type == JT_ALL && (!tab->select || !tab->select->quick))
{ {
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,MYF(0)); my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
return(1); return(1);
} }
} }
@ -10664,7 +10668,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
} }
if (copy_blobs(first_field)) if (copy_blobs(first_field))
{ {
my_error(ER_OUTOFMEMORY,MYF(0)); my_message(ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0));
error=0; error=0;
goto err; goto err;
} }

View File

@ -866,8 +866,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
/* TODO: add environment variables show when it become possible */ /* TODO: add environment variables show when it become possible */
if (thd->lex->only_view && !table_list->view) if (thd->lex->only_view && !table_list->view)
{ {
my_error(ER_WRONG_OBJECT, MYF(0), table_list->db, my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
table_list->real_name, "VIEW"); table_list->db, table_list->real_name, "VIEW");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -936,7 +936,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
if (check_db_name(dbname)) if (check_db_name(dbname))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), dbname); my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -948,8 +948,9 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
thd->master_access); thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{ {
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), my_printf_error(ER_DBACCESS_DENIED_ERROR,
thd->priv_user, thd->host_or_ip, dbname); ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
thd->priv_user, thd->host_or_ip, dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user, thd->host_or_ip, dbname); thd->priv_user, thd->host_or_ip, dbname);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
@ -966,7 +967,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
} }
if (access(path,F_OK)) if (access(path,F_OK))
{ {
my_error(ER_BAD_DB_ERROR, MYF(0), dbname); my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (found_libchar) if (found_libchar)

View File

@ -78,8 +78,9 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
{ {
if (thd->global_read_lock) if (thd->global_read_lock)
{ {
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0), my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,
tables->real_name); ER(ER_TABLE_NOT_LOCKED_FOR_WRITE), MYF(0),
tables->real_name);
error= TRUE; error= TRUE;
goto err; goto err;
} }
@ -261,9 +262,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (wrong_tables.length()) if (wrong_tables.length())
{ {
if (!foreign_key_error) if (!foreign_key_error)
my_error(ER_BAD_TABLE_ERROR,MYF(0), wrong_tables.c_ptr()); my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
wrong_tables.c_ptr());
else else
my_error(ER_ROW_IS_REFERENCED, MYF(0)); my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
error= 1; error= 1;
} }
@ -463,7 +465,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (check_column_name(sql_field->field_name)) if (check_column_name(sql_field->field_name))
{ {
my_error(ER_WRONG_COLUMN_NAME, MYF(0), sql_field->field_name); my_printf_error(ER_WRONG_COLUMN_NAME, ER(ER_WRONG_COLUMN_NAME), MYF(0),
sql_field->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -480,7 +483,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
*/ */
if (field_no < select_field_pos || dup_no >= select_field_pos) if (field_no < select_field_pos || dup_no >= select_field_pos)
{ {
my_error(ER_DUP_FIELDNAME,MYF(0),sql_field->field_name); my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME), MYF(0),
sql_field->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else else
@ -619,24 +623,27 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
} }
if (timestamps_with_niladic > 1) if (timestamps_with_niladic > 1)
{ {
my_error(ER_TOO_MUCH_AUTO_TIMESTAMP_COLS,MYF(0)); my_message(ER_TOO_MUCH_AUTO_TIMESTAMP_COLS,
ER(ER_TOO_MUCH_AUTO_TIMESTAMP_COLS), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (auto_increment > 1) if (auto_increment > 1)
{ {
my_error(ER_WRONG_AUTO_KEY,MYF(0)); my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (auto_increment && if (auto_increment &&
(file->table_flags() & HA_NO_AUTO_INCREMENT)) (file->table_flags() & HA_NO_AUTO_INCREMENT))
{ {
my_error(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT,MYF(0)); my_message(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT,
ER(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (blob_columns && (file->table_flags() & HA_NO_BLOBS)) if (blob_columns && (file->table_flags() & HA_NO_BLOBS))
{ {
my_error(ER_TABLE_CANT_HANDLE_BLOB,MYF(0)); my_message(ER_TABLE_CANT_HANDLE_BLOB, ER(ER_TABLE_CANT_HANDLE_BLOB),
MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -662,9 +669,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (fk_key->ref_columns.elements && if (fk_key->ref_columns.elements &&
fk_key->ref_columns.elements != fk_key->columns.elements) fk_key->ref_columns.elements != fk_key->columns.elements)
{ {
my_error(ER_WRONG_FK_DEF, MYF(0), fk_key->name ? fk_key->name : my_printf_error(ER_WRONG_FK_DEF, ER(ER_WRONG_FK_DEF), MYF(0),
"foreign key without name", (fk_key->name ?
ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF)); fk_key->name :
"foreign key without name"),
ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
continue; continue;
@ -678,7 +687,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
} }
if (key->name && strlen(key->name) > NAME_LEN) if (key->name && strlen(key->name) > NAME_LEN)
{ {
my_error(ER_TOO_LONG_IDENT, MYF(0), key->name); my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
key->name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
key_iterator2.rewind (); key_iterator2.rewind ();
@ -718,7 +728,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (key->name && !tmp_table && if (key->name && !tmp_table &&
!my_strcasecmp(system_charset_info,key->name,primary_key_name)) !my_strcasecmp(system_charset_info,key->name,primary_key_name))
{ {
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name); my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
MYF(0), key->name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -786,7 +797,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
{ {
if (!(file->table_flags() & HA_CAN_FULLTEXT)) if (!(file->table_flags() & HA_CAN_FULLTEXT))
{ {
my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0)); my_message(ER_TABLE_CANT_HANDLE_FT, ER(ER_TABLE_CANT_HANDLE_FT),
MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -927,7 +939,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
} }
if (key->type == Key::SPATIAL) if (key->type == Key::SPATIAL)
{ {
my_error(ER_SPATIAL_CANT_HAVE_NULL, MYF(0)); my_message(ER_SPATIAL_CANT_HAVE_NULL,
ER(ER_SPATIAL_CANT_HAVE_NULL), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -973,7 +986,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
(key_info->flags & HA_NOSAME))) && (key_info->flags & HA_NOSAME))) &&
column->length != length))) column->length != length)))
{ {
my_error(ER_WRONG_SUB_KEY,MYF(0)); my_message(ER_WRONG_SUB_KEY, ER(ER_WRONG_SUB_KEY), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else if (!(file->table_flags() & HA_NO_PREFIX_CHAR_KEYS)) else if (!(file->table_flags() & HA_NO_PREFIX_CHAR_KEYS))
@ -1026,7 +1039,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
{ {
if (primary_key) if (primary_key)
{ {
my_error(ER_MULTIPLE_PRI_KEY,MYF(0)); my_message(ER_MULTIPLE_PRI_KEY, ER(ER_MULTIPLE_PRI_KEY),
MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
key_name=primary_key_name; key_name=primary_key_name;
@ -1037,7 +1051,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key_info_buffer,key_info); key_info_buffer,key_info);
if (check_if_keyname_exists(key_name,key_info_buffer,key_info)) if (check_if_keyname_exists(key_name,key_info_buffer,key_info))
{ {
my_error(ER_DUP_KEYNAME,MYF(0),key_name); my_printf_error(ER_DUP_KEYNAME, ER(ER_DUP_KEYNAME), MYF(0),
key_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
key_info->name=(char*) key_name; key_info->name=(char*) key_name;
@ -1045,7 +1060,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
} }
if (!key_info->name || check_column_name(key_info->name)) if (!key_info->name || check_column_name(key_info->name))
{ {
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name); my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
MYF(0), key_info->name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (!(key_info->flags & HA_NULL_PART_KEY)) if (!(key_info->flags & HA_NULL_PART_KEY))
@ -1062,12 +1078,12 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (!unique_key && !primary_key && if (!unique_key && !primary_key &&
(file->table_flags() & HA_REQUIRE_PRIMARY_KEY)) (file->table_flags() & HA_REQUIRE_PRIMARY_KEY))
{ {
my_error(ER_REQUIRES_PRIMARY_KEY,MYF(0)); my_message(ER_REQUIRES_PRIMARY_KEY, ER(ER_REQUIRES_PRIMARY_KEY), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (auto_increment > 0) if (auto_increment > 0)
{ {
my_error(ER_WRONG_AUTO_KEY,MYF(0)); my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/* Sort keys in optimized order */ /* Sort keys in optimized order */
@ -1123,7 +1139,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
/* Check for duplicate fields and check type of table to create */ /* Check for duplicate fields and check type of table to create */
if (!fields.elements) if (!fields.elements)
{ {
my_error(ER_TABLE_MUST_HAVE_COLUMNS,MYF(0)); my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if ((new_db_type= ha_checktype(create_info->db_type)) != if ((new_db_type= ha_checktype(create_info->db_type)) !=
@ -1153,7 +1170,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) && if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
(file->table_flags() & HA_NO_TEMP_TABLES)) (file->table_flags() & HA_NO_TEMP_TABLES))
{ {
my_error(ER_ILLEGAL_HA,MYF(0),table_name); my_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0), table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
#endif #endif
@ -1204,7 +1221,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
create_info->table_existed= 1; // Mark that table existed create_info->table_existed= 1; // Mark that table existed
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0),
alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (wait_if_global_read_lock(thd, 0, 1)) if (wait_if_global_read_lock(thd, 0, 1))
@ -1220,7 +1238,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
error= FALSE; error= FALSE;
} }
else else
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); my_printf_error(ER_TABLE_EXISTS_ERROR,
ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
goto end; goto end;
} }
} }
@ -1249,7 +1268,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
error= FALSE; error= FALSE;
} }
else else
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); my_printf_error(ER_TABLE_EXISTS_ERROR,
ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
goto end; goto end;
} }
} }
@ -1457,7 +1477,8 @@ mysql_rename_table(enum db_type base,
} }
delete file; delete file;
if (error) if (error)
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error); my_printf_error(ER_ERROR_ON_RENAME, ER(ER_ERROR_ON_RENAME),
MYF(0), from, to, error);
DBUG_RETURN(error != 0); DBUG_RETURN(error != 0);
} }
@ -1999,7 +2020,8 @@ bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
if (!(key_cache= get_key_cache(key_cache_name))) if (!(key_cache= get_key_cache(key_cache_name)))
{ {
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str); my_printf_error(ER_UNKNOWN_KEY_CACHE, ER(ER_UNKNOWN_KEY_CACHE), MYF(0),
key_cache_name->str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
@ -2109,7 +2131,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
check_table_name(src_table,table_ident->table.length)) || check_table_name(src_table,table_ident->table.length)) ||
table_ident->db.str && check_db_name((src_db= table_ident->db.str))) table_ident->db.str && check_db_name((src_db= table_ident->db.str)))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table); my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
src_table);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -2128,7 +2151,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
reg_ext, NullS); reg_ext, NullS);
if (access(src_path, F_OK)) if (access(src_path, F_OK))
{ {
my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table); my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
src_table);
goto err; goto err;
} }
} }
@ -2211,7 +2235,8 @@ table_exists:
res= FALSE; res= FALSE;
} }
else else
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0),
table_name);
err: err:
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
@ -2467,7 +2492,8 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
} }
if (idx>= table->keys) if (idx>= table->keys)
{ {
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop_key->name); my_printf_error(ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY),
MYF(0), drop_key->name);
/*don't need to free((gptr) key_numbers);*/ /*don't need to free((gptr) key_numbers);*/
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -2590,7 +2616,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
if (find_temporary_table(thd,new_db,new_name_buff)) if (find_temporary_table(thd,new_db,new_name_buff))
{ {
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
MYF(0), new_name_buff);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2600,7 +2627,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
F_OK)) F_OK))
{ {
/* Table will be closed in do_command() */ /* Table will be closed in do_command() */
my_error(ER_TABLE_EXISTS_ERROR,MYF(0), new_alias); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
MYF(0), new_alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2640,7 +2668,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error=0; error=0;
if (!access(new_name_buff,F_OK)) if (!access(new_name_buff,F_OK))
{ {
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
MYF(0), new_name);
error= -1; error= -1;
} }
else else
@ -2783,7 +2812,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
if (def->sql_type == FIELD_TYPE_BLOB) if (def->sql_type == FIELD_TYPE_BLOB)
{ {
my_error(ER_BLOB_CANT_HAVE_DEFAULT,MYF(0),def->change); my_printf_error(ER_BLOB_CANT_HAVE_DEFAULT,
ER(ER_BLOB_CANT_HAVE_DEFAULT), MYF(0), def->change);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
def->def=alter->def; // Use new default def->def=alter->def; // Use new default
@ -2797,7 +2827,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
if (def->change && ! def->field) if (def->change && ! def->field)
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->change,table_name); my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
def->change, table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!def->after) if (!def->after)
@ -2815,7 +2846,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
if (!find) if (!find)
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->after,table_name); my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
MYF(0), def->after, table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
find_it.after(def); // Put element after this find_it.after(def); // Put element after this
@ -2823,13 +2855,14 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
if (alter_info->alter_list.elements) if (alter_info->alter_list.elements)
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_info->alter_list.head()->name, my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
table_name); alter_info->alter_list.head()->name, table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!create_list.elements) if (!create_list.elements)
{ {
my_error(ER_CANT_REMOVE_ALL_FIELDS,MYF(0)); my_message(ER_CANT_REMOVE_ALL_FIELDS, ER(ER_CANT_REMOVE_ALL_FIELDS),
MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -2918,7 +2951,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (key->name && if (key->name &&
!my_strcasecmp(system_charset_info,key->name,primary_key_name)) !my_strcasecmp(system_charset_info,key->name,primary_key_name))
{ {
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name); my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
MYF(0), key->name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2926,14 +2960,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (alter_info->drop_list.elements) if (alter_info->drop_list.elements)
{ {
my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0), my_printf_error(ER_CANT_DROP_FIELD_OR_KEY,
alter_info->drop_list.head()->name); ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0),
alter_info->drop_list.head()->name);
goto err; goto err;
} }
if (alter_info->alter_list.elements) if (alter_info->alter_list.elements)
{ {
my_error(ER_CANT_DROP_FIELD_OR_KEY,MYF(0), my_printf_error(ER_CANT_DROP_FIELD_OR_KEY,
alter_info->alter_list.head()->name); ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0),
alter_info->alter_list.head()->name);
goto err; goto err;
} }
@ -3121,7 +3157,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (!access(new_name_buff,F_OK)) if (!access(new_name_buff,F_OK))
{ {
error=1; error=1;
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
MYF(0), new_name_buff);
VOID(quick_rm_table(new_db_type,new_db,tmp_name)); VOID(quick_rm_table(new_db_type,new_db,tmp_name));
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
goto err; goto err;

View File

@ -74,7 +74,8 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
*/ */
if (tables->view || table->tmp_table != NO_TMP_TABLE) if (tables->view || table->tmp_table != NO_TMP_TABLE)
{ {
my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias); my_printf_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE,
ER(ER_TRG_ON_VIEW_OR_TEMP_TABLE), MYF(0), tables->alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -82,7 +83,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
{ {
if (!create) if (!create)
{ {
my_error(ER_TRG_DOES_NOT_EXIST, MYF(0)); my_message(ER_TRG_DOES_NOT_EXIST, ER(ER_TRG_DOES_NOT_EXIST), MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -142,7 +143,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
/* We don't allow creation of several triggers of the same type yet */ /* We don't allow creation of several triggers of the same type yet */
if (bodies[lex->trg_chistics.event][lex->trg_chistics.action_time]) if (bodies[lex->trg_chistics.event][lex->trg_chistics.action_time])
{ {
my_error(ER_TRG_ALREADY_EXISTS, MYF(0)); my_message(ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), MYF(0));
return 1; return 1;
} }
@ -152,7 +153,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
if (my_strcasecmp(system_charset_info, lex->name_and_length.str, if (my_strcasecmp(system_charset_info, lex->name_and_length.str,
name->str) == 0) name->str) == 0)
{ {
my_error(ER_TRG_ALREADY_EXISTS, MYF(0)); my_message(ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), MYF(0));
return 1; return 1;
} }
} }
@ -266,7 +267,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables)
} }
} }
my_error(ER_TRG_DOES_NOT_EXIST, MYF(0)); my_message(ER_TRG_DOES_NOT_EXIST, ER(ER_TRG_DOES_NOT_EXIST), MYF(0));
return 1; return 1;
} }
@ -433,7 +434,8 @@ err_with_lex_cleanup:
We don't care about this error message much because .TRG files will We don't care about this error message much because .TRG files will
be merged into .FRM anyway. be merged into .FRM anyway.
*/ */
my_error(ER_WRONG_OBJECT, MYF(0), table_name, triggers_file_ext, "TRIGGER"); my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
table_name, triggers_file_ext, "TRIGGER");
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View File

@ -369,7 +369,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (!initialized) if (!initialized)
{ {
my_error(ER_OUT_OF_RESOURCES, MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -380,19 +380,20 @@ int mysql_create_function(THD *thd,udf_func *udf)
*/ */
if (strchr(udf->dl, '/')) if (strchr(udf->dl, '/'))
{ {
my_error(ER_UDF_NO_PATHS, MYF(0)); my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (udf->name.length > NAME_LEN) if (udf->name.length > NAME_LEN)
{ {
my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name); my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
udf->name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
rw_wrlock(&THR_LOCK_udf); rw_wrlock(&THR_LOCK_udf);
if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length))) if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length)))
{ {
my_error(ER_UDF_EXISTS, MYF(0), udf->name); my_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0), udf->name);
goto err; goto err;
} }
if (!(dl = find_udf_dl(udf->dl))) if (!(dl = find_udf_dl(udf->dl)))
@ -401,7 +402,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
{ {
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)", DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
udf->dl,errno,dlerror())); udf->dl,errno,dlerror()));
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), udf->dl, errno, dlerror()); my_printf_error(ER_CANT_OPEN_LIBRARY, ER(ER_CANT_OPEN_LIBRARY), MYF(0),
udf->dl, errno, dlerror());
goto err; goto err;
} }
new_dl=1; new_dl=1;
@ -411,7 +413,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (udf->func == NULL) if (udf->func == NULL)
{ {
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), udf->name); my_printf_error(ER_CANT_FIND_DL_ENTRY, ER(ER_CANT_FIND_DL_ENTRY), MYF(0),
udf->name);
goto err; goto err;
} }
udf->name.str=strdup_root(&mem,udf->name.str); udf->name.str=strdup_root(&mem,udf->name.str);
@ -445,7 +448,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
close_thread_tables(thd); close_thread_tables(thd);
if (error) if (error)
{ {
my_error(ER_ERROR_ON_WRITE, MYF(0), "func@mysql", error); my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
"func@mysql", error);
del_udf(u_d); del_udf(u_d);
goto err; goto err;
} }
@ -468,14 +472,15 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
DBUG_ENTER("mysql_drop_function"); DBUG_ENTER("mysql_drop_function");
if (!initialized) if (!initialized)
{ {
my_error(ER_OUT_OF_RESOURCES, MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
rw_wrlock(&THR_LOCK_udf); rw_wrlock(&THR_LOCK_udf);
if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str, if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str,
(uint) udf_name->length))) (uint) udf_name->length)))
{ {
my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str); my_printf_error(ER_FUNCTION_NOT_DEFINED, ER(ER_FUNCTION_NOT_DEFINED),
MYF(0), udf_name->str);
goto err; goto err;
} }
del_udf(udf); del_udf(udf);

View File

@ -75,7 +75,7 @@ bool select_union::send_data(List<Item> &values)
unit->offset_limit_cnt--; unit->offset_limit_cnt--;
return 0; return 0;
} }
fill_record(table->field, values, 1); fill_record(thd, table->field, values, 1);
if (thd->net.report_error || write_record(thd, table,&info)) if (thd->net.report_error || write_record(thd, table,&info))
{ {
if (thd->net.last_errno == ER_RECORD_FILE_FULL) if (thd->net.last_errno == ER_RECORD_FILE_FULL)

View File

@ -73,7 +73,8 @@ static bool check_fields(THD *thd, List<Item> &items)
if (!(field= item->filed_for_view_update())) if (!(field= item->filed_for_view_update()))
{ {
/* item has name, because it comes from VIEW SELECT list */ /* item has name, because it comes from VIEW SELECT list */
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name); my_printf_error(ER_NONUPDATEABLE_COLUMN, ER(ER_NONUPDATEABLE_COLUMN),
MYF(0), item->name);
return TRUE; return TRUE;
} }
/* /*
@ -164,7 +165,8 @@ bool mysql_update(THD *thd,
} }
if (!table_list->updatable || check_key_in_view(thd, table_list)) if (!table_list->updatable || check_key_in_view(thd, table_list))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE"); my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (table->timestamp_field) if (table->timestamp_field)
@ -362,16 +364,9 @@ bool mysql_update(THD *thd,
if (!(select && select->skip_record())) if (!(select && select->skip_record()))
{ {
store_record(table,record[1]); store_record(table,record[1]);
if (fill_record(fields,values, 0) || thd->net.report_error) if (fill_record(thd, fields, values, 0))
{
/* Field::store methods can't send errors */
if (!thd->net.report_error)
{
/* TODO: convert last warning to error */
my_error(ER_UNKNOWN_ERROR, MYF(0));
}
break; /* purecov: inspected */ break; /* purecov: inspected */
}
found++; found++;
if (table->triggers) if (table->triggers)
@ -478,7 +473,7 @@ bool mysql_update(THD *thd,
thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
free_io_cache(table); free_io_cache(table);
DBUG_RETURN(FALSE); DBUG_RETURN(error >= 0 || thd->net.report_error);
err: err:
delete select; delete select;
@ -504,11 +499,10 @@ err:
order - ORDER BY clause list order - ORDER BY clause list
RETURN VALUE RETURN VALUE
0 - OK FALSE OK
1 - error (message is sent to user) TRUE error
-1 - error (message is not sent to user)
*/ */
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list, bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
Item **conds, uint order_num, ORDER *order) Item **conds, uint order_num, ORDER *order)
{ {
TABLE *table= table_list->table; TABLE *table= table_list->table;
@ -532,16 +526,17 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
setup_order(thd, select_lex->ref_pointer_array, setup_order(thd, select_lex->ref_pointer_array,
table_list, all_fields, all_fields, order) || table_list, all_fields, all_fields, order) ||
setup_ftfuncs(select_lex)) setup_ftfuncs(select_lex))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
/* Check that we are not using table that we are updating in a sub select */ /* Check that we are not using table that we are updating in a sub select */
if (unique_table(table_list, table_list->next_independent())) if (unique_table(table_list, table_list->next_independent()))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name); my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0),
DBUG_RETURN(-1); table_list->real_name);
DBUG_RETURN(TRUE);
} }
select_lex->fix_prepare_information(thd, conds); select_lex->fix_prepare_information(thd, conds);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -655,7 +650,8 @@ bool mysql_multi_update_prepare(THD *thd)
if ((readonly_tables & tl->table->map) && if ((readonly_tables & tl->table->map) &&
(tables_for_update & tl->table->map)) (tables_for_update & tl->table->map))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE"); my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
MYF(0), tl->alias, "UPDATE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -741,7 +737,7 @@ int multi_update::prepare(List<Item> &not_used_values,
if (!tables_to_update) if (!tables_to_update)
{ {
my_error(ER_NO_TABLES_USED, MYF(0)); my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1028,16 +1024,10 @@ bool multi_update::send_data(List<Item> &not_used_values)
{ {
table->status|= STATUS_UPDATED; table->status|= STATUS_UPDATED;
store_record(table,record[1]); store_record(table,record[1]);
if (fill_record(*fields_for_table[offset], *values_for_table[offset], 0)) if (fill_record(thd, *fields_for_table[offset],
{ *values_for_table[offset], 0))
/* Field::store methods can't send errors */
if (!thd->net.report_error)
{
/* TODO: convert last warning to error */
my_error(ER_UNKNOWN_ERROR, MYF(0));
}
DBUG_RETURN(1); DBUG_RETURN(1);
}
found++; found++;
if (compare_record(table, thd->query_id)) if (compare_record(table, thd->query_id))
{ {
@ -1075,7 +1065,7 @@ bool multi_update::send_data(List<Item> &not_used_values)
{ {
int error; int error;
TABLE *tmp_table= tmp_tables[offset]; TABLE *tmp_table= tmp_tables[offset];
fill_record(tmp_table->field+1, *values_for_table[offset], 1); fill_record(thd, tmp_table->field+1, *values_for_table[offset], 1);
found++; found++;
/* Store pointer to row */ /* Store pointer to row */
memcpy((char*) tmp_table->field[0]->ptr, memcpy((char*) tmp_table->field[0]->ptr,

View File

@ -71,9 +71,10 @@ bool mysql_create_view(THD *thd,
if (lex->derived_tables || if (lex->derived_tables ||
lex->variables_used || lex->param_list.elements) lex->variables_used || lex->param_list.elements)
{ {
my_error((lex->derived_tables ? int err= (lex->derived_tables ?
ER_VIEW_SELECT_DERIVED : ER_VIEW_SELECT_DERIVED :
ER_VIEW_SELECT_VARIABLE), MYF(0)); ER_VIEW_SELECT_VARIABLE);
my_message(err, ER(err), MYF(0));
res= TRUE; res= TRUE;
goto err; goto err;
} }
@ -188,7 +189,8 @@ bool mysql_create_view(THD *thd,
/* is this table temporary and is not view? */ /* is this table temporary and is not view? */
if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view) if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view)
{ {
my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias); my_printf_error(ER_VIEW_SELECT_TMPTABLE,
ER(ER_VIEW_SELECT_TMPTABLE), MYF(0), tbl->alias);
res= TRUE; res= TRUE;
goto err; goto err;
} }
@ -198,7 +200,8 @@ bool mysql_create_view(THD *thd,
strcmp(tbl->view_db.str, view->db) == 0 && strcmp(tbl->view_db.str, view->db) == 0 &&
strcmp(tbl->view_name.str, view->real_name) == 0) strcmp(tbl->view_name.str, view->real_name) == 0)
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str); my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
tbl->view_db.str, tbl->view_name.str);
res= TRUE; res= TRUE;
goto err; goto err;
} }
@ -253,7 +256,8 @@ bool mysql_create_view(THD *thd,
{ {
if (strcmp(item->name, check->name) == 0) if (strcmp(item->name, check->name) == 0)
{ {
my_error(ER_DUP_FIELDNAME, MYF(0), item->name); my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME),
MYF(0), item->name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -426,7 +430,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{ {
if (mode == VIEW_CREATE_NEW) if (mode == VIEW_CREATE_NEW)
{ {
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), view->alias); my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
MYF(0), view->alias);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -436,8 +441,9 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
if (!parser->ok() || if (!parser->ok() ||
strncmp("VIEW", parser->type()->str, parser->type()->length)) strncmp("VIEW", parser->type()->str, parser->type()->length))
{ {
my_error(ER_WRONG_OBJECT, MYF(0), (view->db ? view->db : thd->db), my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
view->real_name, "VIEW"); (view->db ? view->db : thd->db),
view->real_name, "VIEW");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -457,7 +463,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{ {
if (mode == VIEW_ALTER) if (mode == VIEW_ALTER)
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias); my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
view->db, view->alias);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -500,7 +507,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
if (view->with_check != VIEW_CHECK_NONE && if (view->with_check != VIEW_CHECK_NONE &&
!view->updatable_view) !view->updatable_view)
{ {
my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->real_name); my_printf_error(ER_VIEW_NONUPD_CHECK, ER(ER_VIEW_NONUPD_CHECK), MYF(0),
view->db, view->real_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -671,7 +679,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
if (check_table_access(thd, SELECT_ACL, view_tables, 1) && if (check_table_access(thd, SELECT_ACL, view_tables, 1) &&
check_table_access(thd, SHOW_VIEW_ACL, table, 1)) check_table_access(thd, SHOW_VIEW_ACL, table, 1))
{ {
my_error(ER_VIEW_NO_EXPLAIN, MYF(0)); my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
goto err; goto err;
} }
} }
@ -851,9 +859,11 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
continue; continue;
} }
if (type) if (type)
my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->real_name, "VIEW"); my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
view->db, view->real_name, "VIEW");
else else
my_error(ER_BAD_TABLE_ERROR, MYF(0), name); my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
name);
goto err; goto err;
} }
if (my_delete(path, MYF(MY_WME))) if (my_delete(path, MYF(MY_WME)))

View File

@ -813,7 +813,7 @@ query:
if (!thd->bootstrap && if (!thd->bootstrap &&
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{ {
my_error(ER_EMPTY_QUERY, MYF(0)); my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
YYABORT; YYABORT;
} }
else else
@ -1463,7 +1463,8 @@ sp_fdparam:
if (spc->find_pvar(&$1, TRUE)) if (spc->find_pvar(&$1, TRUE))
{ {
my_error(ER_SP_DUP_PARAM, MYF(0), $1.str); my_printf_error(ER_SP_DUP_PARAM, ER(ER_SP_DUP_PARAM), MYF(0),
$1.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$1, (enum enum_field_types)$2, sp_param_in); spc->push_pvar(&$1, (enum enum_field_types)$2, sp_param_in);
@ -1489,7 +1490,8 @@ sp_pdparam:
if (spc->find_pvar(&$2, TRUE)) if (spc->find_pvar(&$2, TRUE))
{ {
my_error(ER_SP_DUP_PARAM, MYF(0), $2.str); my_printf_error(ER_SP_DUP_PARAM, ER(ER_SP_DUP_PARAM), MYF(0),
$2.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$2, (enum enum_field_types)$3, spc->push_pvar(&$2, (enum enum_field_types)$3,
@ -1523,12 +1525,14 @@ sp_decls:
better error handling this way.) */ better error handling this way.) */
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs)) if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
{ /* Variable or condition following cursor or handler */ { /* Variable or condition following cursor or handler */
my_error(ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0)); my_message(ER_SP_VARCOND_AFTER_CURSHNDLR,
ER(ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
YYABORT; YYABORT;
} }
if ($2.curs && $1.hndlrs) if ($2.curs && $1.hndlrs)
{ /* Cursor following handler */ { /* Cursor following handler */
my_error(ER_SP_CURSOR_AFTER_HANDLER, MYF(0)); my_message(ER_SP_CURSOR_AFTER_HANDLER,
ER(ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
YYABORT; YYABORT;
} }
$$.vars= $1.vars + $2.vars; $$.vars= $1.vars + $2.vars;
@ -1576,7 +1580,8 @@ sp_decl:
if (spc->find_cond(&$2, TRUE)) if (spc->find_cond(&$2, TRUE))
{ {
my_error(ER_SP_DUP_COND, MYF(0), $2.str); my_printf_error(ER_SP_DUP_COND, ER(ER_SP_DUP_COND), MYF(0),
$2.str);
YYABORT; YYABORT;
} }
YYTHD->lex->spcont->push_cond(&$2, $5); YYTHD->lex->spcont->push_cond(&$2, $5);
@ -1633,7 +1638,8 @@ sp_decl:
if (ctx->find_cursor(&$2, &offp, TRUE)) if (ctx->find_cursor(&$2, &offp, TRUE))
{ {
my_error(ER_SP_DUP_CURS, MYF(0), $2.str); my_printf_error(ER_SP_DUP_CURS, ER(ER_SP_DUP_CURS), MYF(0),
$2.str);
delete $5; delete $5;
YYABORT; YYABORT;
} }
@ -1660,12 +1666,14 @@ sp_cursor_stmt:
if (lex->sql_command != SQLCOM_SELECT) if (lex->sql_command != SQLCOM_SELECT)
{ {
my_error(ER_SP_BAD_CURSOR_QUERY, MYF(0)); my_message(ER_SP_BAD_CURSOR_QUERY, ER(ER_SP_BAD_CURSOR_QUERY),
MYF(0));
YYABORT; YYABORT;
} }
if (lex->result) if (lex->result)
{ {
my_error(ER_SP_BAD_CURSOR_SELECT, MYF(0)); my_message(ER_SP_BAD_CURSOR_SELECT, ER(ER_SP_BAD_CURSOR_SELECT),
MYF(0));
YYABORT; YYABORT;
} }
lex->sp_lex_in_use= TRUE; lex->sp_lex_in_use= TRUE;
@ -1735,7 +1743,8 @@ sp_hcond:
$$= Lex->spcont->find_cond(&$1); $$= Lex->spcont->find_cond(&$1);
if ($$ == NULL) if ($$ == NULL)
{ {
my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str); my_printf_error(ER_SP_COND_MISMATCH, ER(ER_SP_COND_MISMATCH),
MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -1764,7 +1773,8 @@ sp_decl_idents:
if (spc->find_pvar(&$1, TRUE)) if (spc->find_pvar(&$1, TRUE))
{ {
my_error(ER_SP_DUP_VAR, MYF(0), $1.str); my_printf_error(ER_SP_DUP_VAR, ER(ER_SP_DUP_VAR), MYF(0),
$1.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$1, (enum_field_types)0, sp_param_in); spc->push_pvar(&$1, (enum_field_types)0, sp_param_in);
@ -1777,7 +1787,8 @@ sp_decl_idents:
if (spc->find_pvar(&$3, TRUE)) if (spc->find_pvar(&$3, TRUE))
{ {
my_error(ER_SP_DUP_VAR, MYF(0), $3.str); my_printf_error(ER_SP_DUP_VAR, ER(ER_SP_DUP_VAR), MYF(0),
$3.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$3, (enum_field_types)0, sp_param_in); spc->push_pvar(&$3, (enum_field_types)0, sp_param_in);
@ -1810,7 +1821,7 @@ sp_proc_stmt:
} }
if (lex->sql_command == SQLCOM_CHANGE_DB) if (lex->sql_command == SQLCOM_CHANGE_DB)
{ /* "USE db" doesn't work in a procedure */ { /* "USE db" doesn't work in a procedure */
my_error(ER_SP_NO_USE, MYF(0)); my_message(ER_SP_NO_USE, ER(ER_SP_NO_USE), MYF(0));
YYABORT; YYABORT;
} }
/* Don't add an instruction for empty SET statements. /* Don't add an instruction for empty SET statements.
@ -1829,7 +1840,7 @@ sp_proc_stmt:
*/ */
if (sp->m_type != TYPE_ENUM_PROCEDURE) if (sp->m_type != TYPE_ENUM_PROCEDURE)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0)); my_message(ER_SP_BADSTATEMENT, ER(ER_SP_BADSTATEMENT), MYF(0));
YYABORT; YYABORT;
} }
else else
@ -1859,7 +1870,7 @@ sp_proc_stmt:
if (lex->sphead->m_type == TYPE_ENUM_PROCEDURE) if (lex->sphead->m_type == TYPE_ENUM_PROCEDURE)
{ {
my_error(ER_SP_BADRETURN, MYF(0)); my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0));
YYABORT; YYABORT;
} }
else else
@ -1868,7 +1879,7 @@ sp_proc_stmt:
if ($2->type() == Item::SUBSELECT_ITEM) if ($2->type() == Item::SUBSELECT_ITEM)
{ /* QQ For now, just disallow subselects as values */ { /* QQ For now, just disallow subselects as values */
my_error(ER_SP_BADSTATEMENT, MYF(0)); my_message(ER_SP_BADSTATEMENT, ER(ER_SP_BADSTATEMENT), MYF(0));
YYABORT; YYABORT;
} }
i= new sp_instr_freturn(lex->sphead->instructions(), i= new sp_instr_freturn(lex->sphead->instructions(),
@ -1931,7 +1942,9 @@ sp_proc_stmt:
if (! lab) if (! lab)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str); my_printf_error(ER_SP_LILABEL_MISMATCH,
ER(ER_SP_LILABEL_MISMATCH), MYF(0),
"LEAVE", $2.str);
YYABORT; YYABORT;
} }
else else
@ -1961,7 +1974,9 @@ sp_proc_stmt:
if (! lab || lab->type != SP_LAB_ITER) if (! lab || lab->type != SP_LAB_ITER)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str); my_printf_error(ER_SP_LILABEL_MISMATCH,
ER(ER_SP_LILABEL_MISMATCH), MYF(0),
"ITERATE", $2.str);
YYABORT; YYABORT;
} }
else else
@ -1989,7 +2004,8 @@ sp_proc_stmt:
if (lab) if (lab)
{ {
my_error(ER_SP_LABEL_REDEFINE, MYF(0), $2.str); my_printf_error(ER_SP_LABEL_REDEFINE,
ER(ER_SP_LABEL_REDEFINE), MYF(0), $2.str);
YYABORT; YYABORT;
} }
else else
@ -2013,7 +2029,7 @@ sp_proc_stmt:
if (sp->m_in_handler) if (sp->m_in_handler)
{ {
my_error(ER_SP_GOTO_IN_HNDLR, MYF(0)); my_message(ER_SP_GOTO_IN_HNDLR, ER(ER_SP_GOTO_IN_HNDLR), MYF(0));
YYABORT; YYABORT;
} }
lab= ctx->find_label($2.str); lab= ctx->find_label($2.str);
@ -2064,7 +2080,8 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); my_printf_error(ER_SP_CURSOR_MISMATCH,
ER(ER_SP_CURSOR_MISMATCH), MYF(0), $2.str);
YYABORT; YYABORT;
} }
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset); i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
@ -2079,7 +2096,8 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); my_printf_error(ER_SP_CURSOR_MISMATCH,
ER(ER_SP_CURSOR_MISMATCH), MYF(0), $2.str);
YYABORT; YYABORT;
} }
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
@ -2096,7 +2114,8 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); my_printf_error(ER_SP_CURSOR_MISMATCH,
ER(ER_SP_CURSOR_MISMATCH), MYF(0), $2.str);
YYABORT; YYABORT;
} }
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset); i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
@ -2114,7 +2133,8 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$1))) if (!spc || !(spv = spc->find_pvar(&$1)))
{ {
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str); my_printf_error(ER_SP_UNDECLARED_VAR,
ER(ER_SP_UNDECLARED_VAR), MYF(0), $1.str);
YYABORT; YYABORT;
} }
else else
@ -2136,7 +2156,8 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$3))) if (!spc || !(spv = spc->find_pvar(&$3)))
{ {
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str); my_printf_error(ER_SP_UNDECLARED_VAR,
ER(ER_SP_UNDECLARED_VAR), MYF(0), $3.str);
YYABORT; YYABORT;
} }
else else
@ -2260,7 +2281,8 @@ sp_labeled_control:
if (lab) if (lab)
{ {
my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str); my_printf_error(ER_SP_LABEL_REDEFINE,
ER(ER_SP_LABEL_REDEFINE), MYF(0), $1.str);
YYABORT; YYABORT;
} }
else else
@ -2281,7 +2303,8 @@ sp_labeled_control:
if (!lab || if (!lab ||
my_strcasecmp(system_charset_info, $5.str, lab->name) != 0) my_strcasecmp(system_charset_info, $5.str, lab->name) != 0)
{ {
my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str); my_printf_error(ER_SP_LABEL_MISMATCH,
ER(ER_SP_LABEL_MISMATCH), MYF(0), $5.str);
YYABORT; YYABORT;
} }
} }
@ -2539,9 +2562,11 @@ default_charset:
cinfo->default_table_charset && $4 && cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4)) !my_charset_same(cinfo->default_table_charset,$4))
{ {
my_error(ER_CONFLICTING_DECLARATIONS, MYF(0), my_printf_error(ER_CONFLICTING_DECLARATIONS,
"CHARACTER SET ", cinfo->default_table_charset->csname, ER(ER_CONFLICTING_DECLARATIONS), MYF(0),
"CHARACTER SET ", $4->csname); "CHARACTER SET ",
cinfo->default_table_charset->csname,
"CHARACTER SET ", $4->csname);
YYABORT; YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
@ -2556,8 +2581,9 @@ default_collation:
cinfo->default_table_charset && $4 && cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4)) !my_charset_same(cinfo->default_table_charset,$4))
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
$4->name, cinfo->default_table_charset->csname); ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
$4->name, cinfo->default_table_charset->csname);
YYABORT; YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
@ -2569,7 +2595,8 @@ storage_engines:
{ {
$$ = ha_resolve_by_name($1.str,$1.length); $$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) { if ($$ == DB_TYPE_UNKNOWN) {
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str); my_printf_error(ER_UNKNOWN_STORAGE_ENGINE,
ER(ER_UNKNOWN_STORAGE_ENGINE), MYF(0), $1.str);
YYABORT; YYABORT;
} }
}; };
@ -2755,9 +2782,10 @@ type:
Lex->uint_geom_type= (uint)$1; Lex->uint_geom_type= (uint)$1;
$$=FIELD_TYPE_GEOMETRY; $$=FIELD_TYPE_GEOMETRY;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0) my_printf_error(ER_FEATURE_DISABLED,
sym_group_geom.name, ER(ER_FEATURE_DISABLED), MYF(0)
sym_group_geom.needed_define); sym_group_geom.name,
sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
} }
@ -2924,8 +2952,9 @@ attribute:
{ {
if (Lex->charset && !my_charset_same(Lex->charset,$2)) if (Lex->charset && !my_charset_same(Lex->charset,$2))
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
$2->name,Lex->charset->csname); ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
$2->name,Lex->charset->csname);
YYABORT; YYABORT;
} }
else else
@ -2950,7 +2979,8 @@ charset_name:
{ {
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0)))) if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str); my_printf_error(ER_UNKNOWN_CHARACTER_SET,
ER(ER_UNKNOWN_CHARACTER_SET), MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -2968,7 +2998,8 @@ old_or_new_charset_name:
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) && if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str))) !($$=get_old_charset_by_name($1.str)))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str); my_printf_error(ER_UNKNOWN_CHARACTER_SET,
ER(ER_UNKNOWN_CHARACTER_SET), MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -2984,7 +3015,8 @@ collation_name:
{ {
if (!($$=get_charset_by_name($1.str,MYF(0)))) if (!($$=get_charset_by_name($1.str,MYF(0))))
{ {
my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str); my_printf_error(ER_UNKNOWN_COLLATION,
ER(ER_UNKNOWN_COLLATION), MYF(0), $1.str);
YYABORT; YYABORT;
} }
}; };
@ -3073,8 +3105,9 @@ key_type:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= Key::SPATIAL; $$= Key::SPATIAL;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_printf_error(ER_FEATURE_DISABLED,
sym_group_geom.name, sym_group_geom.needed_define); ER(ER_FEATURE_DISABLED), MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
}; };
@ -3106,7 +3139,7 @@ opt_unique_or_fulltext:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= Key::SPATIAL; $$= Key::SPATIAL;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_message(ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED), MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
@ -3332,7 +3365,8 @@ alter_list_item:
if (check_table_name($3->table.str,$3->table.length) || if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name($3->db.str)) $3->db.str && check_db_name($3->db.str))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str); my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME),
MYF(0), $3->table.str);
YYABORT; YYABORT;
} }
lex->alter_info.flags|= ALTER_RENAME; lex->alter_info.flags|= ALTER_RENAME;
@ -3347,8 +3381,9 @@ alter_list_item:
$5= $5 ? $5 : $4; $5= $5 ? $5 : $4;
if (!my_charset_same($4,$5)) if (!my_charset_same($4,$5))
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
$5->name, $4->csname); ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
$5->name, $4->csname);
YYABORT; YYABORT;
} }
LEX *lex= Lex; LEX *lex= Lex;
@ -3470,7 +3505,8 @@ slave_until:
!((lex->mi.log_file_name && lex->mi.pos) || !((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos))) (lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{ {
my_error(ER_BAD_SLAVE_UNTIL_COND, MYF(0)); my_message(ER_BAD_SLAVE_UNTIL_COND,
ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0));
YYABORT; YYABORT;
} }
@ -4183,9 +4219,10 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_error(ER_FEATURE_DISABLED, MYF(0), my_printf_error(ER_FEATURE_DISABLED,
$1.symbol->group->name, ER(ER_FEATURE_DISABLED), MYF(0),
$1.symbol->group->needed_define); $1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(void))($1.symbol->create_func))(); $$= ((Item*(*)(void))($1.symbol->create_func))();
@ -4194,9 +4231,10 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_error(ER_FEATURE_DISABLED, MYF(0), my_printf_error(ER_FEATURE_DISABLED,
$1.symbol->group->name, ER(ER_FEATURE_DISABLED), MYF(0),
$1.symbol->group->needed_define); $1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*))($1.symbol->create_func))($3); $$= ((Item*(*)(Item*))($1.symbol->create_func))($3);
@ -4205,9 +4243,10 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_error(ER_FEATURE_DISABLED, MYF(0), my_printf_error(ER_FEATURE_DISABLED,
$1.symbol->group->name, ER(ER_FEATURE_DISABLED), MYF(0),
$1.symbol->group->needed_define); $1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5); $$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5);
@ -4216,9 +4255,10 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_error(ER_FEATURE_DISABLED, MYF(0), my_printf_error(ER_FEATURE_DISABLED,
$1.symbol->group->name, ER(ER_FEATURE_DISABLED), MYF(0),
$1.symbol->group->needed_define); $1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7); $$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7);
@ -4321,8 +4361,9 @@ simple_expr:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= $1; $$= $1;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_printf_error(ER_FEATURE_DISABLED,
sym_group_geom.name, sym_group_geom.needed_define); ER(ER_FEATURE_DISABLED), MYF(0),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
} }
@ -5378,7 +5419,8 @@ select_var_ident:
if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1))) if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1)))
{ {
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str); my_printf_error(ER_SP_UNDECLARED_VAR,
ER(ER_SP_UNDECLARED_VAR), MYF(0), $1.str);
YYABORT; YYABORT;
} }
if (! lex->result) if (! lex->result)
@ -5733,8 +5775,9 @@ update:
else if (lex->select_lex.get_table_list()->derived) else if (lex->select_lex.get_table_list()->derived)
{ {
/* it is single table update and it is update of derived table */ /* it is single table update and it is update of derived table */
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), my_printf_error(ER_NON_UPDATABLE_TABLE,
lex->select_lex.get_table_list()->alias, "UPDATE"); ER(ER_NON_UPDATABLE_TABLE), MYF(0),
lex->select_lex.get_table_list()->alias, "UPDATE");
YYABORT; YYABORT;
} }
} }
@ -6241,7 +6284,8 @@ kill:
LEX *lex=Lex; LEX *lex=Lex;
if ($3->fix_fields(lex->thd, 0, &$3) || $3->check_cols(1)) if ($3->fix_fields(lex->thd, 0, &$3) || $3->check_cols(1))
{ {
my_error(ER_SET_CONSTANTS_ONLY, MYF(0)); my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
MYF(0));
YYABORT; YYABORT;
} }
lex->sql_command=SQLCOM_KILL; lex->sql_command=SQLCOM_KILL;
@ -6388,7 +6432,7 @@ param_marker:
(uchar *) thd->query)); (uchar *) thd->query));
if (!($$= item) || lex->param_list.push_back(item)) if (!($$= item) || lex->param_list.push_back(item))
{ {
my_error(ER_OUT_OF_RESOURCES, MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
YYABORT; YYABORT;
} }
} }
@ -6564,8 +6608,9 @@ simple_ident_q:
FIXME. Far from perfect solution. See comment for FIXME. Far from perfect solution. See comment for
"SET NEW.field_name:=..." for more info. "SET NEW.field_name:=..." for more info.
*/ */
my_error(ER_BAD_FIELD_ERROR, MYF(0), $3.str, my_printf_error(ER_BAD_FIELD_ERROR,
new_row ? "NEW": "OLD"); ER(ER_BAD_FIELD_ERROR), MYF(0),
$3.str, new_row ? "NEW": "OLD");
YYABORT; YYABORT;
} }
@ -6652,8 +6697,9 @@ IDENT_sys:
$1.length); $1.length);
if (wlen < $1.length) if (wlen < $1.length)
{ {
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), cs->csname, my_printf_error(ER_INVALID_CHARACTER_STRING,
$1.str + wlen); ER(ER_INVALID_CHARACTER_STRING), MYF(0),
cs->csname, $1.str + wlen);
YYABORT; YYABORT;
} }
$$= $1; $$= $1;
@ -7032,7 +7078,8 @@ option_value:
*/ */
if (lex->query_tables) if (lex->query_tables)
{ {
my_error(ER_SP_SUBSELECT_NYI, MYF(0)); my_message(ER_SP_SUBSELECT_NYI, ER(ER_SP_SUBSELECT_NYI),
MYF(0));
YYABORT; YYABORT;
} }
sp_instr_set_user_var *i= sp_instr_set_user_var *i=
@ -7055,7 +7102,8 @@ option_value:
sp_instr_set_trigger_field *i; sp_instr_set_trigger_field *i;
if (lex->query_tables) if (lex->query_tables)
{ {
my_error(ER_SP_SUBSELECT_NYI, MYF(0)); my_message(ER_SP_SUBSELECT_NYI, ER(ER_SP_SUBSELECT_NYI),
MYF(0));
YYABORT; YYABORT;
} }
if ($3) if ($3)
@ -7084,7 +7132,8 @@ option_value:
Error message also should be improved. Error message also should be improved.
*/ */
my_error(ER_BAD_FIELD_ERROR, MYF(0), $1.base_name, "NEW"); my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
MYF(0), $1.base_name, "NEW");
YYABORT; YYABORT;
} }
lex->sphead->add_instr(i); lex->sphead->add_instr(i);
@ -7150,8 +7199,9 @@ option_value:
$3= $3 ? $3 : $2; $3= $3 ? $3 : $2;
if (!my_charset_same($2,$3)) if (!my_charset_same($2,$3))
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
$3->name, $2->csname); ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
$3->name, $2->csname);
YYABORT; YYABORT;
} }
lex->var_list.push_back(new set_var_collation_client($3,$3,$3)); lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
@ -7241,7 +7291,8 @@ internal_variable_name:
if (!tmp) if (!tmp)
YYABORT; YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str); my_printf_error(ER_VARIABLE_IS_NOT_STRUCT,
ER(ER_VARIABLE_IS_NOT_STRUCT), MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
$$.base_name= $1; $$.base_name= $1;
} }
@ -7252,7 +7303,8 @@ internal_variable_name:
if (!tmp) if (!tmp)
YYABORT; YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str); my_printf_error(ER_VARIABLE_IS_NOT_STRUCT,
ER(ER_VARIABLE_IS_NOT_STRUCT), MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
$$.base_name.str= (char*) "default"; $$.base_name.str= (char*) "default";
$$.base_name.length= 7; $$.base_name.length= 7;
@ -7533,7 +7585,8 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)); my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
YYABORT; YYABORT;
} }
} }
@ -7545,7 +7598,8 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)); my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
YYABORT; YYABORT;
} }
} }
@ -7557,7 +7611,8 @@ opt_table:
lex->grant= GLOBAL_ACLS & ~GRANT_ACL; lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)); my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
YYABORT; YYABORT;
} }
} }

View File

@ -957,11 +957,12 @@ static void frm_error(int error, TABLE *form, const char *name, myf errortype)
uint length=dirname_part(buff,name); uint length=dirname_part(buff,name);
buff[length-1]=0; buff[length-1]=0;
db=buff+dirname_length(buff); db=buff+dirname_length(buff);
my_error(ER_NO_SUCH_TABLE,MYF(0),db,form->real_name); my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
db, form->real_name);
} }
else else
my_error(ER_FILE_NOT_FOUND,errortype, my_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), errortype,
fn_format(buff,name,form_dev,reg_ext,0),my_errno); fn_format(buff, name, form_dev, reg_ext, 0), my_errno);
break; break;
case 2: case 2:
{ {
@ -969,14 +970,15 @@ static void frm_error(int error, TABLE *form, const char *name, myf errortype)
datext= datext==NullS ? "" : datext; datext= datext==NullS ? "" : datext;
err_no= (my_errno == ENOENT) ? ER_FILE_NOT_FOUND : (my_errno == EAGAIN) ? err_no= (my_errno == ENOENT) ? ER_FILE_NOT_FOUND : (my_errno == EAGAIN) ?
ER_FILE_USED : ER_CANT_OPEN_FILE; ER_FILE_USED : ER_CANT_OPEN_FILE;
my_error(err_no,errortype, my_printf_error(err_no, ER(err_no), errortype,
fn_format(buff,form->real_name,form_dev,datext,2),my_errno); fn_format(buff, form->real_name, form_dev, datext, 2),
my_errno);
break; break;
} }
default: /* Better wrong error than none */ default: /* Better wrong error than none */
case 4: case 4:
my_error(ER_NOT_FORM_FILE,errortype, my_printf_error(ER_NOT_FORM_FILE, ER(ER_NOT_FORM_FILE), errortype,
fn_format(buff,name,form_dev,reg_ext,0)); fn_format(buff, name, form_dev, reg_ext, 0));
break; break;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -1694,7 +1696,8 @@ err:
if (thd->net.last_errno == ER_BAD_FIELD_ERROR) if (thd->net.last_errno == ER_BAD_FIELD_ERROR)
{ {
thd->clear_error(); thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0), view_db.str, view_name.str); my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0),
view_db.str, view_name.str);
} }
thd->lex->select_lex.no_wrap_view_item= save_wrapper; thd->lex->select_lex.no_wrap_view_item= save_wrapper;
thd->lex->current_select= current_select_save; thd->lex->current_select= current_select_save;
@ -1730,7 +1733,8 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
} }
else else
{ {
my_error(ER_VIEW_CHECK_FAILED, MYF(0), view_db.str, view_name.str); my_printf_error(ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), MYF(0),
view_db.str, view_name.str);
return(VIEW_CHECK_ERROR); return(VIEW_CHECK_ERROR);
} }
} }

View File

@ -383,7 +383,7 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
if (create_fields.elements > MAX_FIELDS) if (create_fields.elements > MAX_FIELDS)
{ {
my_error(ER_TOO_MANY_FIELDS,MYF(0)); my_message(ER_TOO_MANY_FIELDS, ER(ER_TOO_MANY_FIELDS), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -448,7 +448,7 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
if (info_length+(ulong) create_fields.elements*FCOMP+288+ if (info_length+(ulong) create_fields.elements*FCOMP+288+
n_length+int_length+com_length > 65535L || int_count > 255) n_length+int_length+com_length > 65535L || int_count > 255)
{ {
my_error(ER_TOO_MANY_FIELDS,MYF(0)); my_message(ER_TOO_MANY_FIELDS, ER(ER_TOO_MANY_FIELDS), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }