now my_printf_error is not better then my_error, but my_error call is shorter

used only one implementation of format parser of (printf)
fixed multistatement
This commit is contained in:
bell@sanja.is.com.ua 2004-11-13 19:35:51 +02:00
commit 7210195f1e
67 changed files with 617 additions and 973 deletions

View file

@ -406,4 +406,6 @@
#define ER_LOGING_PROHIBIT_CHANGING_OF 1387 #define ER_LOGING_PROHIBIT_CHANGING_OF 1387
#define ER_NO_FILE_MAPPING 1388 #define ER_NO_FILE_MAPPING 1388
#define ER_WRONG_MAGIC 1389 #define ER_WRONG_MAGIC 1389
#define ER_ERROR_MESSAGES 390 #define ER_PS_MANY_PARAM 1390
#define ER_KEY_PART_0 1391
#define ER_ERROR_MESSAGES 392

View file

@ -299,5 +299,5 @@ drop table t1;
# create dedicated error code for this and # create dedicated error code for this and
# and change my_printf_error() to my_error # and change my_printf_error() to my_error
--error 1105 --error 1391
create table t1 (c char(10), index (c(0))); create table t1 (c char(10), index (c(0)));

View file

@ -26,12 +26,9 @@
WARNING! WARNING!
my_error family functions have to be used according following rules: 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 not parameters use my_message(ER_CODE, ER(ER_CODE), MYF(N))
- if message have only integer parameters, string constants (created - if message registered use my_error(ER_CODE, MYF(N), ...).
inside program) or string put (and cut if it is need) in some limited - With some special text of errror message use:
length buffer before passing it as parameter then you can use my_printf_error(ER_CODE, format, MYF(N), ...)
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};
@ -53,107 +50,22 @@ char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
the length value is ignored. the length value is ignored.
*/ */
int my_error(int nr,myf MyFlags, ...) int my_error(int nr, myf MyFlags, ...)
{ {
va_list ap; const char *format;
uint olen, plen; va_list args;
reg1 const char *tpos; char ebuff[ERRMSGSIZE + 20];
reg2 char *endpos;
char * par;
char ebuff[ERRMSGSIZE+20];
int prec_chars; /* output precision */
my_bool prec_supplied;
DBUG_ENTER("my_error"); DBUG_ENTER("my_error");
LINT_INIT(prec_chars); /* protected by prec_supplied */
va_start(ap,MyFlags);
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno)); DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0) if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
init_glob_errs(); init_glob_errs();
format= my_errmsg[nr / ERRMOD][nr % ERRMOD];
olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD]); va_start(args,MyFlags);
endpos=ebuff; (void) my_vsnprintf (ebuff, sizeof(ebuff), format, args);
va_end(args);
while (*tpos)
{
if (tpos[0] != '%')
{
*endpos++= *tpos++; /* Copy ordinary char */
continue;
}
if (*++tpos == '%') /* test if %% */
{
olen--;
}
else
{
/*
Skip size/precision flags to be compatible with printf.
The only size/precision flag supported is "%.*s".
If "%.*u" or "%.*d" are encountered, the precision number is read
from the variable argument list but its value is ignored.
*/
prec_supplied= 0;
if (*tpos== '.')
{
tpos++;
olen--;
if (*tpos == '*')
{
tpos++;
olen--;
prec_chars= va_arg(ap, int); /* get length parameter */
prec_supplied= 1;
}
}
if (!prec_supplied)
{
while (my_isdigit(&my_charset_latin1, *tpos) || *tpos == '.' ||
*tpos == '-')
tpos++;
if (*tpos == 'l') /* Skip 'l' argument */
tpos++;
}
if (*tpos == 's') /* String parameter */
{
par= va_arg(ap, char *);
plen= (uint) strlen(par);
if (prec_supplied && prec_chars > 0)
plen= min((uint)prec_chars, plen);
if (olen + plen < ERRMSGSIZE+2) /* Replace if possible */
{
strmake(endpos, par, plen);
endpos+= plen;
tpos++;
olen+= plen-2;
continue;
}
}
else if (*tpos == 'd' || *tpos == 'u') /* Integer parameter */
{
register int iarg;
iarg= va_arg(ap, int);
if (*tpos == 'd')
plen= (uint) (int10_to_str((long) iarg, endpos, -10) - endpos);
else
plen= (uint) (int10_to_str((long) (uint) iarg, endpos, 10) - endpos);
if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */
{
endpos+= plen;
tpos++;
olen+= plen-2;
continue;
}
}
}
*endpos++= '%'; /* % used as % or unknown code */
}
*endpos= '\0'; /* End of errmessage */
va_end(ap);
DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags)); DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags));
} }
@ -172,11 +84,14 @@ int my_printf_error(uint error, const char *format, myf MyFlags, ...)
{ {
va_list args; va_list args;
char ebuff[ERRMSGSIZE+20]; char ebuff[ERRMSGSIZE+20];
DBUG_ENTER("my_printf_error");
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d Format: %s",
error, MyFlags, errno, format));
va_start(args,MyFlags); va_start(args,MyFlags);
(void) vsprintf (ebuff,format,args); (void) my_vsnprintf (ebuff, sizeof(ebuff), format, args);
va_end(args); va_end(args);
return (*error_handler_hook)(error, ebuff, MyFlags); DBUG_RETURN((*error_handler_hook)(error, ebuff, MyFlags));
} }
/* /*

View file

@ -126,8 +126,7 @@ set_field_to_null(Field *field)
return 0; return 0;
} }
if (!current_thd->no_errors) if (!current_thd->no_errors)
my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0), my_error(ER_BAD_NULL_ERROR, MYF(0), field->field_name);
field->field_name);
return -1; return -1;
} }
@ -185,8 +184,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
return 0; return 0;
} }
if (!current_thd->no_errors) if (!current_thd->no_errors)
my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0), my_error(ER_BAD_NULL_ERROR, MYF(0), field->field_name);
field->field_name);
return -1; return -1;
} }

View file

@ -495,11 +495,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_printf_error(EE_OUT_OF_FILERESOURCES, my_error(EE_OUT_OF_FILERESOURCES,
ER(EE_OUT_OF_FILERESOURCES), MYF(ME_BELL+ME_WAITTANG),
MYF(ME_BELL+ME_WAITTANG), filename, my_errno);
filename, my_errno); }
}
my_close(fd, MYF(MY_WME)); my_close(fd, MYF(MY_WME));
} }
return(fd2); return(fd2);

View file

@ -1200,8 +1200,7 @@ void handler::print_error(int error, myf errflag)
str.length(max_length-4); str.length(max_length-4);
str.append("..."); str.append("...");
} }
my_printf_error(ER_DUP_ENTRY, ER(ER_DUP_ENTRY), MYF(0), my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), key_nr+1);
str.c_ptr(), key_nr+1);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
textno=ER_DUP_KEY; textno=ER_DUP_KEY;
@ -1270,7 +1269,7 @@ void handler::print_error(int error, myf errflag)
uint length=dirname_part(buff,table->path); uint length=dirname_part(buff,table->path);
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,table->table_name); my_error(ER_NO_SUCH_TABLE, MYF(0), db, table->table_name);
break; break;
} }
default: default:
@ -1284,20 +1283,16 @@ void handler::print_error(int error, myf errflag)
{ {
const char* engine= table_type(); const char* engine= table_type();
if (temporary) if (temporary)
my_printf_error(ER_GET_TEMPORARY_ERRMSG, my_error(ER_GET_TEMPORARY_ERRMSG, MYF(0), error, str.ptr(), engine);
ER(ER_GET_TEMPORARY_ERRMSG), MYF(0),
error, str.ptr(), engine);
else else
my_printf_error(ER_GET_ERRMSG, my_error(ER_GET_ERRMSG, MYF(0), error, str.ptr(), engine);
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);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
} }
my_error(textno,errflag,table->table_name,error); my_error(textno, errflag, table->table_name, error);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -1419,9 +1414,7 @@ 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_printf_error(ER_CANT_CREATE_TABLE, ER(ER_CANT_CREATE_TABLE), my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name,error);
MYF(ME_BELL+ME_WAITTANG),
name,error);
DBUG_RETURN(error != 0); DBUG_RETURN(error != 0);
} }

View file

@ -1621,8 +1621,8 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
best match, they must reference the same column, otherwise the field best match, they must reference the same column, otherwise the field
is ambiguous. is ambiguous.
*/ */
my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR), my_error(ER_NON_UNIQ_ERROR, MYF(0),
MYF(0), find_item->full_name(), current_thd->where); find_item->full_name(), current_thd->where);
return NULL; return NULL;
} }
} }
@ -1713,8 +1713,8 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
DBUG_ASSERT(*select_ref); DBUG_ASSERT(*select_ref);
if (! (*select_ref)->fixed) if (! (*select_ref)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), ref->name, my_error(ER_ILLEGAL_REFERENCE, MYF(0),
"forward reference in item list"); ref->name, "forward reference in item list");
return NULL; return NULL;
} }
return (select->ref_pointer_array + counter); return (select->ref_pointer_array + counter);
@ -1895,8 +1895,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
if (upward_lookup) if (upward_lookup)
{ {
// We can't say exactly what absent table or field // We can't say exactly what absent table or field
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0), full_name(), thd->where);
full_name(), thd->where);
} }
else else
{ {
@ -1988,14 +1987,9 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
db, tab, field_name) & db, tab, field_name) &
VIEW_ANY_ACL))) VIEW_ANY_ACL)))
{ {
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR, my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
ER(ER_COLUMNACCESS_DENIED_ERROR), "ANY", thd->priv_user, thd->host_or_ip,
MYF(0), field_name, tab);
"ANY",
thd->priv_user,
thd->host_or_ip,
field_name,
tab);
return TRUE; return TRUE;
} }
} }
@ -2455,8 +2449,7 @@ Item_real::Item_real(const char *str_arg, uint length)
when we are in the parser when we are in the parser
*/ */
DBUG_ASSERT(str_arg[length] == 0); DBUG_ASSERT(str_arg[length] == 0);
my_printf_error(ER_ILLEGAL_VALUE_FOR_TYPE, ER(ER_ILLEGAL_VALUE_FOR_TYPE), my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", (char*) str_arg);
MYF(0), "double", (char*) str_arg);
} }
presentation= name=(char*) str_arg; presentation= name=(char*) str_arg;
decimals=(uint8) nr_of_decimals(str_arg); decimals=(uint8) nr_of_decimals(str_arg);
@ -2846,8 +2839,8 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
return TRUE; return TRUE;
if (ref == not_found_item && from_field == not_found_field) if (ref == not_found_item && from_field == not_found_field)
{ {
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0),
this->full_name(), current_thd->where); this->full_name(), current_thd->where);
ref= 0; // Safety ref= 0; // Safety
return TRUE; return TRUE;
} }
@ -2889,8 +2882,8 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
else else
{ {
/* The current reference cannot be resolved in this query. */ /* The current reference cannot be resolved in this query. */
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(ER_BAD_FIELD_ERROR,MYF(0),
this->full_name(), current_thd->where); this->full_name(), current_thd->where);
return TRUE; return TRUE;
} }
} }
@ -2907,11 +2900,10 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
current_sel->having_fix_field))) || current_sel->having_fix_field))) ||
!(*ref)->fixed) !(*ref)->fixed)
{ {
my_printf_error(ER_ILLEGAL_REFERENCE, ER(ER_ILLEGAL_REFERENCE), MYF(0), my_error(ER_ILLEGAL_REFERENCE, MYF(0),
name, name, ((*ref)->with_sum_func?
((*ref)->with_sum_func? "reference to group function":
"reference to group function": "forward reference in item list"));
"forward reference in item list"));
return TRUE; return TRUE;
} }
max_length= (*ref)->max_length; max_length= (*ref)->max_length;
@ -2932,8 +2924,6 @@ void Item_ref::cleanup()
DBUG_ENTER("Item_ref::cleanup"); DBUG_ENTER("Item_ref::cleanup");
Item_ident::cleanup(); Item_ident::cleanup();
result_field= 0; result_field= 0;
if (hook_ptr)
*hook_ptr= orig_item;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -3046,8 +3036,7 @@ bool Item_default_value::fix_fields(THD *thd,
field_arg= (Item_field *)arg; field_arg= (Item_field *)arg;
if (field_arg->field->flags & NO_DEFAULT_VALUE_FLAG) if (field_arg->field->flags & NO_DEFAULT_VALUE_FLAG)
{ {
my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD), my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), field_arg->field->field_name);
MYF(0), field_arg->field->field_name);
return TRUE; return TRUE;
} }
if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of()))) if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
@ -3603,12 +3592,11 @@ 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_printf_error(ER_CANT_AGGREGATE_2COLLATIONS, my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0), old_cs, old_derivation,
old_cs, old_derivation, item->collation.collation->name,
item->collation.collation->name, item->collation.derivation_name(),
item->collation.derivation_name(), "UNION");
"UNION");
return 1; return 1;
} }

View file

@ -53,11 +53,10 @@ 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_printf_error(ER_CANT_AGGREGATE_2COLLATIONS, my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0), c1.collation->name,c1.derivation_name(),
c1.collation->name,c1.derivation_name(), c2.collation->name,c2.derivation_name(),
c2.collation->name,c2.derivation_name(), fname);
fname);
} }
@ -2437,7 +2436,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
cmp_collation.collation))) cmp_collation.collation)))
{ {
(void) regerror(error,&preg,buff,sizeof(buff)); (void) regerror(error,&preg,buff,sizeof(buff));
my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff); my_error(ER_REGEXP_ERROR, MYF(0), buff);
return TRUE; return TRUE;
} }
regex_compiled=regex_is_const=1; regex_compiled=regex_is_const=1;

View file

@ -45,11 +45,10 @@ 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_printf_error(ER_CANT_AGGREGATE_2COLLATIONS, my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0), c1.collation->name, c1.derivation_name(),
c1.collation->name, c1.derivation_name(), c2.collation->name, c2.derivation_name(),
c2.collation->name, c2.derivation_name(), fname);
fname);
} }
static void my_coll_agg_error(DTCollation &c1, static void my_coll_agg_error(DTCollation &c1,
@ -57,12 +56,11 @@ static void my_coll_agg_error(DTCollation &c1,
DTCollation &c3, DTCollation &c3,
const char *fname) const char *fname)
{ {
my_printf_error(ER_CANT_AGGREGATE_3COLLATIONS, my_error(ER_CANT_AGGREGATE_3COLLATIONS, MYF(0),
ER(ER_CANT_AGGREGATE_3COLLATIONS), MYF(0), c1.collation->name, c1.derivation_name(),
c1.collation->name, c1.derivation_name(), c2.collation->name, c2.derivation_name(),
c2.collation->name, c2.derivation_name(), c3.collation->name, c3.derivation_name(),
c3.collation->name, c3.derivation_name(), fname);
fname);
} }
@ -76,8 +74,7 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname)
args[2]->collation, args[2]->collation,
fname); fname);
else else
my_printf_error(ER_CANT_AGGREGATE_NCOLLATIONS, my_error(ER_CANT_AGGREGATE_NCOLLATIONS, MYF(0), fname);
ER(ER_CANT_AGGREGATE_NCOLLATIONS), MYF(0),fname);
} }
@ -1717,8 +1714,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
if (!tmp_udf) if (!tmp_udf)
{ {
my_printf_error(ER_CANT_FIND_UDF,ER(ER_CANT_FIND_UDF),MYF(0),u_d->name.str, my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str, errno);
errno);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
u_d=tmp_udf; u_d=tmp_udf;
@ -1838,8 +1834,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
u_d->func_init; u_d->func_init;
if ((error=(uchar) init(&initid, &f_args, thd->net.last_error))) if ((error=(uchar) init(&initid, &f_args, thd->net.last_error)))
{ {
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0), my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
u_d->name.str, thd->net.last_error); u_d->name.str, thd->net.last_error);
free_udf(u_d); free_udf(u_d);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1851,8 +1847,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
initialized=1; initialized=1;
if (error) if (error)
{ {
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0), my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
u_d->name.str, ER(ER_UNKNOWN_ERROR)); u_d->name.str, ER(ER_UNKNOWN_ERROR));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
@ -3378,8 +3374,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
{ {
if (!var->is_struct()) if (!var->is_struct())
{ {
my_printf_error(ER_VARIABLE_IS_NOT_STRUCT, ER(ER_VARIABLE_IS_NOT_STRUCT), my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), base_name->str);
MYF(0), base_name->str);
return 0; return 0;
} }
} }
@ -3544,8 +3539,7 @@ Item_func_sp::execute(Item **itp)
m_sp= sp_find_function(thd, m_name); m_sp= sp_find_function(thd, m_name);
if (! m_sp) if (! m_sp)
{ {
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
"FUNCTION", m_name->m_qname);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -3579,8 +3573,7 @@ Item_func_sp::field_type() const
DBUG_PRINT("info", ("m_returns = %d", m_sp->m_returns)); DBUG_PRINT("info", ("m_returns = %d", m_sp->m_returns));
DBUG_RETURN(m_sp->m_returns); DBUG_RETURN(m_sp->m_returns);
} }
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
"FUNCTION", m_name->m_qname);
DBUG_RETURN(MYSQL_TYPE_STRING); DBUG_RETURN(MYSQL_TYPE_STRING);
} }
@ -3596,8 +3589,7 @@ Item_func_sp::result_type() const
{ {
DBUG_RETURN(m_sp->result()); DBUG_RETURN(m_sp->result());
} }
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
"FUNCTION", m_name->m_qname);
DBUG_RETURN(STRING_RESULT); DBUG_RETURN(STRING_RESULT);
} }
@ -3610,8 +3602,7 @@ Item_func_sp::fix_length_and_dec()
m_sp= sp_find_function(current_thd, m_name); m_sp= sp_find_function(current_thd, m_name);
if (! m_sp) if (! m_sp)
{ {
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
"FUNCTION", m_name->m_qname);
} }
else else
{ {

View file

@ -42,11 +42,10 @@ 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_printf_error(ER_CANT_AGGREGATE_2COLLATIONS, my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0), c1.collation->name, c1.derivation_name(),
c1.collation->name, c1.derivation_name(), c2.collation->name, c2.derivation_name(),
c2.collation->name, c2.derivation_name(), fname);
fname);
} }
uint nr_of_decimals(const char *str) uint nr_of_decimals(const char *str)
@ -2219,8 +2218,7 @@ 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_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0), my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
colname);
return; return;
} }
} }
@ -2228,9 +2226,8 @@ 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_printf_error(ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0), colname, args[0]->collation.collation->csname);
colname, args[0]->collation.collation->csname);
return; return;
} }
collation.set(set_collation, DERIVATION_EXPLICIT); collation.set(set_collation, DERIVATION_EXPLICIT);

View file

@ -430,8 +430,7 @@ 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_printf_error(ER_OPEN_AS_READONLY, ER(ER_OPEN_AS_READONLY), MYF(0), my_error(ER_OPEN_AS_READONLY, MYF(0), table->table_name);
table->table_name);
my_free((gptr) sql_lock,MYF(0)); my_free((gptr) sql_lock,MYF(0));
return 0; return 0;
} }

View file

@ -1517,8 +1517,7 @@ err:
if (my_errno == EFBIG) if (my_errno == EFBIG)
my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(0)); my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(0));
else else
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0), my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno);
name, errno);
write_error=1; write_error=1;
} }
if (file == &log_file) if (file == &log_file)

View file

@ -350,8 +350,7 @@ 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_printf_error(ER_FPARSER_TOO_BIG_FILE, my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str);
ER(ER_FPARSER_TOO_BIG_FILE), MYF(0), file_name->str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -413,8 +412,7 @@ 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_printf_error(ER_FPARSER_BAD_HEADER, ER(ER_FPARSER_BAD_HEADER), MYF(0), my_error(ER_FPARSER_BAD_HEADER, MYF(0), file_name->str);
file_name->str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else else
@ -627,8 +625,7 @@ 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_printf_error(ER_FPARSER_EOF_IN_COMMENT, my_error(ER_FPARSER_EOF_IN_COMMENT, MYF(0), line);
ER(ER_FPARSER_EOF_IN_COMMENT), MYF(0), line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
ptr++; ptr++;
@ -670,9 +667,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
(LEX_STRING *)(base + (LEX_STRING *)(base +
parameter->offset)))) parameter->offset))))
{ {
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER, my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0), parameter->name.str, line);
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
break; break;
@ -683,9 +679,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
(LEX_STRING *) (LEX_STRING *)
(base + parameter->offset)))) (base + parameter->offset))))
{ {
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER, my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0), parameter->name.str, line);
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
break; break;
@ -694,9 +689,8 @@ 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_printf_error(ER_FPARSER_ERROR_IN_PARAMETER, my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0), parameter->name.str, line);
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
{ {
@ -713,9 +707,8 @@ 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_printf_error(ER_FPARSER_ERROR_IN_PARAMETER, my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0), parameter->name.str, line);
parameter->name.str, line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH); memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH);
@ -754,9 +747,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
break; break;
list_err_w_message: list_err_w_message:
my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER, my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0), parameter->name.str, line);
parameter->name.str, line);
list_err: list_err:
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -769,9 +761,7 @@ 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_printf_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, my_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, MYF(0), line);
ER(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER), MYF(0),
line);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
ptr++; ptr++;

View file

@ -65,8 +65,7 @@ setup_procedure(THD *thd,ORDER *param,select_result *result,
DBUG_RETURN(proc); DBUG_RETURN(proc);
} }
} }
my_printf_error(ER_UNKNOWN_PROCEDURE,ER(ER_UNKNOWN_PROCEDURE),MYF(0), my_error(ER_UNKNOWN_PROCEDURE, MYF(0), (*param->item)->name);
(*param->item)->name);
*error=1; *error=1;
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View file

@ -127,7 +127,6 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
thd->net.report_error= 0; thd->net.report_error= 0;
/* Abort multi-result sets */ /* Abort multi-result sets */
thd->lex->found_colon= 0;
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS; thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View file

@ -449,9 +449,8 @@ 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_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND, my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0), "SHOW NEW MASTER", errmsg);
"SHOW NEW MASTER", errmsg);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
else else
@ -790,8 +789,7 @@ bool load_master_data(THD* thd)
if (connect_to_master(thd, &mysql, active_mi)) if (connect_to_master(thd, &mysql, active_mi))
{ {
my_printf_error(error= ER_CONNECT_TO_MASTER, my_error(error= ER_CONNECT_TO_MASTER, MYF(0), mysql_error(&mysql));
ER(ER_CONNECT_TO_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
@ -803,8 +801,7 @@ 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_printf_error(error = ER_QUERY_ON_MASTER, my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
@ -831,8 +828,7 @@ 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_printf_error(error = ER_QUERY_ON_MASTER, my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
@ -885,8 +881,7 @@ 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_printf_error(error = ER_QUERY_ON_MASTER, my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
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;
} }
@ -943,8 +938,7 @@ bool load_master_data(THD* thd)
if (mysql_real_query(&mysql, "UNLOCK TABLES", 13)) if (mysql_real_query(&mysql, "UNLOCK TABLES", 13))
{ {
my_printf_error(error = ER_QUERY_ON_MASTER, my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
goto err; goto err;
} }
} }
@ -953,7 +947,7 @@ bool load_master_data(THD* thd)
0 /* not only reset, but also reinit */, 0 /* not only reset, but also reinit */,
&errmsg)) &errmsg))
{ {
my_printf_error(ER_RELAY_LOG_FAIL, ER(ER_RELAY_LOG_FAIL), MYF(0), errmsg); my_error(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

@ -899,8 +899,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_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0),
name, var->value->str_value.ptr()); name, var->value->str_value.ptr());
return res; return res;
} }
@ -1174,8 +1174,7 @@ 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_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf));
MYF(0), var->var->name, llstr(val, buf));
return 1; return 1;
} }
return 0; return 0;
@ -1473,8 +1472,7 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names)
return 0; return 0;
err: err:
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, value);
name, value);
return 1; return 1;
} }
@ -1515,8 +1513,7 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
return 0; return 0;
err: err:
my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff);
MYF(0), name, buff);
return 1; return 1;
} }
@ -1540,9 +1537,8 @@ 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_printf_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
ER(ER_INCORRECT_GLOBAL_LOCAL_VAR), MYF(0), name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
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 */
@ -1585,8 +1581,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
return tmp; return tmp;
} }
default: default:
my_printf_error(ER_VAR_CANT_BE_READ, ER(ER_VAR_CANT_BE_READ), MYF(0), my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
name);
} }
return 0; return 0;
} }
@ -1698,8 +1693,7 @@ 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_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
name, res->c_ptr());
return 1; return 1;
} }
@ -1797,14 +1791,12 @@ 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_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
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_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0), my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr());
res->c_ptr());
return 1; return 1;
} }
} }
@ -1814,8 +1806,7 @@ 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_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0), my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
buf);
return 1; return 1;
} }
} }
@ -1836,8 +1827,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
{ {
if (!nullable) if (!nullable)
{ {
my_printf_error(ER_WRONG_VALUE_FOR_VAR, my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), name, "NULL");
return 1; return 1;
} }
tmp= NULL; tmp= NULL;
@ -1845,8 +1835,7 @@ 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_printf_error(ER_UNKNOWN_CHARACTER_SET, ER(ER_UNKNOWN_CHARACTER_SET), my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
MYF(0), res->c_ptr());
return 1; return 1;
} }
} }
@ -2443,8 +2432,7 @@ 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_printf_error(ER_UNKNOWN_TIME_ZONE, ER(ER_UNKNOWN_TIME_ZONE), MYF(0), my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL");
res ? res->c_ptr() : "NULL");
return 1; return 1;
} }
return 0; return 0;
@ -2726,8 +2714,7 @@ sys_var *find_sys_var(const char *str, uint length)
length ? length : length ? length :
strlen(str)); strlen(str));
if (!var) if (!var)
my_printf_error(ER_UNKNOWN_SYSTEM_VARIABLE, ER(ER_UNKNOWN_SYSTEM_VARIABLE), my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
MYF(0), (char*) str);
return var; return var;
} }
@ -2814,7 +2801,7 @@ int set_var::check(THD *thd)
if (var->check_type(type)) if (var->check_type(type))
{ {
int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE; int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
my_printf_error(err, ER(err), MYF(0), var->name); my_error(err, MYF(0), 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)))
@ -2824,7 +2811,7 @@ int set_var::check(THD *thd)
{ {
if (var->check_default(type)) if (var->check_default(type))
{ {
my_printf_error(ER_NO_DEFAULT, ER(ER_NO_DEFAULT), MYF(0), var->name); my_error(ER_NO_DEFAULT, MYF(0), var->name);
return -1; return -1;
} }
return 0; return 0;
@ -2834,8 +2821,7 @@ 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_printf_error(ER_WRONG_TYPE_FOR_VAR, ER(ER_WRONG_TYPE_FOR_VAR), MYF(0), my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name);
var->name);
return -1; return -1;
} }
return var->check(thd, this) ? -1 : 0; return var->check(thd, this) ? -1 : 0;
@ -2859,7 +2845,7 @@ int set_var::light_check(THD *thd)
if (var->check_type(type)) if (var->check_type(type))
{ {
int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE; int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
my_printf_error(err, ER(err), MYF(0), var->name); my_error(err, MYF(0), 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))
@ -2986,8 +2972,7 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
value= "unknown"; value= "unknown";
err: err:
my_printf_error(ER_UNKNOWN_STORAGE_ENGINE, ER(ER_UNKNOWN_STORAGE_ENGINE), my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
MYF(0), value);
return 1; return 1;
} }

View file

@ -418,3 +418,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -409,3 +409,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -418,3 +418,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -411,3 +411,5 @@ character-set=latin7
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -419,3 +419,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -406,3 +406,5 @@ character-set=greek
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -411,3 +411,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -410,3 +410,5 @@ character-set=ujis
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -406,3 +406,5 @@ character-set=euckr
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -408,3 +408,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -408,3 +408,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -411,3 +411,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -408,3 +408,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -411,3 +411,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -411,3 +411,5 @@ character-set=koi8r
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -399,3 +399,5 @@ character-set=cp1250
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -414,3 +414,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -410,3 +410,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -412,3 +412,5 @@ character-set=koi8u
"Binary logging and replication forbid changing the global server %s" "Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d" "Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s" "Wrong magic in %-.64s"
"Prepared statement contains too many placeholders"
"Key part '%-.64s' length cannot be 0"

View file

@ -1502,7 +1502,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_printf_error(ER_MASTER, ER(ER_MASTER), MYF(0), err_msg); my_error(ER_MASTER, MYF(0), err_msg);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->command = COM_TABLE_DUMP; thd->command = COM_TABLE_DUMP;
@ -1580,8 +1580,7 @@ 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_printf_error(ER_INDEX_REBUILD, ER(ER_INDEX_REBUILD), MYF(0), my_error(ER_INDEX_REBUILD, MYF(0), tables.table->real_name);
tables.table->real_name);
err: err:
close_thread_tables(thd); close_thread_tables(thd);
@ -1608,8 +1607,7 @@ 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_printf_error(ER_CONNECT_TO_MASTER, ER(ER_CONNECT_TO_MASTER), MYF(0), my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
mysql_error(mysql));
mysql_close(mysql); mysql_close(mysql);
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View file

@ -1001,8 +1001,7 @@ sp_cache_functions(THD *thd, LEX *lex)
{ {
delete newlex; delete newlex;
thd->lex= oldlex; thd->lex= oldlex;
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", ls->str);
"FUNCTION", ls->str);
ret= 1; ret= 1;
break; break;
} }
@ -1164,7 +1163,7 @@ sp_change_db(THD *thd, char *name, bool no_access_check)
{ {
if ((db_length > NAME_LEN) || check_db_name(dbname)) if ((db_length > NAME_LEN) || check_db_name(dbname))
{ {
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname); my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
x_free(dbname); x_free(dbname);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1183,11 +1182,10 @@ sp_change_db(THD *thd, char *name, bool no_access_check)
if (!(db_access & DB_ACLS) && if (!(db_access & DB_ACLS) &&
(!grant_option || check_grant_db(thd,dbname))) (!grant_option || check_grant_db(thd,dbname)))
{ {
my_printf_error(ER_DBACCESS_DENIED_ERROR, ER(ER_DBACCESS_DENIED_ERROR), my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
MYF(0), thd->priv_user,
thd->priv_user, thd->priv_host,
thd->priv_host, dbname);
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,
@ -1203,7 +1201,7 @@ sp_change_db(THD *thd, char *name, bool no_access_check)
path[length-1]=0; // remove ending '\' path[length-1]=0; // remove ending '\'
if (access(path,F_OK)) if (access(path,F_OK))
{ {
my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname); my_error(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

@ -544,8 +544,8 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
{ {
// Need to use my_printf_error here, or it will not terminate the // Need to use my_printf_error here, or it will not terminate the
// invoking query properly. // invoking query properly.
my_printf_error(ER_SP_WRONG_NO_OF_ARGS, ER(ER_SP_WRONG_NO_OF_ARGS), MYF(0), my_error(ER_SP_WRONG_NO_OF_ARGS, MYF(0),
"FUNCTION", m_name.str, params, argcount); "FUNCTION", m_name.str, params, argcount);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -596,8 +596,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
*resp= it; *resp= it;
else else
{ {
my_printf_error(ER_SP_NORETURNEND, ER(ER_SP_NORETURNEND), MYF(0), my_error(ER_SP_NORETURNEND, MYF(0), m_name.str);
m_name.str);
ret= -1; ret= -1;
} }
} }
@ -623,8 +622,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (args->elements != params) if (args->elements != params)
{ {
my_printf_error(ER_SP_WRONG_NO_OF_ARGS, ER(ER_SP_WRONG_NO_OF_ARGS), MYF(0), my_error(ER_SP_WRONG_NO_OF_ARGS, MYF(0), "PROCEDURE",
"PROCEDURE", m_name.str, params, args->elements); m_name.str, params, args->elements);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -893,8 +892,7 @@ sp_head::check_backpatch(THD *thd)
{ {
if (bp->lab->type == SP_LAB_REF) if (bp->lab->type == SP_LAB_REF)
{ {
my_printf_error(ER_SP_LILABEL_MISMATCH, ER(ER_SP_LILABEL_MISMATCH), my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "GOTO", bp->lab->name);
MYF(0), "GOTO", bp->lab->name);
return -1; return -1;
} }
} }

View file

@ -1534,9 +1534,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
if (combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH && if (combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323) combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{ {
my_printf_error(ER_UNKNOWN_ERROR, my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
"Password hash should be a %d-digit hexadecimal number",
MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
password_len= combo.password.length; password_len= combo.password.length;
@ -1552,8 +1550,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
/* what == 'N' means revoke */ /* what == 'N' means revoke */
if (what == 'N') if (what == 'N')
{ {
my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRAN), MYF(0), my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
combo.user.str, combo.host.str);
goto end; goto end;
} }
/* /*
@ -1570,9 +1567,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
else if (((thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER) && else if (((thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER) &&
!password_len) || !create_user) !password_len) || !create_user)
{ {
my_printf_error(ER_NO_PERMISSION_TO_CREATE_USER, my_error(ER_NO_PERMISSION_TO_CREATE_USER, MYF(0),
ER(ER_NO_PERMISSION_TO_CREATE_USER), MYF(0), thd->user, thd->host_or_ip);
thd->user, thd->host_or_ip);
goto end; goto end;
} }
old_row_exists = 0; old_row_exists = 0;
@ -1760,8 +1756,7 @@ 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_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRANT), MYF(0), my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
combo.user.str, combo.host.str);
goto abort; goto abort;
} }
old_row_exists = 0; old_row_exists = 0;
@ -2068,10 +2063,9 @@ static int replace_column_table(GRANT_TABLE *g_t,
{ {
if (revoke_grant) if (revoke_grant)
{ {
my_printf_error(ER_NONEXISTING_TABLE_GRANT, my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
ER(ER_NONEXISTING_TABLE_GRANT), MYF(0), combo.user.str, combo.host.str,
combo.user.str, combo.host.str, table_name); /* purecov: inspected */
table_name); /* purecov: inspected */
result= -1; /* purecov: inspected */ result= -1; /* purecov: inspected */
continue; /* purecov: inspected */ continue; /* purecov: inspected */
} }
@ -2237,10 +2231,9 @@ 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_printf_error(ER_NONEXISTING_TABLE_GRANT, my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
ER(ER_NONEXISTING_TABLE_GRANT), MYF(0), combo.user.str, combo.host.str,
combo.user.str, combo.host.str, table_name); /* purecov: deadcode */
table_name); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(-1); /* purecov: deadcode */
} }
old_row_exists = 0; old_row_exists = 0;
@ -2369,8 +2362,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_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(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;
@ -2385,8 +2378,7 @@ 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_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0), my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias);
table_list->db, table_list->alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2474,9 +2466,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{ {
if (revoke_grant) if (revoke_grant)
{ {
my_printf_error(ER_NONEXISTING_TABLE_GRANT, my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
ER(ER_NONEXISTING_TABLE_GRANT), MYF(0), Str->user.str, Str->host.str, table_list->real_name);
Str->user.str, Str->host.str, table_list->real_name);
result= TRUE; result= TRUE;
continue; continue;
} }
@ -2920,12 +2911,11 @@ 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_printf_error(ER_TABLEACCESS_DENIED_ERROR, my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
ER(ER_TABLEACCESS_DENIED_ERROR), MYF(0), command,
command, thd->priv_user,
thd->priv_user, thd->host_or_ip,
thd->host_or_ip, table ? table->real_name : "unknown");
table ? table->real_name : "unknown");
} }
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -2971,21 +2961,18 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant,
} }
#endif #endif
/* We must use my_printf_error() here! */
err: err:
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
if (!show_tables) if (!show_tables)
{ {
char command[128]; char command[128];
get_privilege_desc(command, sizeof(command), want_access); get_privilege_desc(command, sizeof(command), want_access);
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR, my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
ER(ER_COLUMNACCESS_DENIED_ERROR), command,
MYF(0), thd->priv_user,
command, thd->host_or_ip,
thd->priv_user, name,
thd->host_or_ip, table_name);
name,
table_name);
} }
return 1; return 1;
} }
@ -3032,7 +3019,6 @@ bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant,
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
return 0; return 0;
/* We must use my_printf_error() here! */
err: err:
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
err2: err2:
@ -3041,14 +3027,12 @@ err2:
command= "select"; command= "select";
else if (want_access & INSERT_ACL) else if (want_access & INSERT_ACL)
command= "insert"; command= "insert";
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR, my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
ER(ER_COLUMNACCESS_DENIED_ERROR), command,
MYF(0), thd->priv_user,
command, thd->host_or_ip,
thd->priv_user, fields->name(),
thd->host_or_ip, table_name);
fields->name(),
table_name);
return 1; return 1;
} }
@ -3232,9 +3216,8 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
} }
if (counter == acl_users.elements) if (counter == acl_users.elements)
{ {
my_printf_error(ER_NONEXISTING_GRANT, my_error(ER_NONEXISTING_GRANT, MYF(0),
ER(ER_NONEXISTING_GRANT), MYF(0), lex_user->user.str, lex_user->host.str);
lex_user->user.str, lex_user->host.str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }

View file

@ -81,18 +81,14 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val_real() < 0) (*param->item)->val_real() < 0)
{ {
delete pc; delete pc;
my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
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_printf_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE, my_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE, MYF(0), proc_name);
ER(ER_WRONG_PARAMCOUNT_TO_PROCEDURE), MYF(0),
proc_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
// second parameter // second parameter
@ -100,9 +96,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val_real() < 0) (*param->item)->val_real() < 0)
{ {
delete pc; delete pc;
my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
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();
@ -111,8 +105,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val_real() < 0) (*param->item)->val_real() < 0)
{ {
delete pc; delete pc;
my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
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

@ -891,8 +891,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
{ {
if (table->query_id == thd->query_id) if (table->query_id == thd->query_id)
{ {
my_printf_error(ER_CANT_REOPEN_TABLE, my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->table_name);
ER(ER_CANT_REOPEN_TABLE), MYF(0), table->table_name);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
table->query_id= thd->query_id; table->query_id= thd->query_id;
@ -949,7 +948,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
} }
} }
my_printf_error(ER_TABLE_NOT_LOCKED,ER(ER_TABLE_NOT_LOCKED),MYF(0),alias); my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -1262,8 +1261,7 @@ 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_printf_error(ER_CANT_REOPEN_TABLE, ER(ER_CANT_REOPEN_TABLE), my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->table_name);
MYF(0),table->table_name);
VOID(hash_delete(&open_cache,(byte*) table)); VOID(hash_delete(&open_cache,(byte*) table));
error=1; error=1;
} }
@ -1548,8 +1546,7 @@ 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_printf_error(ER_NOT_KEYFILE, ER(ER_NOT_KEYFILE), MYF(0), my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno);
name, my_errno);
sql_print_error("Couldn't repair table: %s.%s",db,name); sql_print_error("Couldn't repair table: %s.%s",db,name);
if (entry->file) if (entry->file)
closefrm(entry); closefrm(entry);
@ -1614,8 +1611,7 @@ err:
{ {
TABLE_LIST * view= table_desc->belong_to_view; TABLE_LIST * view= table_desc->belong_to_view;
thd->clear_error(); thd->clear_error();
my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0), my_error(ER_VIEW_INVALID, MYF(0), view->view_db.str, view->view_name.str);
view->view_db.str, view->view_name.str);
} }
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1743,9 +1739,7 @@ static bool check_lock_and_start_stmt(THD *thd, TABLE *table,
if ((int) lock_type >= (int) TL_WRITE_ALLOW_READ && if ((int) lock_type >= (int) TL_WRITE_ALLOW_READ &&
(int) table->reginfo.lock_type < (int) TL_WRITE_ALLOW_READ) (int) table->reginfo.lock_type < (int) TL_WRITE_ALLOW_READ)
{ {
my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),table->table_name);
ER(ER_TABLE_NOT_LOCKED_FOR_WRITE),
MYF(0),table->table_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if ((error=table->file->start_stmt(thd))) if ((error=table->file->start_stmt(thd)))
@ -2330,8 +2324,8 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
{ {
if (report_error == REPORT_ALL_ERRORS || if (report_error == REPORT_ALL_ERRORS ||
report_error == IGNORE_EXCEPT_NON_UNIQUE) report_error == IGNORE_EXCEPT_NON_UNIQUE)
my_printf_error(ER_NON_UNIQ_ERROR,ER(ER_NON_UNIQ_ERROR),MYF(0), my_error(ER_NON_UNIQ_ERROR, MYF(0),
item->full_name(),thd->where); item->full_name(),thd->where);
return (Field*) 0; return (Field*) 0;
} }
found=find; found=find;
@ -2351,16 +2345,14 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
} }
if (report_error == REPORT_ALL_ERRORS || if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE) report_error == REPORT_EXCEPT_NON_UNIQUE)
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, thd->where);
table_name, thd->where);
else else
return (Field*) not_found_field; return (Field*) not_found_field;
} }
else else
if (report_error == REPORT_ALL_ERRORS || if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE) report_error == REPORT_EXCEPT_NON_UNIQUE)
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(),thd->where);
item->full_name(),thd->where);
else else
return (Field*) not_found_field; return (Field*) not_found_field;
return (Field*) 0; return (Field*) 0;
@ -2373,8 +2365,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
{ {
if (report_error == REPORT_ALL_ERRORS || if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE) report_error == REPORT_EXCEPT_NON_UNIQUE)
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(),thd->where);
item->full_name(),thd->where);
return (Field*) not_found_field; return (Field*) not_found_field;
} }
@ -2399,8 +2390,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
break; break;
if (report_error == REPORT_ALL_ERRORS || if (report_error == REPORT_ALL_ERRORS ||
report_error == IGNORE_EXCEPT_NON_UNIQUE) report_error == IGNORE_EXCEPT_NON_UNIQUE)
my_printf_error(ER_NON_UNIQ_ERROR,ER(ER_NON_UNIQ_ERROR),MYF(0), my_error(ER_NON_UNIQ_ERROR, MYF(0), name, thd->where);
name,thd->where);
return (Field*) 0; return (Field*) 0;
} }
found=field; found=field;
@ -2410,8 +2400,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
return found; return found;
if (report_error == REPORT_ALL_ERRORS || if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE) report_error == REPORT_EXCEPT_NON_UNIQUE)
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(), thd->where);
MYF(0), item->full_name(), thd->where);
else else
return (Field*) not_found_field; return (Field*) not_found_field;
return (Field*) 0; return (Field*) 0;
@ -2523,8 +2512,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
unaliased names only and will have duplicate error anyway. unaliased names only and will have duplicate error anyway.
*/ */
if (report_error != IGNORE_ERRORS) if (report_error != IGNORE_ERRORS)
my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR), my_error(ER_NON_UNIQ_ERROR, MYF(0),
MYF(0), find->full_name(), current_thd->where); find->full_name(), current_thd->where);
return (Item**) 0; return (Item**) 0;
} }
found_unaliased= li.ref(); found_unaliased= li.ref();
@ -2548,8 +2537,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if ((*found)->eq(item, 0)) if ((*found)->eq(item, 0))
continue; // Same field twice continue; // Same field twice
if (report_error != IGNORE_ERRORS) if (report_error != IGNORE_ERRORS)
my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR), my_error(ER_NON_UNIQ_ERROR, MYF(0),
MYF(0), find->full_name(), current_thd->where); find->full_name(), current_thd->where);
return (Item**) 0; return (Item**) 0;
} }
found= li.ref(); found= li.ref();
@ -2592,8 +2581,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if (found_unaliased_non_uniq) if (found_unaliased_non_uniq)
{ {
if (report_error != IGNORE_ERRORS) if (report_error != IGNORE_ERRORS)
my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR), MYF(0), my_error(ER_NON_UNIQ_ERROR, MYF(0),
find->full_name(), current_thd->where); find->full_name(), current_thd->where);
return (Item **) 0; return (Item **) 0;
} }
if (found_unaliased) if (found_unaliased)
@ -2608,8 +2597,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if (report_error != REPORT_EXCEPT_NOT_FOUND) if (report_error != REPORT_EXCEPT_NOT_FOUND)
{ {
if (report_error == REPORT_ALL_ERRORS) if (report_error == REPORT_ALL_ERRORS)
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0),
find->full_name(), current_thd->where); find->full_name(), current_thd->where);
return (Item **) 0; return (Item **) 0;
} }
else else
@ -2822,9 +2811,8 @@ 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_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS, my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0),
ER(ER_KEY_COLUMN_DOES_NOT_EXITS), MYF(0), name->c_ptr(), table->real_name);
name->c_ptr(), table->real_name);
map->set_all(); map->set_all();
return 1; return 1;
} }
@ -2994,14 +2982,12 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
fld->field_name) & fld->field_name) &
VIEW_ANY_ACL))) VIEW_ANY_ACL)))
{ {
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR, my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
ER(ER_COLUMNACCESS_DENIED_ERROR), "ANY",
MYF(0), thd->priv_user,
"ANY", thd->host_or_ip,
thd->priv_user, fld->field_name,
thd->host_or_ip, tab);
fld->field_name,
tab);
goto err; goto err;
} }
} }
@ -3042,8 +3028,7 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
if (!table_name) if (!table_name)
my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0)); my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
else else
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0), my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name);
table_name);
err: err:
DBUG_RETURN(1); DBUG_RETURN(1);
@ -3573,8 +3558,7 @@ 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_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0), my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE");
db, table_name, "BASE TABLE");
goto err; goto err;
} }
if (mysql_make_view(parser, table_desc)) if (mysql_make_view(parser, table_desc))
@ -3583,8 +3567,7 @@ open_new_frm(const char *path, const char *alias,
else else
{ {
/* only VIEWs are supported now */ /* only VIEWs are supported now */
my_printf_error(ER_FRM_UNKNOWN_TYPE, ER(ER_FRM_UNKNOWN_TYPE), MYF(0), my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), path, parser->type()->str);
path, parser->type()->str);
goto err; goto err;
} }
DBUG_RETURN(0); DBUG_RETURN(0);

View file

@ -701,8 +701,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_printf_error(EE_OUTOFMEMORY, ER(EE_OUTOFMEMORY), MYF(ME_BELL), my_error(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;
} }
@ -1018,8 +1018,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
if (!access(path, F_OK)) if (!access(path, F_OK))
{ {
my_printf_error(ER_FILE_EXISTS_ERROR, ER(ER_FILE_EXISTS_ERROR), MYF(0), my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
exchange->file_name);
return -1; return -1;
} }
/* Create the file world readable */ /* Create the file world readable */
@ -1263,8 +1262,7 @@ 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_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0), my_error(ER_ERROR_ON_WRITE, MYF(0), path, my_errno);
path, my_errno);
goto err; goto err;
} }
} }

View file

@ -408,8 +408,7 @@ 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_printf_error(ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), MYF(0), my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
db);
error= -1; error= -1;
goto exit; goto exit;
} }
@ -419,13 +418,12 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
{ {
if (my_errno != ENOENT) if (my_errno != ENOENT)
{ {
my_printf_error(EE_STAT, ER(EE_STAT), MYF(0), path, my_errno); my_error(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_printf_error(ER_CANT_CREATE_DB, ER(ER_CANT_CREATE_DB), my_error(ER_CANT_CREATE_DB, MYF(0), db, my_errno);
MYF(0), db, my_errno);
error= -1; error= -1;
goto exit; goto exit;
} }
@ -579,7 +577,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_printf_error(ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), MYF(0), db); my_error(ER_DB_DROP_EXISTS, MYF(0), db);
goto exit; goto exit;
} }
else else
@ -803,8 +801,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
*/ */
if (found_other_files) if (found_other_files)
{ {
my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0), my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, EEXIST);
org_path, EEXIST);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else else
@ -867,8 +864,7 @@ 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_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0), my_error(ER_DB_DROP_RMDIR, MYF(0), path, errno);
path, errno);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
@ -995,7 +991,7 @@ bool mysql_change_db(THD *thd, const char *name)
} }
if (check_db_name(dbname)) if (check_db_name(dbname))
{ {
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname); my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
x_free(dbname); x_free(dbname);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1008,11 +1004,10 @@ 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_printf_error(ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
ER(ER_DBACCESS_DENIED_ERROR), MYF(0), thd->priv_user,
thd->priv_user, thd->priv_host,
thd->priv_host, dbname);
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,
@ -1027,7 +1022,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_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname); my_error(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

@ -290,14 +290,12 @@ 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_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), MYF(0), my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
table_list->alias, "DELETE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (unique_table(table_list, table_list->next_global)) if (unique_table(table_list, table_list->next_global))
{ {
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0), my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
table_list->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
select_lex->fix_prepare_information(thd, conds); select_lex->fix_prepare_information(thd, conds);
@ -354,8 +352,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_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
MYF(0), target_tbl->real_name, "DELETE"); target_tbl->real_name, "DELETE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* /*
@ -372,8 +370,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_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), my_error(ER_UPDATE_TABLE_USED, MYF(0),
MYF(0), target_tbl->correspondent_table->real_name); target_tbl->correspondent_table->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -736,8 +734,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_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0), my_error(ER_NO_SUCH_TABLE, MYF(0),
table_list->db, 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

@ -173,8 +173,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
{ {
DBUG_PRINT("info",("duplicate '%s'", tables->alias)); DBUG_PRINT("info",("duplicate '%s'", tables->alias));
if (! reopen) if (! reopen)
my_printf_error(ER_NONUNIQ_TABLE, ER(ER_NONUNIQ_TABLE), my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias);
MYF(0), tables->alias);
goto err; goto err;
} }
} }
@ -198,7 +197,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
if (! (tables->table->file->table_flags() & HA_CAN_SQL_HANDLER)) if (! (tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
{ {
if (! reopen) if (! reopen)
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias); my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
mysql_ha_close(thd, tables); mysql_ha_close(thd, tables);
goto err; goto err;
} }
@ -257,11 +256,11 @@ err:
will be closed. Broadcasts a COND_refresh condition. will be closed. Broadcasts a COND_refresh condition.
RETURN RETURN
0 ok FALSE ok
!= 0 error TRUE error
*/ */
int mysql_ha_close(THD *thd, TABLE_LIST *tables) bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
{ {
TABLE_LIST *hash_tables; TABLE_LIST *hash_tables;
TABLE **table_ptr; TABLE **table_ptr;
@ -299,15 +298,14 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
} }
else else
{ {
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), my_error(ER_UNKNOWN_TABLE, MYF(0), tables->alias, "HANDLER");
tables->alias, "HANDLER");
DBUG_PRINT("exit",("ERROR")); DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_ok(thd); send_ok(thd);
DBUG_PRINT("exit", ("OK")); DBUG_PRINT("exit", ("OK"));
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -403,11 +401,9 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
strxnmov(buff, sizeof(buff), tables->db, ".", tables->real_name, NullS); strxnmov(buff, sizeof(buff), tables->db, ".", tables->real_name, NullS);
else else
strncpy(buff, tables->alias, sizeof(buff)); strncpy(buff, tables->alias, sizeof(buff));
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), my_error(ER_UNKNOWN_TABLE, MYF(0), buff, "HANDLER");
buff, "HANDLER");
#else #else
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), my_error(ER_UNKNOWN_TABLE, MYF(0), tables->alias, "HANDLER");
tables->alias, "HANDLER");
#endif #endif
goto err0; goto err0;
} }
@ -422,8 +418,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
{ {
if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0) if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0)
{ {
my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0), my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
keyname,tables->alias);
goto err0; goto err0;
} }
table->file->ha_index_or_rnd_end(); table->file->ha_index_or_rnd_end();
@ -491,8 +486,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
KEY_PART_INFO *key_part=keyinfo->key_part; KEY_PART_INFO *key_part=keyinfo->key_part;
if (key_expr->elements > keyinfo->key_parts) if (key_expr->elements > keyinfo->key_parts)
{ {
my_printf_error(ER_TOO_MANY_KEY_PARTS,ER(ER_TOO_MANY_KEY_PARTS), my_error(ER_TOO_MANY_KEY_PARTS, MYF(0), keyinfo->key_parts);
MYF(0),keyinfo->key_parts);
goto err; goto err;
} }
List_iterator<Item> it_ke(*key_expr); List_iterator<Item> it_ke(*key_expr);

View file

@ -58,9 +58,7 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
{ {
if (values.elements != table->fields) if (values.elements != table->fields)
{ {
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
MYF(0),counter);
return -1; return -1;
} }
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -82,9 +80,7 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
int res; int res;
if (fields.elements != values.elements) if (fields.elements != values.elements)
{ {
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
MYF(0),counter);
return -1; return -1;
} }
@ -100,8 +96,7 @@ 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_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE), my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name);
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
@ -172,9 +167,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
table_list->db ? table_list->db : thd->db, table_list->db ? table_list->db : thd->db,
table_list->real_name)) table_list->real_name))
{ {
my_printf_error(ER_DELAYED_INSERT_TABLE_LOCKED, my_error(ER_DELAYED_INSERT_TABLE_LOCKED, MYF(0),
ER(ER_DELAYED_INSERT_TABLE_LOCKED), table_list->real_name);
MYF(0), table_list->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -228,9 +222,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
counter++; counter++;
if (values->elements != value_count) if (values->elements != value_count)
{ {
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
MYF(0),counter);
goto abort; goto abort;
} }
if (setup_fields(thd, 0, table_list, *values, 0, 0, 0)) if (setup_fields(thd, 0, table_list, *values, 0, 0, 0))
@ -602,8 +594,7 @@ 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_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "INSERT");
MYF(0), table_list->alias, "INSERT");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
@ -650,8 +641,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
if (unique_table(table_list, table_list->next_global)) if (unique_table(table_list, table_list->next_global))
{ {
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
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;
@ -831,9 +821,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry)
if ((*field)->query_id != thd->query_id && if ((*field)->query_id != thd->query_id &&
((*field)->flags & NO_DEFAULT_VALUE_FLAG)) ((*field)->flags & NO_DEFAULT_VALUE_FLAG))
{ {
my_printf_error(ER_NO_DEFAULT_FOR_FIELD, my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), (*field)->field_name);
ER(ER_NO_DEFAULT_FOR_FIELD),MYF(0),
(*field)->field_name);
return 1; return 1;
} }
} }
@ -1325,8 +1313,7 @@ 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_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0), my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.real_name);
di->table_list.real_name);
goto end; goto end;
} }
di->table->copy_blobs=1; di->table->copy_blobs=1;
@ -1886,9 +1873,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if (table->fields < values.elements) if (table->fields < values.elements)
{ {
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1);
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
MYF(0),1);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }

View file

@ -125,8 +125,7 @@ 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_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD");
MYF(0), table_list->alias, "LOAD");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
table= table_list->table; table= table_list->table;
@ -149,8 +148,7 @@ 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_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE), my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name);
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))
@ -223,8 +221,7 @@ 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_printf_error(ER_TEXTFILE_NOT_READABLE, my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
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,13 +47,12 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
0L))) 0L)))
{ {
error=errno; error=errno;
my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0), my_error(ER_NO_FILE_MAPPING, MYF(0), (my_string) name, error);
(my_string) name, error);
} }
} }
if (map && memcmp(map,magic,magic_length)) if (map && memcmp(map,magic,magic_length))
{ {
my_printf_error(ER_WRONG_MAGIC, ER(ER_WRONG_MAGIC), MYF(0), name); my_error(ER_WRONG_MAGIC, MYF(0), name);
VOID(munmap(map,size)); VOID(munmap(map,size));
map=0; map=0;
} }
@ -112,8 +111,7 @@ 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_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0), my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error);
path, map->error);
} }
VOID(pthread_mutex_unlock(&LOCK_mapped_file)); VOID(pthread_mutex_unlock(&LOCK_mapped_file));
return map; return map;

View file

@ -1204,8 +1204,7 @@ 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_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), my_error(ER_WRONG_DB_NAME ,MYF(0), db ? db : "NULL");
db ? db : "NULL");
goto err; goto err;
} }
if (lower_case_table_names) if (lower_case_table_names)
@ -1502,7 +1501,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_PRINT("query",("%-.4096s",thd->query)); DBUG_PRINT("query",("%-.4096s",thd->query));
mysql_parse(thd,thd->query, thd->query_length); mysql_parse(thd,thd->query, thd->query_length);
while (!thd->killed && !thd->is_fatal_error && thd->lex->found_colon) while (!thd->killed && thd->lex->found_colon && !thd->net.report_error)
{ {
char *packet= thd->lex->found_colon; char *packet= thd->lex->found_colon;
/* /*
@ -1620,8 +1619,7 @@ 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_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL");
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))
@ -1630,7 +1628,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
bzero(&create_info, sizeof(create_info)); bzero(&create_info, sizeof(create_info));
if (mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db), if (mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db),
&create_info, 0) < 0) &create_info, 0) < 0)
send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0); error= TRUE;
break; break;
} }
case COM_DROP_DB: // QQ: To be removed case COM_DROP_DB: // QQ: To be removed
@ -1641,8 +1639,7 @@ 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_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL");
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))
@ -1656,7 +1653,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_log.write(thd,command,db); mysql_log.write(thd,command,db);
if (mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db), if (mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db),
0, 0) < 0) 0, 0) < 0)
send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0); error= TRUE;
break; break;
} }
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
@ -2189,11 +2186,10 @@ mysql_execute_command(THD *thd)
} }
else else
{ {
my_printf_error(ER_UNKNOWN_STMT_HANDLER, ER(ER_UNKNOWN_STMT_HANDLER), my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0),
MYF(0), lex->prepared_stmt_name.length,
lex->prepared_stmt_name.length, lex->prepared_stmt_name.str,
lex->prepared_stmt_name.str, "DEALLOCATE PREPARE");
"DEALLOCATE PREPARE");
goto error; goto error;
} }
break; break;
@ -2386,8 +2382,7 @@ mysql_execute_command(THD *thd)
} }
if (strlen(first_table->real_name) > NAME_LEN) if (strlen(first_table->real_name) > NAME_LEN)
{ {
my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0), my_error(ER_WRONG_TABLE_NAME, MYF(0), first_table->real_name);
first_table->real_name);
break; break;
} }
pthread_mutex_lock(&LOCK_active_mi); pthread_mutex_lock(&LOCK_active_mi);
@ -2455,8 +2450,7 @@ 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_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), my_error(ER_UPDATE_TABLE_USED, MYF(0), create_table->real_name);
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 */
@ -2469,8 +2463,7 @@ mysql_execute_command(THD *thd)
{ {
if (unique_table(tab, select_tables)) if (unique_table(tab, select_tables))
{ {
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), my_error(ER_UPDATE_TABLE_USED, MYF(0), tab->real_name);
MYF(0), tab->real_name);
goto create_error; goto create_error;
} }
} }
@ -2579,8 +2572,7 @@ create_error:
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_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0), my_error(ER_WRONG_TABLE_NAME, MYF(0), lex->name);
lex->name);
goto error; goto error;
} }
if (!select_lex->db) if (!select_lex->db)
@ -3054,18 +3046,17 @@ create_error:
remove_escape(db); // Fix escaped '_' remove_escape(db); // Fix escaped '_'
if (check_db_name(db)) if (check_db_name(db))
{ {
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), db); my_error(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_printf_error(ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
ER(ER_DBACCESS_DENIED_ERROR), MYF(0), thd->priv_user,
thd->priv_user, thd->priv_host,
thd->priv_host, db);
db);
goto error; goto error;
} }
/* grant is checked in mysqld_show_tables */ /* grant is checked in mysqld_show_tables */
@ -3231,8 +3222,7 @@ 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_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
lex->name);
break; break;
} }
/* /*
@ -3262,8 +3252,7 @@ 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_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
lex->name);
break; break;
} }
/* /*
@ -3298,8 +3287,7 @@ create_error:
{ {
if (!strip_sp(lex->name) || check_db_name(lex->name)) if (!strip_sp(lex->name) || check_db_name(lex->name))
{ {
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
lex->name);
break; break;
} }
/* /*
@ -3333,8 +3321,7 @@ create_error:
{ {
if (!strip_sp(lex->name) || check_db_name(lex->name)) if (!strip_sp(lex->name) || check_db_name(lex->name))
{ {
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
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))
@ -3356,8 +3343,7 @@ 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_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0), my_error(ER_UDF_EXISTS, MYF(0), lex->spname->m_name.str);
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)))
@ -3642,7 +3628,7 @@ create_error:
if (udf) if (udf)
{ {
my_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0), name); my_error(ER_UDF_EXISTS, MYF(0), name);
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
@ -3652,7 +3638,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_printf_error(ER_SP_NORETURN, ER(ER_SP_NORETURN), MYF(0), name); my_error(ER_SP_NORETURN, MYF(0), name);
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
goto error; goto error;
@ -3667,22 +3653,19 @@ create_error:
lex->sphead= 0; lex->sphead= 0;
break; break;
case SP_WRITE_ROW_FAILED: case SP_WRITE_ROW_FAILED:
my_printf_error(ER_SP_ALREADY_EXISTS, ER(ER_SP_ALREADY_EXISTS), MYF(0), my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
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_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str);
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_printf_error(ER_SP_STORE_FAILED, ER(ER_SP_STORE_FAILED), MYF(0), my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
SP_TYPE_STRING(lex), name);
lex->unit.cleanup(); lex->unit.cleanup();
delete lex->sphead; delete lex->sphead;
lex->sphead= 0; lex->sphead= 0;
@ -3696,8 +3679,7 @@ create_error:
if (!(sp= sp_find_procedure(thd, lex->spname))) if (!(sp= sp_find_procedure(thd, lex->spname)))
{ {
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PROCEDURE",
MYF(0), "PROCEDURE",
lex->spname->m_qname.str); lex->spname->m_qname.str);
goto error; goto error;
} }
@ -3795,12 +3777,12 @@ create_error:
send_ok(thd); send_ok(thd);
break; break;
case SP_KEY_NOT_FOUND: case SP_KEY_NOT_FOUND:
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
SP_COM_STRING(lex), lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
default: default:
my_printf_error(ER_SP_CANT_ALTER, ER(ER_SP_CANT_ALTER), MYF(0), my_error(ER_SP_CANT_ALTER, MYF(0),
SP_COM_STRING(lex), lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
} }
break; break;
@ -3862,12 +3844,12 @@ create_error:
send_ok(thd); send_ok(thd);
break; break;
} }
my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
SP_COM_STRING(lex), lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
default: default:
my_printf_error(ER_SP_DROP_FAILED, ER(ER_SP_DROP_FAILED), MYF(0), my_error(ER_SP_DROP_FAILED, MYF(0),
SP_COM_STRING(lex), lex->spname->m_qname.str); SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error; goto error;
} }
break; break;
@ -3876,14 +3858,13 @@ create_error:
{ {
if (lex->spname->m_name.length > NAME_LEN) if (lex->spname->m_name.length > NAME_LEN)
{ {
my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0), my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
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_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(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;
@ -3892,14 +3873,13 @@ create_error:
{ {
if (lex->spname->m_name.length > NAME_LEN) if (lex->spname->m_name.length > NAME_LEN)
{ {
my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0), my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
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_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0), my_error(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;
@ -4103,13 +4083,12 @@ 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_printf_error(ER_ACCESS_DENIED_ERROR, my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
ER(ER_ACCESS_DENIED_ERROR), MYF(0), thd->priv_user,
thd->priv_user, thd->priv_host,
thd->priv_host, (thd->password ?
(thd->password ? ER(ER_YES) :
ER(ER_YES) : ER(ER_NO))); /* purecov: tested */
ER(ER_NO)));/* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */ DBUG_RETURN(TRUE); /* purecov: tested */
} }
@ -4136,13 +4115,12 @@ 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_printf_error(ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
ER(ER_DBACCESS_DENIED_ERROR), MYF(0), thd->priv_user,
thd->priv_user, thd->priv_host,
thd->priv_host, (db ? db : (thd->db ?
(db ? db : (thd->db ? thd->db :
thd->db : "unknown"))); /* purecov: tested */
"unknown"))); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */ DBUG_RETURN(TRUE); /* purecov: tested */
#endif /* NO_EMBEDDED_ACCESS_CHECKS */ #endif /* NO_EMBEDDED_ACCESS_CHECKS */
} }
@ -4176,8 +4154,7 @@ 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_printf_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
ER(ER_SPECIFIC_ACCESS_DENIED_ERROR), MYF(0), command);
return 1; return 1;
#endif /* NO_EMBEDDED_ACCESS_CHECKS */ #endif /* NO_EMBEDDED_ACCESS_CHECKS */
} }
@ -4331,8 +4308,7 @@ 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_printf_error(ER_SP_ACCESS_DENIED_ERROR, ER(ER_SP_ACCESS_DENIED_ERROR), my_error(ER_SP_ACCESS_DENIED_ERROR, MYF(0), sp->m_qname.str);
MYF(0), sp->m_qname.str);
return TRUE; /* Not definer or root */ return TRUE; /* Not definer or root */
} }
@ -4710,8 +4686,7 @@ 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_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0), my_error(ER_TOO_LONG_IDENT, MYF(0), field_name); /* purecov: inspected */
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)
@ -4742,8 +4717,7 @@ 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_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0), my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (default_value->type() == Item::NULL_ITEM) else if (default_value->type() == Item::NULL_ITEM)
@ -4752,23 +4726,20 @@ 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_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0), my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
else if (type_modifier & AUTO_INCREMENT_FLAG) else if (type_modifier & AUTO_INCREMENT_FLAG)
{ {
my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0), my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
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_printf_error(ER_INVALID_ON_UPDATE, ER(ER_INVALID_ON_UPDATE), MYF(0), my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -4894,9 +4865,8 @@ 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_printf_error(ER_BLOB_CANT_HAVE_DEFAULT, my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0),
ER(ER_BLOB_CANT_HAVE_DEFAULT), MYF(0), field_name); /* purecov: inspected */
field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
new_field->def=0; new_field->def=0;
@ -4916,8 +4886,7 @@ 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_printf_error(ER_WRONG_FIELD_SPEC, ER(ER_WRONG_FIELD_SPEC), MYF(0), my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (tmp_length > PRECISION_FOR_FLOAT) else if (tmp_length > PRECISION_FOR_FLOAT)
@ -5014,8 +4983,7 @@ 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_printf_error(ER_TOO_BIG_SET, ER(ER_TOO_BIG_SET), MYF(0), my_error(ER_TOO_BIG_SET, MYF(0), field_name); /* purecov: inspected */
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;
@ -5041,8 +5009,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
&not_used, &not_used2, &not_used3); &not_used, &not_used2, &not_used3);
if (thd->cuted_fields) if (thd->cuted_fields)
{ {
my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0), my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
@ -5064,8 +5031,7 @@ 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_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0), my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
@ -5079,15 +5045,14 @@ 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_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH), MYF(0), my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0),
field_name, 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_printf_error(ER_WRONG_FIELD_SPEC, ER(ER_WRONG_FIELD_SPEC), MYF(0), my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name);
field_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!new_field->pack_length) if (!new_field->pack_length)
@ -5217,8 +5182,7 @@ 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_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0), my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
table->table.str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -5283,8 +5247,7 @@ 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_printf_error(ER_NONUNIQ_TABLE, ER(ER_NONUNIQ_TABLE), MYF(0), my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str); /* purecov: tested */
alias_str); /* purecov: tested */
DBUG_RETURN(0); /* purecov: tested */ DBUG_RETURN(0); /* purecov: tested */
} }
} }
@ -5828,8 +5791,7 @@ 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_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0), my_error(ER_WRONG_TABLE_NAME, MYF(0), *filename_ptr);
*filename_ptr);
return 1; return 1;
} }
/* Fix is using unix filename format on dos */ /* Fix is using unix filename format on dos */
@ -5863,8 +5825,7 @@ bool check_simple_select()
char command[80]; char command[80];
strmake(command, lex->yylval->symbol.str, strmake(command, lex->yylval->symbol.str,
min(lex->yylval->symbol.length, sizeof(command)-1)); min(lex->yylval->symbol.length, sizeof(command)-1));
my_printf_error(ER_CANT_USE_OPTION_HERE, ER(ER_CANT_USE_OPTION_HERE), my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command);
MYF(0), command);
return 1; return 1;
} }
return 0; return 0;
@ -6010,7 +5971,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_printf_error(ER_WRONG_VALUE_COUNT, ER(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);
} }
/* /*
@ -6113,8 +6074,8 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
} }
if (!walk) if (!walk)
{ {
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), my_error(ER_UNKNOWN_TABLE, MYF(0),
target_tbl->real_name, "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;
@ -6288,8 +6249,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
find_table_in_global_list(tables, create_table->db, find_table_in_global_list(tables, create_table->db,
create_table->real_name)) create_table->real_name))
{ {
net_printf(thd,ER_UPDATE_TABLE_USED, create_table->real_name); error= FALSE;
goto err; goto err;
} }
} }

View file

@ -926,9 +926,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
counter++; counter++;
if (values->elements != value_count) if (values->elements != value_count)
{ {
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
MYF(0), counter);
goto error; goto error;
} }
if (setup_fields(thd, 0, table_list, *values, 0, 0, 0)) if (setup_fields(thd, 0, table_list, *values, 0, 0, 0))
@ -1062,15 +1060,13 @@ static int mysql_test_select(Prepared_statement *stmt,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
#endif #endif
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
{
send_error(thd);
goto err;
}
if ((result= open_and_lock_tables(thd, tables)))
goto err;
result= TRUE; result= TRUE;
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
goto err;
if (open_and_lock_tables(thd, tables))
goto err;
thd->used_tables= 0; // Updated by setup_fields thd->used_tables= 0; // Updated by setup_fields
@ -1518,9 +1514,8 @@ static bool init_param_array(Prepared_statement *stmt)
if (stmt->param_count > (uint) UINT_MAX16) if (stmt->param_count > (uint) UINT_MAX16)
{ {
/* Error code to be defined in 5.0 */ /* Error code to be defined in 5.0 */
send_error(thd, ER_UNKNOWN_ERROR, my_message(ER_PS_MANY_PARAM, ER(ER_PS_MANY_PARAM), MYF(0));
"Prepared statement contains too many placeholders."); return TRUE;
return 1;
} }
Item_param **to; Item_param **to;
List_iterator<Item_param> param_iterator(lex->param_list); List_iterator<Item_param> param_iterator(lex->param_list);
@ -1529,7 +1524,7 @@ static bool init_param_array(Prepared_statement *stmt)
alloc_root(stmt->thd->mem_root, alloc_root(stmt->thd->mem_root,
sizeof(Item_param*) * stmt->param_count); sizeof(Item_param*) * stmt->param_count);
if (!stmt->param_array) if (!stmt->param_array)
return 1; return TRUE;
for (to= stmt->param_array; for (to= stmt->param_array;
to < stmt->param_array + stmt->param_count; to < stmt->param_array + stmt->param_count;
++to) ++to)
@ -1537,7 +1532,7 @@ static bool init_param_array(Prepared_statement *stmt)
*to= param_iterator++; *to= param_iterator++;
} }
} }
return 0; return FALSE;
} }
@ -1659,9 +1654,6 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
/* Statement map deletes statement on erase */ /* Statement map deletes statement on erase */
thd->stmt_map.erase(stmt); thd->stmt_map.erase(stmt);
stmt= NULL; stmt= NULL;
if (thd->net.report_error)
send_error(thd);
/* otherwise the error is sent inside yyparse/check_preapred_statement */
} }
else else
{ {
@ -1968,7 +1960,7 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
alloc_query(thd, (char *)expanded_query->ptr(), alloc_query(thd, (char *)expanded_query->ptr(),
expanded_query->length()+1)) expanded_query->length()+1))
{ {
my_error(ER_OUTOFMEMORY, 0, expanded_query->length()); my_error(ER_OUTOFMEMORY, MYF(0), expanded_query->length());
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/* /*

View file

@ -157,8 +157,7 @@ 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_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
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,
@ -167,8 +166,7 @@ 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_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), MYF(0), my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
name, my_errno);
if (!skip_error) if (!skip_error)
DBUG_RETURN(ren_table); DBUG_RETURN(ren_table);
} }

View file

@ -1002,7 +1002,7 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
err: err:
unlock_slave_threads(mi); unlock_slave_threads(mi);
if (error) if (error)
my_printf_error(sql_errno, ER(sql_errno), MYF(0), errmsg); my_error(sql_errno, MYF(0), errmsg);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -1195,8 +1195,7 @@ 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_printf_error(ER_RELAY_LOG_FAIL, ER(ER_RELAY_LOG_FAIL), MYF(0), my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg);
errmsg);
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1212,7 +1211,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
0 /*no data lock*/, 0 /*no data lock*/,
&msg, 0)) &msg, 0))
{ {
my_printf_error(ER_RELAY_LOG_INIT, ER(ER_RELAY_LOG_INIT), MYF(0), msg); my_error(ER_RELAY_LOG_INIT, MYF(0), msg);
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -1406,9 +1405,8 @@ err:
if (errmsg) if (errmsg)
{ {
my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND, my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0), "SHOW BINLOG EVENTS", errmsg);
"SHOW BINLOG EVENTS", errmsg);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }

View file

@ -1883,7 +1883,7 @@ Cursor::fetch(ulong num_rows)
thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT; thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
} }
else else
send_error(thd, ER_OUT_OF_RESOURCES); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
/* free cursor memory */ /* free cursor memory */
free_items(free_list); free_items(free_list);
free_list= 0; free_list= 0;
@ -11220,8 +11220,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
uint count= (uint) order_item->val_int(); uint count= (uint) order_item->val_int();
if (!count || count > fields.elements) if (!count || count > fields.elements)
{ {
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR), my_error(ER_BAD_FIELD_ERROR, MYF(0),
MYF(0), order_item->full_name(), thd->where); order_item->full_name(), thd->where);
return 1; return 1;
} }
order->item= ref_pointer_array + count - 1; order->item= ref_pointer_array + count - 1;
@ -11371,8 +11371,7 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
(*order->item)->marker=1; /* Mark found */ (*order->item)->marker=1; /* Mark found */
if ((*order->item)->with_sum_func) if ((*order->item)->with_sum_func)
{ {
my_printf_error(ER_WRONG_GROUP_FIELD, ER(ER_WRONG_GROUP_FIELD),MYF(0), my_error(ER_WRONG_GROUP_FIELD, MYF(0), (*order->item)->full_name());
(*order->item)->full_name());
return 1; return 1;
} }
} }
@ -11387,9 +11386,7 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
if (item->type() != Item::SUM_FUNC_ITEM && !item->marker && if (item->type() != Item::SUM_FUNC_ITEM && !item->marker &&
!item->const_item()) !item->const_item())
{ {
my_printf_error(ER_WRONG_FIELD_WITH_GROUP, my_error(ER_WRONG_FIELD_WITH_GROUP, MYF(0), item->full_name());
ER(ER_WRONG_FIELD_WITH_GROUP),
MYF(0),item->full_name());
return 1; return 1;
} }
} }

View file

@ -868,8 +868,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_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0), my_error(ER_WRONG_OBJECT, MYF(0),
table_list->db, table_list->real_name, "VIEW"); table_list->db, table_list->real_name, "VIEW");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -938,7 +938,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
if (check_db_name(dbname)) if (check_db_name(dbname))
{ {
my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname); my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -950,9 +950,8 @@ 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_printf_error(ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
ER(ER_DBACCESS_DENIED_ERROR), MYF(0), thd->priv_user, thd->host_or_ip, dbname);
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);
@ -969,7 +968,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
} }
if (access(path,F_OK)) if (access(path,F_OK))
{ {
my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname); my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (found_libchar) if (found_libchar)

View file

@ -84,9 +84,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
{ {
if (thd->global_read_lock) if (thd->global_read_lock)
{ {
my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), tables->real_name);
ER(ER_TABLE_NOT_LOCKED_FOR_WRITE), MYF(0),
tables->real_name);
error= TRUE; error= TRUE;
goto err; goto err;
} }
@ -269,8 +267,7 @@ 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_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0), my_error(ER_BAD_TABLE_ERROR, MYF(0), wrong_tables.c_ptr());
wrong_tables.c_ptr());
else else
my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0)); my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
error= 1; error= 1;
@ -470,8 +467,7 @@ 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_printf_error(ER_WRONG_COLUMN_NAME, ER(ER_WRONG_COLUMN_NAME), MYF(0), my_error(ER_WRONG_COLUMN_NAME, MYF(0), sql_field->field_name);
sql_field->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -488,8 +484,7 @@ 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_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME), MYF(0), my_error(ER_DUP_FIELDNAME, MYF(0), sql_field->field_name);
sql_field->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else else
@ -541,8 +536,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
if (!(file->table_flags() & HA_CAN_GEOMETRY)) if (!(file->table_flags() & HA_CAN_GEOMETRY))
{ {
my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED), my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY");
MYF(0), "GEOMETRY");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
sql_field->pack_flag=FIELDFLAG_GEOM | sql_field->pack_flag=FIELDFLAG_GEOM |
@ -555,8 +549,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
blob_columns++; blob_columns++;
break; break;
#else #else
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED), MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
DBUG_RETURN(-1); DBUG_RETURN(-1);
#endif /*HAVE_SPATIAL*/ #endif /*HAVE_SPATIAL*/
case FIELD_TYPE_VAR_STRING: case FIELD_TYPE_VAR_STRING:
@ -676,11 +670,9 @@ 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_printf_error(ER_WRONG_FK_DEF, ER(ER_WRONG_FK_DEF), MYF(0), my_error(ER_WRONG_FK_DEF, MYF(0),
(fk_key->name ? (fk_key->name ? fk_key->name : "foreign key without name"),
fk_key->name : ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
"foreign key without name"),
ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
continue; continue;
@ -694,8 +686,7 @@ 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_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0), my_error(ER_TOO_LONG_IDENT, MYF(0), key->name);
key->name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
key_iterator2.rewind (); key_iterator2.rewind ();
@ -735,8 +726,7 @@ 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_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX), my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
MYF(0), key->name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -781,8 +771,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key_info->flags= HA_SPATIAL; key_info->flags= HA_SPATIAL;
break; break;
#else #else
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
DBUG_RETURN(-1); DBUG_RETURN(-1);
#endif #endif
case Key::FOREIGN_KEY: case Key::FOREIGN_KEY:
@ -822,8 +812,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
{ {
if (key_info->key_parts != 1) if (key_info->key_parts != 1)
{ {
my_printf_error(ER_WRONG_ARGUMENTS, my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
ER(ER_WRONG_ARGUMENTS),MYF(0),"SPATIAL INDEX");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -833,17 +822,15 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
#ifdef HAVE_RTREE_KEYS #ifdef HAVE_RTREE_KEYS
if ((key_info->key_parts & 1) == 1) if ((key_info->key_parts & 1) == 1)
{ {
my_printf_error(ER_WRONG_ARGUMENTS, my_error(ER_WRONG_ARGUMENTS, MYF(0), "RTREE INDEX");
ER(ER_WRONG_ARGUMENTS),MYF(0),"RTREE INDEX");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/* TODO: To be deleted */ /* TODO: To be deleted */
my_printf_error(ER_NOT_SUPPORTED_YET, ER(ER_NOT_SUPPORTED_YET), my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RTREE INDEX");
MYF(0), "RTREE INDEX");
DBUG_RETURN(-1); DBUG_RETURN(-1);
#else #else
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_rtree.name, sym_group_rtree.needed_define); sym_group_rtree.name, sym_group_rtree.needed_define);
DBUG_RETURN(-1); DBUG_RETURN(-1);
#endif #endif
} }
@ -861,9 +848,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
field++; field++;
if (!sql_field) if (!sql_field)
{ {
my_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS, my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name);
ER(ER_KEY_COLUMN_DOES_NOT_EXITS),MYF(0),
column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/* for fulltext keys keyseg length is 1 for blobs (it's ignored in /* for fulltext keys keyseg length is 1 for blobs (it's ignored in
@ -881,8 +866,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->charset->mbminlen > 1 || // ucs2 doesn't work yet sql_field->charset->mbminlen > 1 || // ucs2 doesn't work yet
(ft_key_charset && sql_field->charset != ft_key_charset)) (ft_key_charset && sql_field->charset != ft_key_charset))
{ {
my_printf_error(ER_BAD_FT_COLUMN,ER(ER_BAD_FT_COLUMN),MYF(0), my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name);
column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
ft_key_charset=sql_field->charset; ft_key_charset=sql_field->charset;
@ -903,15 +887,12 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
{ {
if (!(file->table_flags() & HA_CAN_INDEX_BLOBS)) if (!(file->table_flags() & HA_CAN_INDEX_BLOBS))
{ {
my_printf_error(ER_BLOB_USED_AS_KEY,ER(ER_BLOB_USED_AS_KEY),MYF(0), my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name);
column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (!column->length) if (!column->length)
{ {
my_printf_error(ER_BLOB_KEY_WITHOUT_LENGTH, my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name);
ER(ER_BLOB_KEY_WITHOUT_LENGTH),MYF(0),
column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -940,8 +921,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key_info->flags|= HA_NULL_PART_KEY; key_info->flags|= HA_NULL_PART_KEY;
if (!(file->table_flags() & HA_NULL_IN_KEY)) if (!(file->table_flags() & HA_NULL_IN_KEY))
{ {
my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX), my_error(ER_NULL_COLUMN_IN_INDEX, MYF(0), column->field_name);
MYF(0),column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (key->type == Key::SPATIAL) if (key->type == Key::SPATIAL)
@ -1001,8 +981,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
} }
else if (length == 0) else if (length == 0)
{ {
my_printf_error(ER_WRONG_KEY_COLUMN, ER(ER_WRONG_KEY_COLUMN), MYF(0), my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name);
column->field_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (length > file->max_key_part_length()) if (length > file->max_key_part_length())
@ -1058,8 +1037,7 @@ 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_printf_error(ER_DUP_KEYNAME, ER(ER_DUP_KEYNAME), MYF(0), my_error(ER_DUP_KEYNAME, MYF(0), key_name);
key_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
key_info->name=(char*) key_name; key_info->name=(char*) key_name;
@ -1067,8 +1045,7 @@ 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_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX), my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name);
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))
@ -1177,7 +1154,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_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0), table_name); my_error(ER_ILLEGAL_HA, MYF(0), table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
#endif #endif
@ -1228,8 +1205,7 @@ 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_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
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))
@ -1245,8 +1221,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
error= FALSE; error= FALSE;
} }
else else
my_printf_error(ER_TABLE_EXISTS_ERROR, my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
goto end; goto end;
} }
} }
@ -1275,8 +1250,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
error= FALSE; error= FALSE;
} }
else else
my_printf_error(ER_TABLE_EXISTS_ERROR, my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
goto end; goto end;
} }
} }
@ -1495,8 +1469,7 @@ mysql_rename_table(enum db_type base,
} }
delete file; delete file;
if (error) if (error)
my_printf_error(ER_ERROR_ON_RENAME, ER(ER_ERROR_ON_RENAME), my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
MYF(0), from, to, error);
DBUG_RETURN(error != 0); DBUG_RETURN(error != 0);
} }
@ -2048,8 +2021,7 @@ 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_printf_error(ER_UNKNOWN_KEY_CACHE, ER(ER_UNKNOWN_KEY_CACHE), MYF(0), my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
key_cache_name->str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
@ -2159,8 +2131,7 @@ 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_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0), my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table);
src_table);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -2179,8 +2150,7 @@ 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_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0), my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
src_table);
goto err; goto err;
} }
} }
@ -2263,8 +2233,7 @@ table_exists:
res= FALSE; res= FALSE;
} }
else else
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
table_name);
err: err:
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
@ -2523,8 +2492,7 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
} }
if (idx>= table->keys) if (idx>= table->keys)
{ {
my_printf_error(ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY), my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop_key->name);
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);
} }
@ -2647,8 +2615,7 @@ 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_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name_buff);
MYF(0), new_name_buff);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2660,8 +2627,7 @@ 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_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
MYF(0), new_alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2702,8 +2668,7 @@ 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_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name);
MYF(0), new_name);
error= -1; error= -1;
} }
else else
@ -2847,8 +2812,7 @@ 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_printf_error(ER_BLOB_CANT_HAVE_DEFAULT, my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
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
@ -2862,8 +2826,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
if (def->change && ! def->field) if (def->change && ! def->field)
{ {
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, table_name);
def->change, table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!def->after) if (!def->after)
@ -2881,8 +2844,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
if (!find) if (!find)
{ {
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), my_error(ER_BAD_FIELD_ERROR, MYF(0), def->after, table_name);
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
@ -2890,8 +2852,8 @@ 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_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0),
alter_info->alter_list.head()->name, table_name); alter_info->alter_list.head()->name, table_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!create_list.elements) if (!create_list.elements)
@ -2986,8 +2948,7 @@ 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_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX), my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
MYF(0), key->name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -2995,16 +2956,14 @@ 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_printf_error(ER_CANT_DROP_FIELD_OR_KEY, my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0), alter_info->drop_list.head()->name);
alter_info->drop_list.head()->name);
goto err; goto err;
} }
if (alter_info->alter_list.elements) if (alter_info->alter_list.elements)
{ {
my_printf_error(ER_CANT_DROP_FIELD_OR_KEY, my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0), alter_info->alter_list.head()->name);
alter_info->alter_list.head()->name);
goto err; goto err;
} }
@ -3207,8 +3166,7 @@ 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_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name_buff);
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,8 +74,7 @@ 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_printf_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias);
ER(ER_TRG_ON_VIEW_OR_TEMP_TABLE), MYF(0), tables->alias);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -418,8 +417,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_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0), my_error(ER_WRONG_OBJECT, MYF(0),
table_name, triggers_file_ext, "TRIGGER"); table_name, triggers_file_ext, "TRIGGER");
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View file

@ -384,15 +384,14 @@ int mysql_create_function(THD *thd,udf_func *udf)
} }
if (udf->name.length > NAME_LEN) if (udf->name.length > NAME_LEN)
{ {
my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0), my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name);
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_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0), udf->name); my_error(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 +400,7 @@ 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_printf_error(ER_CANT_OPEN_LIBRARY, ER(ER_CANT_OPEN_LIBRARY), MYF(0), my_error(ER_CANT_OPEN_LIBRARY, MYF(0),
udf->dl, errno, dlerror()); udf->dl, errno, dlerror());
goto err; goto err;
} }
@ -412,8 +411,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (udf->func == NULL) if (udf->func == NULL)
{ {
my_printf_error(ER_CANT_FIND_DL_ENTRY, ER(ER_CANT_FIND_DL_ENTRY), MYF(0), my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), udf->name);
udf->name);
goto err; goto err;
} }
udf->name.str=strdup_root(&mem,udf->name.str); udf->name.str=strdup_root(&mem,udf->name.str);
@ -447,8 +445,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
close_thread_tables(thd); close_thread_tables(thd);
if (error) if (error)
{ {
my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0), my_error(ER_ERROR_ON_WRITE, MYF(0), "func@mysql", error);
"func@mysql", error);
del_udf(u_d); del_udf(u_d);
goto err; goto err;
} }
@ -478,8 +475,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
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_printf_error(ER_FUNCTION_NOT_DEFINED, ER(ER_FUNCTION_NOT_DEFINED), my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
MYF(0), udf_name->str);
goto err; goto err;
} }
del_udf(udf); del_udf(udf);

View file

@ -38,15 +38,15 @@ static bool compare_record(TABLE *table, ulong query_id)
if (memcmp(table->null_flags, if (memcmp(table->null_flags,
table->null_flags+table->rec_buff_length, table->null_flags+table->rec_buff_length,
table->null_bytes)) table->null_bytes))
return 1; // Diff in NULL value return TRUE; // Diff in NULL value
/* Compare updated fields */ /* Compare updated fields */
for (Field **ptr=table->field ; *ptr ; ptr++) for (Field **ptr=table->field ; *ptr ; ptr++)
{ {
if ((*ptr)->query_id == query_id && if ((*ptr)->query_id == query_id &&
(*ptr)->cmp_binary_offset(table->rec_buff_length)) (*ptr)->cmp_binary_offset(table->rec_buff_length))
return 1; return TRUE;
} }
return 0; return FALSE;
} }
@ -73,8 +73,7 @@ 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_printf_error(ER_NONUPDATEABLE_COLUMN, ER(ER_NONUPDATEABLE_COLUMN), my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
MYF(0), item->name);
return TRUE; return TRUE;
} }
/* /*
@ -134,8 +133,8 @@ bool mysql_update(THD *thd,
table_list->grant.want_privilege : table_list->grant.want_privilege :
table->grant.want_privilege); table->grant.want_privilege);
#endif #endif
if ((error= mysql_prepare_update(thd, table_list, &conds, order_num, order))) if (mysql_prepare_update(thd, table_list, &conds, order_num, order))
DBUG_RETURN(error); DBUG_RETURN(TRUE);
old_used_keys= table->used_keys; // Keys used in WHERE old_used_keys= table->used_keys; // Keys used in WHERE
/* /*
@ -165,8 +164,7 @@ 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_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE), my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (table->timestamp_field) if (table->timestamp_field)
@ -532,8 +530,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
/* 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_global)) if (unique_table(table_list, table_list->next_global))
{ {
my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0), my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
table_list->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
select_lex->fix_prepare_information(thd, conds); select_lex->fix_prepare_information(thd, conds);
@ -591,7 +588,7 @@ bool mysql_multi_update_prepare(THD *thd)
/* open tables and create derived ones, but do not lock and fill them */ /* open tables and create derived ones, but do not lock and fill them */
if (open_tables(thd, table_list, & table_count) || if (open_tables(thd, table_list, & table_count) ||
mysql_handle_derived(lex, &mysql_derived_prepare)) mysql_handle_derived(lex, &mysql_derived_prepare))
DBUG_RETURN(thd->net.report_error ? -1 : 1); DBUG_RETURN(TRUE);
/* /*
Ensure that we have update privilege for all tables and columns in the Ensure that we have update privilege for all tables and columns in the
SET part SET part
@ -658,9 +655,7 @@ bool mysql_multi_update_prepare(THD *thd)
{ {
if (!tl->updatable || check_key_in_view(thd, tl)) if (!tl->updatable || check_key_in_view(thd, tl))
{ {
my_printf_error(ER_NON_UPDATABLE_TABLE, my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE");
ER(ER_NON_UPDATABLE_TABLE), MYF(0),
tl->alias, "UPDATE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -671,8 +666,7 @@ bool mysql_multi_update_prepare(THD *thd)
if (lex->select_lex.check_updateable_in_subqueries(tl->db, if (lex->select_lex.check_updateable_in_subqueries(tl->db,
tl->real_name)) tl->real_name))
{ {
my_printf_error(ER_UPDATE_TABLE_USED, my_error(ER_UPDATE_TABLE_USED, MYF(0), tl->real_name);
ER(ER_UPDATE_TABLE_USED), MYF(0), tl->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_PRINT("info",("setting table `%s` for update", tl->alias)); DBUG_PRINT("info",("setting table `%s` for update", tl->alias));
@ -727,7 +721,7 @@ bool mysql_multi_update_prepare(THD *thd)
} }
if (thd->fill_derived_tables() && if (thd->fill_derived_tables() &&
mysql_handle_derived(lex, &mysql_derived_filling)) mysql_handle_derived(lex, &mysql_derived_filling))
DBUG_RETURN(thd->net.report_error ? -1 : 1); DBUG_RETURN(TRUE);
DBUG_RETURN (FALSE); DBUG_RETURN (FALSE);
} }
@ -749,8 +743,8 @@ bool mysql_multi_update(THD *thd,
multi_update *result; multi_update *result;
DBUG_ENTER("mysql_multi_update"); DBUG_ENTER("mysql_multi_update");
if ((res= mysql_multi_update_prepare(thd))) if (mysql_multi_update_prepare(thd))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
if (!(result= new multi_update(thd, table_list, fields, values, if (!(result= new multi_update(thd, table_list, fields, values,
handle_duplicates))) handle_duplicates)))
@ -1021,7 +1015,7 @@ static bool safe_update_on_fly(JOIN_TAB *join_tab, List<Item> *fields)
case JT_SYSTEM: case JT_SYSTEM:
case JT_CONST: case JT_CONST:
case JT_EQ_REF: case JT_EQ_REF:
return 1; // At most one matching row return TRUE; // At most one matching row
case JT_REF: case JT_REF:
return !check_if_key_used(table, join_tab->ref.key, *fields); return !check_if_key_used(table, join_tab->ref.key, *fields);
case JT_ALL: case JT_ALL:
@ -1032,11 +1026,11 @@ static bool safe_update_on_fly(JOIN_TAB *join_tab, List<Item> *fields)
if ((table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && if ((table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
table->primary_key < MAX_KEY) table->primary_key < MAX_KEY)
return !check_if_key_used(table, table->primary_key, *fields); return !check_if_key_used(table, table->primary_key, *fields);
return 1; return TRUE;
default: default:
break; // Avoid compler warning break; // Avoid compler warning
} }
return 0; return FALSE;
} }
@ -1360,7 +1354,7 @@ bool multi_update::send_eof()
/* Safety: If we haven't got an error before (should not happen) */ /* Safety: If we haven't got an error before (should not happen) */
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update", my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
MYF(0)); MYF(0));
return 1; return TRUE;
} }
@ -1370,5 +1364,5 @@ bool multi_update::send_eof()
(thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated; (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
::send_ok(thd, (ulong) thd->row_count_func, ::send_ok(thd, (ulong) thd->row_count_func,
thd->insert_id_used ? thd->insert_id() : 0L,buff); thd->insert_id_used ? thd->insert_id() : 0L,buff);
return 0; return FALSE;
} }

View file

@ -113,13 +113,8 @@ bool mysql_create_view(THD *thd,
*/ */
if (check_some_access(thd, VIEW_ANY_ACL, tbl)) if (check_some_access(thd, VIEW_ANY_ACL, tbl))
{ {
my_printf_error(ER_TABLEACCESS_DENIED_ERROR, my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
ER(ER_TABLEACCESS_DENIED_ERROR), "ANY", thd->priv_user, thd->host_or_ip, tbl->real_name);
MYF(0),
"ANY",
thd->priv_user,
thd->host_or_ip,
tbl->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* /*
@ -190,8 +185,7 @@ 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_printf_error(ER_VIEW_SELECT_TMPTABLE, my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias);
ER(ER_VIEW_SELECT_TMPTABLE), MYF(0), tbl->alias);
res= TRUE; res= TRUE;
goto err; goto err;
} }
@ -201,8 +195,7 @@ 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_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0), my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str);
tbl->view_db.str, tbl->view_name.str);
res= TRUE; res= TRUE;
goto err; goto err;
} }
@ -257,8 +250,7 @@ bool mysql_create_view(THD *thd,
{ {
if (strcmp(item->name, check->name) == 0) if (strcmp(item->name, check->name) == 0)
{ {
my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME), my_error(ER_DUP_FIELDNAME, MYF(0), item->name);
MYF(0), item->name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -290,14 +282,9 @@ bool mysql_create_view(THD *thd,
if ((~fld->have_privileges & priv)) if ((~fld->have_privileges & priv))
{ {
/* VIEW column has more privileges */ /* VIEW column has more privileges */
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR, my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
ER(ER_COLUMNACCESS_DENIED_ERROR), "create view", thd->priv_user, thd->host_or_ip, item->name,
MYF(0), view->real_name);
"create view",
thd->priv_user,
thd->host_or_ip,
item->name,
view->real_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
@ -432,8 +419,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{ {
if (mode == VIEW_CREATE_NEW) if (mode == VIEW_CREATE_NEW)
{ {
my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), my_error(ER_TABLE_EXISTS_ERROR, MYF(0), view->alias);
MYF(0), view->alias);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -443,9 +429,8 @@ 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_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0), my_error(ER_WRONG_OBJECT, MYF(0),
(view->db ? view->db : thd->db), (view->db ? view->db : thd->db), view->real_name, "VIEW");
view->real_name, "VIEW");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -465,8 +450,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{ {
if (mode == VIEW_ALTER) if (mode == VIEW_ALTER)
{ {
my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0), my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias);
view->db, view->alias);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
@ -529,8 +513,7 @@ 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_printf_error(ER_VIEW_NONUPD_CHECK, ER(ER_VIEW_NONUPD_CHECK), MYF(0), my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->real_name);
view->db, view->real_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -880,11 +863,9 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
continue; continue;
} }
if (type) if (type)
my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0), my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->real_name, "VIEW");
view->db, view->real_name, "VIEW");
else else
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0), my_error(ER_BAD_TABLE_ERROR, MYF(0), name);
name);
goto err; goto err;
} }
if (my_delete(path, MYF(MY_WME))) if (my_delete(path, MYF(MY_WME)))

View file

@ -1467,8 +1467,7 @@ sp_fdparam:
if (spc->find_pvar(&$1, TRUE)) if (spc->find_pvar(&$1, TRUE))
{ {
my_printf_error(ER_SP_DUP_PARAM, ER(ER_SP_DUP_PARAM), MYF(0), my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
$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);
@ -1494,8 +1493,7 @@ sp_pdparam:
if (spc->find_pvar(&$2, TRUE)) if (spc->find_pvar(&$2, TRUE))
{ {
my_printf_error(ER_SP_DUP_PARAM, ER(ER_SP_DUP_PARAM), MYF(0), my_error(ER_SP_DUP_PARAM, MYF(0), $2.str);
$2.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$2, (enum enum_field_types)$3, spc->push_pvar(&$2, (enum enum_field_types)$3,
@ -1588,8 +1586,7 @@ sp_decl:
if (spc->find_cond(&$2, TRUE)) if (spc->find_cond(&$2, TRUE))
{ {
my_printf_error(ER_SP_DUP_COND, ER(ER_SP_DUP_COND), MYF(0), my_error(ER_SP_DUP_COND, MYF(0), $2.str);
$2.str);
YYABORT; YYABORT;
} }
YYTHD->lex->spcont->push_cond(&$2, $5); YYTHD->lex->spcont->push_cond(&$2, $5);
@ -1646,8 +1643,7 @@ sp_decl:
if (ctx->find_cursor(&$2, &offp, TRUE)) if (ctx->find_cursor(&$2, &offp, TRUE))
{ {
my_printf_error(ER_SP_DUP_CURS, ER(ER_SP_DUP_CURS), MYF(0), my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
$2.str);
delete $5; delete $5;
YYABORT; YYABORT;
} }
@ -1751,8 +1747,7 @@ sp_hcond:
$$= Lex->spcont->find_cond(&$1); $$= Lex->spcont->find_cond(&$1);
if ($$ == NULL) if ($$ == NULL)
{ {
my_printf_error(ER_SP_COND_MISMATCH, ER(ER_SP_COND_MISMATCH), my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -1781,8 +1776,7 @@ sp_decl_idents:
if (spc->find_pvar(&$1, TRUE)) if (spc->find_pvar(&$1, TRUE))
{ {
my_printf_error(ER_SP_DUP_VAR, ER(ER_SP_DUP_VAR), MYF(0), my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
$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);
@ -1795,8 +1789,7 @@ sp_decl_idents:
if (spc->find_pvar(&$3, TRUE)) if (spc->find_pvar(&$3, TRUE))
{ {
my_printf_error(ER_SP_DUP_VAR, ER(ER_SP_DUP_VAR), MYF(0), my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
$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);
@ -1950,9 +1943,7 @@ sp_proc_stmt:
if (! lab) if (! lab)
{ {
my_printf_error(ER_SP_LILABEL_MISMATCH, my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
ER(ER_SP_LILABEL_MISMATCH), MYF(0),
"LEAVE", $2.str);
YYABORT; YYABORT;
} }
else else
@ -1982,9 +1973,7 @@ sp_proc_stmt:
if (! lab || lab->type != SP_LAB_ITER) if (! lab || lab->type != SP_LAB_ITER)
{ {
my_printf_error(ER_SP_LILABEL_MISMATCH, my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
ER(ER_SP_LILABEL_MISMATCH), MYF(0),
"ITERATE", $2.str);
YYABORT; YYABORT;
} }
else else
@ -2012,8 +2001,7 @@ sp_proc_stmt:
if (lab) if (lab)
{ {
my_printf_error(ER_SP_LABEL_REDEFINE, my_error(ER_SP_LABEL_REDEFINE, MYF(0), $2.str);
ER(ER_SP_LABEL_REDEFINE), MYF(0), $2.str);
YYABORT; YYABORT;
} }
else else
@ -2088,8 +2076,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_printf_error(ER_SP_CURSOR_MISMATCH, my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
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);
@ -2104,8 +2091,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$3, &offset)) if (! lex->spcont->find_cursor(&$3, &offset))
{ {
my_printf_error(ER_SP_CURSOR_MISMATCH, my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
ER(ER_SP_CURSOR_MISMATCH), MYF(0), $3.str);
YYABORT; YYABORT;
} }
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
@ -2122,8 +2108,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_printf_error(ER_SP_CURSOR_MISMATCH, my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
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);
@ -2147,8 +2132,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$1))) if (!spc || !(spv = spc->find_pvar(&$1)))
{ {
my_printf_error(ER_SP_UNDECLARED_VAR, my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
ER(ER_SP_UNDECLARED_VAR), MYF(0), $1.str);
YYABORT; YYABORT;
} }
else else
@ -2170,8 +2154,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$3))) if (!spc || !(spv = spc->find_pvar(&$3)))
{ {
my_printf_error(ER_SP_UNDECLARED_VAR, my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
ER(ER_SP_UNDECLARED_VAR), MYF(0), $3.str);
YYABORT; YYABORT;
} }
else else
@ -2295,8 +2278,7 @@ sp_labeled_control:
if (lab) if (lab)
{ {
my_printf_error(ER_SP_LABEL_REDEFINE, my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
ER(ER_SP_LABEL_REDEFINE), MYF(0), $1.str);
YYABORT; YYABORT;
} }
else else
@ -2317,8 +2299,7 @@ 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_printf_error(ER_SP_LABEL_MISMATCH, my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
ER(ER_SP_LABEL_MISMATCH), MYF(0), $5.str);
YYABORT; YYABORT;
} }
} }
@ -2576,11 +2557,9 @@ 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_printf_error(ER_CONFLICTING_DECLARATIONS, my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
ER(ER_CONFLICTING_DECLARATIONS), MYF(0), "CHARACTER SET ", cinfo->default_table_charset->csname,
"CHARACTER SET ", "CHARACTER SET ", $4->csname);
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;
@ -2595,9 +2574,8 @@ 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_printf_error(ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0), $4->name, cinfo->default_table_charset->csname);
$4->name, cinfo->default_table_charset->csname);
YYABORT; YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
@ -2609,8 +2587,7 @@ 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_printf_error(ER_UNKNOWN_STORAGE_ENGINE, my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
ER(ER_UNKNOWN_STORAGE_ENGINE), MYF(0), $1.str);
YYABORT; YYABORT;
} }
}; };
@ -2807,10 +2784,8 @@ type:
Lex->uint_geom_type= (uint)$1; Lex->uint_geom_type= (uint)$1;
$$=FIELD_TYPE_GEOMETRY; $$=FIELD_TYPE_GEOMETRY;
#else #else
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0)
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
} }
@ -2977,9 +2952,8 @@ attribute:
{ {
if (Lex->charset && !my_charset_same(Lex->charset,$2)) if (Lex->charset && !my_charset_same(Lex->charset,$2))
{ {
my_printf_error(ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0), $2->name,Lex->charset->csname);
$2->name,Lex->charset->csname);
YYABORT; YYABORT;
} }
else else
@ -3004,8 +2978,7 @@ 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_printf_error(ER_UNKNOWN_CHARACTER_SET, my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
ER(ER_UNKNOWN_CHARACTER_SET), MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -3023,8 +2996,7 @@ 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_printf_error(ER_UNKNOWN_CHARACTER_SET, my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
ER(ER_UNKNOWN_CHARACTER_SET), MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -3040,8 +3012,7 @@ collation_name:
{ {
if (!($$=get_charset_by_name($1.str,MYF(0)))) if (!($$=get_charset_by_name($1.str,MYF(0))))
{ {
my_printf_error(ER_UNKNOWN_COLLATION, my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
ER(ER_UNKNOWN_COLLATION), MYF(0), $1.str);
YYABORT; YYABORT;
} }
}; };
@ -3130,9 +3101,8 @@ key_type:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= Key::SPATIAL; $$= Key::SPATIAL;
#else #else
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
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
}; };
@ -3195,9 +3165,7 @@ key_part:
int key_part_len= atoi($3.str); int key_part_len= atoi($3.str);
if (!key_part_len) if (!key_part_len)
{ {
my_printf_error(ER_UNKNOWN_ERROR, my_error(ER_KEY_PART_0, MYF(0), $1.str);
"Key part '%s' length cannot be 0",
MYF(0), $1.str);
} }
$$=new key_part_spec($1.str,(uint) key_part_len); $$=new key_part_spec($1.str,(uint) key_part_len);
}; };
@ -3406,8 +3374,7 @@ 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_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
MYF(0), $3->table.str);
YYABORT; YYABORT;
} }
lex->alter_info.flags|= ALTER_RENAME; lex->alter_info.flags|= ALTER_RENAME;
@ -3422,9 +3389,8 @@ alter_list_item:
$5= $5 ? $5 : $4; $5= $5 ? $5 : $4;
if (!my_charset_same($4,$5)) if (!my_charset_same($4,$5))
{ {
my_printf_error(ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0), $5->name, $4->csname);
$5->name, $4->csname);
YYABORT; YYABORT;
} }
LEX *lex= Lex; LEX *lex= Lex;
@ -4269,10 +4235,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
ER(ER_FEATURE_DISABLED), MYF(0), $1.symbol->group->name,
$1.symbol->group->name, $1.symbol->group->needed_define);
$1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(void))($1.symbol->create_func))(); $$= ((Item*(*)(void))($1.symbol->create_func))();
@ -4281,10 +4246,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
ER(ER_FEATURE_DISABLED), MYF(0), $1.symbol->group->name,
$1.symbol->group->name, $1.symbol->group->needed_define);
$1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*))($1.symbol->create_func))($3); $$= ((Item*(*)(Item*))($1.symbol->create_func))($3);
@ -4293,10 +4257,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
ER(ER_FEATURE_DISABLED), MYF(0), $1.symbol->group->name,
$1.symbol->group->name, $1.symbol->group->needed_define);
$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);
@ -4305,10 +4268,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
ER(ER_FEATURE_DISABLED), MYF(0), $1.symbol->group->name,
$1.symbol->group->name, $1.symbol->group->needed_define);
$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);
@ -4411,9 +4373,8 @@ simple_expr:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= $1; $$= $1;
#else #else
my_printf_error(ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
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
} }
@ -5469,8 +5430,7 @@ select_var_ident:
if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1))) if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1)))
{ {
my_printf_error(ER_SP_UNDECLARED_VAR, my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
ER(ER_SP_UNDECLARED_VAR), MYF(0), $1.str);
YYABORT; YYABORT;
} }
if (! lex->result) if (! lex->result)
@ -5826,9 +5786,8 @@ 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_printf_error(ER_NON_UPDATABLE_TABLE, my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
ER(ER_NON_UPDATABLE_TABLE), MYF(0), lex->select_lex.get_table_list()->alias, "UPDATE");
lex->select_lex.get_table_list()->alias, "UPDATE");
YYABORT; YYABORT;
} }
else else
@ -6686,9 +6645,8 @@ 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_printf_error(ER_BAD_FIELD_ERROR, my_error(ER_BAD_FIELD_ERROR, MYF(0),
ER(ER_BAD_FIELD_ERROR), MYF(0), $3.str, new_row ? "NEW": "OLD");
$3.str, new_row ? "NEW": "OLD");
YYABORT; YYABORT;
} }
@ -6699,9 +6657,8 @@ simple_ident_q:
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed) if (sel->no_table_names_allowed)
{ {
my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
ER(ER_TABLENAME_NOT_ALLOWED_HERE), MYF(0), $1.str, thd->where);
MYF(0), $1.str, thd->where);
} }
$$= (sel->parsing_place != IN_HAVING || $$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ? sel->get_in_sum_expr() > 0) ?
@ -6716,9 +6673,8 @@ simple_ident_q:
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed) if (sel->no_table_names_allowed)
{ {
my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
ER(ER_TABLENAME_NOT_ALLOWED_HERE), MYF(0), $2.str, thd->where);
MYF(0), $2.str, thd->where);
} }
$$= (sel->parsing_place != IN_HAVING || $$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ? sel->get_in_sum_expr() > 0) ?
@ -6732,9 +6688,8 @@ simple_ident_q:
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed) if (sel->no_table_names_allowed)
{ {
my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
ER(ER_TABLENAME_NOT_ALLOWED_HERE), MYF(0), $3.str, thd->where);
MYF(0), $3.str, thd->where);
} }
$$= (sel->parsing_place != IN_HAVING || $$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ? sel->get_in_sum_expr() > 0) ?
@ -6775,9 +6730,8 @@ IDENT_sys:
$1.length); $1.length);
if (wlen < $1.length) if (wlen < $1.length)
{ {
my_printf_error(ER_INVALID_CHARACTER_STRING, my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
ER(ER_INVALID_CHARACTER_STRING), MYF(0), cs->csname, $1.str + wlen);
cs->csname, $1.str + wlen);
YYABORT; YYABORT;
} }
$$= $1; $$= $1;
@ -7214,8 +7168,7 @@ option_value:
Error message also should be improved. Error message also should be improved.
*/ */
my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), my_error(ER_BAD_FIELD_ERROR, MYF(0), $1.base_name, "NEW");
MYF(0), $1.base_name, "NEW");
YYABORT; YYABORT;
} }
lex->sphead->add_instr(i); lex->sphead->add_instr(i);
@ -7281,9 +7234,8 @@ option_value:
$3= $3 ? $3 : $2; $3= $3 ? $3 : $2;
if (!my_charset_same($2,$3)) if (!my_charset_same($2,$3))
{ {
my_printf_error(ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0), $3->name, $2->csname);
$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));
@ -7373,8 +7325,7 @@ internal_variable_name:
if (!tmp) if (!tmp)
YYABORT; YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
my_printf_error(ER_VARIABLE_IS_NOT_STRUCT, my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
ER(ER_VARIABLE_IS_NOT_STRUCT), MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
$$.base_name= $1; $$.base_name= $1;
} }
@ -7385,8 +7336,7 @@ internal_variable_name:
if (!tmp) if (!tmp)
YYABORT; YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
my_printf_error(ER_VARIABLE_IS_NOT_STRUCT, my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
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;

View file

@ -984,12 +984,11 @@ 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_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0), my_error(ER_NO_SUCH_TABLE, MYF(0), db, form->real_name);
db, form->real_name);
} }
else else
my_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), errortype, my_error(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:
{ {
@ -997,15 +996,14 @@ 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_printf_error(err_no, ER(err_no), errortype, my_error(err_no, errortype,
fn_format(buff, form->real_name, form_dev, datext, 2), fn_format(buff, form->real_name, form_dev, datext, 2), my_errno);
my_errno);
break; break;
} }
default: /* Better wrong error than none */ default: /* Better wrong error than none */
case 4: case 4:
my_printf_error(ER_NOT_FORM_FILE, ER(ER_NOT_FORM_FILE), errortype, my_error(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;
@ -1728,8 +1726,7 @@ 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_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0), my_error(ER_VIEW_INVALID, MYF(0), view_db.str, view_name.str);
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;
@ -1783,8 +1780,7 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
} }
else else
{ {
my_printf_error(ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), MYF(0), my_error(ER_VIEW_CHECK_FAILED, MYF(0), view_db.str, view_name.str);
view_db.str, view_name.str);
return(VIEW_CHECK_ERROR); return(VIEW_CHECK_ERROR);
} }
} }

View file

@ -52,15 +52,30 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
if (*fmt == '-') if (*fmt == '-')
fmt++; fmt++;
length= width= pre_zero= have_long= 0; length= width= pre_zero= have_long= 0;
for (;my_isdigit(&my_charset_latin1,*fmt); fmt++) if (*fmt == '*')
{ {
length=length*10+ (uint) (*fmt-'0'); fmt++;
if (!length) length= va_arg(ap, int);
pre_zero= 1; /* first digit was 0 */
} }
else
for (; my_isdigit(&my_charset_latin1, *fmt); fmt++)
{
length= length * 10 + (uint)(*fmt - '0');
if (!length)
pre_zero= 1; /* first digit was 0 */
}
if (*fmt == '.') if (*fmt == '.')
for (fmt++;my_isdigit(&my_charset_latin1,*fmt); fmt++) {
width=width*10+ (uint) (*fmt-'0'); fmt++;
if (*fmt == '*')
{
fmt++;
width= va_arg(ap, int);
}
else
for (; my_isdigit(&my_charset_latin1, *fmt); fmt++)
width= width * 10 + (uint)(*fmt - '0');
}
else else
width= ~0; width= ~0;
if (*fmt == 'l') if (*fmt == 'l')