summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-11-13 19:35:51 +0200
committerunknown <bell@sanja.is.com.ua>2004-11-13 19:35:51 +0200
commit8d71bcec217bead7d832d6ea4dca437c5f134577 (patch)
treea534689811d0f65eba423eed77b056f3bb30bd51
parent067863e184e9a23034d410919d4c8075ee30bcee (diff)
downloadmariadb-git-8d71bcec217bead7d832d6ea4dca437c5f134577.tar.gz
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 include/mysqld_error.h: newerror messages mysql-test/t/key.test: unknown error replaced with real error mysys/my_error.c: my_error & my_printf_error use my_vsprintf sql/field_conv.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/ha_innodb.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/handler.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/item.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/item_cmpfunc.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/item_func.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/item_strfunc.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/lock.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/log.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/parse_file.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/procedure.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/protocol.cc: no need reset thd->lex->found_colon to break multiline sequance now, send_error called too late sql/repl_failsafe.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/set_var.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/share/czech/errmsg.txt: new errors converted from unknown error sql/share/danish/errmsg.txt: new errors converted from unknown error sql/share/dutch/errmsg.txt: new errors converted from unknown error sql/share/english/errmsg.txt: new errors converted from unknown error sql/share/estonian/errmsg.txt: new errors converted from unknown error sql/share/french/errmsg.txt: new errors converted from unknown error sql/share/german/errmsg.txt: new errors converted from unknown error sql/share/greek/errmsg.txt: new errors converted from unknown error sql/share/hungarian/errmsg.txt: new errors converted from unknown error sql/share/italian/errmsg.txt: new errors converted from unknown error sql/share/japanese/errmsg.txt: new errors converted from unknown error sql/share/korean/errmsg.txt: new errors converted from unknown error sql/share/norwegian-ny/errmsg.txt: new errors converted from unknown error sql/share/norwegian/errmsg.txt: new errors converted from unknown error sql/share/polish/errmsg.txt: new errors converted from unknown error sql/share/portuguese/errmsg.txt: new errors converted from unknown error sql/share/romanian/errmsg.txt: new errors converted from unknown error sql/share/russian/errmsg.txt: new errors converted from unknown error sql/share/serbian/errmsg.txt: new errors converted from unknown error sql/share/slovak/errmsg.txt: new errors converted from unknown error sql/share/spanish/errmsg.txt: new errors converted from unknown error sql/share/swedish/errmsg.txt: new errors converted from unknown error sql/share/ukrainian/errmsg.txt: new errors converted from unknown error sql/slave.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sp.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sp_head.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_acl.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_analyse.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_base.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_class.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_db.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_delete.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_handler.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_insert.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_load.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_map.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_parse.cc: now my_printf_error is not better then my_error, but my_error call is shorter multi-row command fixed sql/sql_prepare.cc: now my_printf_error is not better then my_error, but my_error call is shorter remover send_error ingected from 4.1 sql/sql_rename.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_repl.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_select.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_show.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_table.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_trigger.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_udf.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_update.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_view.cc: now my_printf_error is not better then my_error, but my_error call is shorter sql/sql_yacc.yy: now my_printf_error is not better then my_error, but my_error call is shorter sql/table.cc: now my_printf_error is not better then my_error, but my_error call is shorter strings/my_vsnprintf.c: * format support added to my_vsprint
-rw-r--r--include/mysqld_error.h4
-rw-r--r--mysql-test/t/key.test2
-rw-r--r--mysys/my_error.c117
-rw-r--r--sql/field_conv.cc6
-rw-r--r--sql/ha_innodb.cc9
-rw-r--r--sql/handler.cc19
-rw-r--r--sql/item.cc58
-rw-r--r--sql/item_cmpfunc.cc11
-rw-r--r--sql/item_func.cc49
-rw-r--r--sql/item_strfunc.cc17
-rw-r--r--sql/lock.cc3
-rw-r--r--sql/log.cc3
-rw-r--r--sql/parse_file.cc38
-rw-r--r--sql/procedure.cc3
-rw-r--r--sql/protocol.cc1
-rw-r--r--sql/repl_failsafe.cc22
-rw-r--r--sql/set_var.cc57
-rw-r--r--sql/share/czech/errmsg.txt2
-rw-r--r--sql/share/danish/errmsg.txt2
-rw-r--r--sql/share/dutch/errmsg.txt2
-rw-r--r--sql/share/english/errmsg.txt2
-rw-r--r--sql/share/estonian/errmsg.txt2
-rw-r--r--sql/share/french/errmsg.txt2
-rw-r--r--sql/share/german/errmsg.txt2
-rw-r--r--sql/share/greek/errmsg.txt2
-rw-r--r--sql/share/hungarian/errmsg.txt2
-rw-r--r--sql/share/italian/errmsg.txt2
-rw-r--r--sql/share/japanese/errmsg.txt2
-rw-r--r--sql/share/korean/errmsg.txt2
-rw-r--r--sql/share/norwegian-ny/errmsg.txt2
-rw-r--r--sql/share/norwegian/errmsg.txt2
-rw-r--r--sql/share/polish/errmsg.txt2
-rw-r--r--sql/share/portuguese/errmsg.txt2
-rw-r--r--sql/share/romanian/errmsg.txt2
-rw-r--r--sql/share/russian/errmsg.txt2
-rw-r--r--sql/share/serbian/errmsg.txt2
-rw-r--r--sql/share/slovak/errmsg.txt2
-rw-r--r--sql/share/spanish/errmsg.txt2
-rw-r--r--sql/share/swedish/errmsg.txt2
-rw-r--r--sql/share/ukrainian/errmsg.txt2
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sp.cc16
-rw-r--r--sql/sp_head.cc14
-rw-r--r--sql/sql_acl.cc87
-rw-r--r--sql/sql_analyse.cc15
-rw-r--r--sql/sql_base.cc81
-rw-r--r--sql/sql_class.cc10
-rw-r--r--sql/sql_db.cc29
-rw-r--r--sql/sql_delete.cc18
-rw-r--r--sql/sql_handler.cc30
-rw-r--r--sql/sql_insert.cc37
-rw-r--r--sql/sql_load.cc9
-rw-r--r--sql/sql_map.cc8
-rw-r--r--sql/sql_parse.cc198
-rw-r--r--sql/sql_prepare.cc26
-rw-r--r--sql/sql_rename.cc6
-rw-r--r--sql/sql_repl.cc12
-rw-r--r--sql/sql_select.cc13
-rw-r--r--sql/sql_show.cc13
-rw-r--r--sql/sql_table.cc144
-rw-r--r--sql/sql_trigger.cc7
-rw-r--r--sql/sql_udf.cc16
-rw-r--r--sql/sql_update.cc44
-rw-r--r--sql/sql_view.cc49
-rw-r--r--sql/sql_yacc.yy186
-rw-r--r--sql/table.cc22
-rw-r--r--strings/my_vsnprintf.c27
67 files changed, 617 insertions, 973 deletions
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index f98bb4cb75c..4ef23f446c9 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -406,4 +406,6 @@
#define ER_LOGING_PROHIBIT_CHANGING_OF 1387
#define ER_NO_FILE_MAPPING 1388
#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
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 8885f69e60c..0a86c1cd145 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -299,5 +299,5 @@ drop table t1;
# create dedicated error code for this and
# and change my_printf_error() to my_error
---error 1105
+--error 1391
create table t1 (c char(10), index (c(0)));
diff --git a/mysys/my_error.c b/mysys/my_error.c
index 75aa84efca0..175f8cf516b 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -26,12 +26,9 @@
WARNING!
my_error family functions have to be used according following rules:
- if message have not parameters use my_message(ER_CODE, ER(ER_CODE), MYF(N))
- - if message have only integer parameters, string constants (created
- inside program) or string put (and cut if it is need) in some limited
- length buffer before passing it as parameter then you can use
- my_error(ER_CODE, MYF(N), ...). Never pass string get from user to
- my_error.
- - in all other cases use my_printf_error(ER_CODE, ER(ER_CODE), MYF(N), ...)
+ - if message registered use my_error(ER_CODE, MYF(N), ...).
+ - With some special text of errror message use:
+ my_printf_error(ER_CODE, format, MYF(N), ...)
*/
const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0};
@@ -53,107 +50,22 @@ char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
the length value is ignored.
*/
-int my_error(int nr,myf MyFlags, ...)
+int my_error(int nr, myf MyFlags, ...)
{
- va_list ap;
- uint olen, plen;
- reg1 const char *tpos;
- reg2 char *endpos;
- char * par;
- char ebuff[ERRMSGSIZE+20];
- int prec_chars; /* output precision */
- my_bool prec_supplied;
+ const char *format;
+ va_list args;
+ char ebuff[ERRMSGSIZE + 20];
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));
if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
init_glob_errs();
+ format= my_errmsg[nr / ERRMOD][nr % ERRMOD];
- olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD]);
- endpos=ebuff;
-
- 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);
+ va_start(args,MyFlags);
+ (void) my_vsnprintf (ebuff, sizeof(ebuff), format, args);
+ va_end(args);
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;
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);
- (void) vsprintf (ebuff,format,args);
+ (void) my_vsnprintf (ebuff, sizeof(ebuff), format, args);
va_end(args);
- return (*error_handler_hook)(error, ebuff, MyFlags);
+ DBUG_RETURN((*error_handler_hook)(error, ebuff, MyFlags));
}
/*
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 61a5a28f47b..336408c5aa9 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -126,8 +126,7 @@ set_field_to_null(Field *field)
return 0;
}
if (!current_thd->no_errors)
- my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
- field->field_name);
+ my_error(ER_BAD_NULL_ERROR, MYF(0), field->field_name);
return -1;
}
@@ -185,8 +184,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
return 0;
}
if (!current_thd->no_errors)
- my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
- field->field_name);
+ my_error(ER_BAD_NULL_ERROR, MYF(0), field->field_name);
return -1;
}
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 34fc4873d43..88af43f8410 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -495,11 +495,10 @@ innobase_mysql_tmpfile(void)
if (fd2 < 0) {
DBUG_PRINT("error",("Got error %d on dup",fd2));
my_errno=errno;
- my_printf_error(EE_OUT_OF_FILERESOURCES,
- ER(EE_OUT_OF_FILERESOURCES),
- MYF(ME_BELL+ME_WAITTANG),
- filename, my_errno);
- }
+ my_error(EE_OUT_OF_FILERESOURCES,
+ MYF(ME_BELL+ME_WAITTANG),
+ filename, my_errno);
+ }
my_close(fd, MYF(MY_WME));
}
return(fd2);
diff --git a/sql/handler.cc b/sql/handler.cc
index 8b6458d3662..e65fd6d097d 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1200,8 +1200,7 @@ void handler::print_error(int error, myf errflag)
str.length(max_length-4);
str.append("...");
}
- my_printf_error(ER_DUP_ENTRY, ER(ER_DUP_ENTRY), MYF(0),
- str.c_ptr(), key_nr+1);
+ my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), key_nr+1);
DBUG_VOID_RETURN;
}
textno=ER_DUP_KEY;
@@ -1270,7 +1269,7 @@ void handler::print_error(int error, myf errflag)
uint length=dirname_part(buff,table->path);
buff[length-1]=0;
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;
}
default:
@@ -1284,20 +1283,16 @@ void handler::print_error(int error, myf errflag)
{
const char* engine= table_type();
if (temporary)
- my_printf_error(ER_GET_TEMPORARY_ERRMSG,
- ER(ER_GET_TEMPORARY_ERRMSG), MYF(0),
- error, str.ptr(), engine);
+ my_error(ER_GET_TEMPORARY_ERRMSG, MYF(0), error, str.ptr(), engine);
else
- my_printf_error(ER_GET_ERRMSG,
- ER(ER_GET_ERRMSG), MYF(0),
- error, str.ptr(), engine);
+ my_error(ER_GET_ERRMSG, MYF(0), error, str.ptr(), engine);
}
else
my_error(ER_GET_ERRNO,errflag,error);
DBUG_VOID_RETURN;
}
}
- my_error(textno,errflag,table->table_name,error);
+ my_error(textno, errflag, table->table_name, error);
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);
VOID(closefrm(&table));
if (error)
- my_printf_error(ER_CANT_CREATE_TABLE, ER(ER_CANT_CREATE_TABLE),
- MYF(ME_BELL+ME_WAITTANG),
- name,error);
+ my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name,error);
DBUG_RETURN(error != 0);
}
diff --git a/sql/item.cc b/sql/item.cc
index f37224c6bf5..42e1f23babd 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -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
is ambiguous.
*/
- my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR),
- MYF(0), find_item->full_name(), current_thd->where);
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ find_item->full_name(), current_thd->where);
return NULL;
}
}
@@ -1713,8 +1713,8 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
DBUG_ASSERT(*select_ref);
if (! (*select_ref)->fixed)
{
- my_error(ER_ILLEGAL_REFERENCE, MYF(0), ref->name,
- "forward reference in item list");
+ my_error(ER_ILLEGAL_REFERENCE, MYF(0),
+ ref->name, "forward reference in item list");
return NULL;
}
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)
{
// We can't say exactly what absent table or field
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- full_name(), thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), full_name(), thd->where);
}
else
{
@@ -1988,14 +1987,9 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
db, tab, field_name) &
VIEW_ANY_ACL)))
{
- my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
- ER(ER_COLUMNACCESS_DENIED_ERROR),
- MYF(0),
- "ANY",
- thd->priv_user,
- thd->host_or_ip,
- field_name,
- tab);
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
+ "ANY", thd->priv_user, thd->host_or_ip,
+ field_name, tab);
return TRUE;
}
}
@@ -2455,8 +2449,7 @@ Item_real::Item_real(const char *str_arg, uint length)
when we are in the parser
*/
DBUG_ASSERT(str_arg[length] == 0);
- my_printf_error(ER_ILLEGAL_VALUE_FOR_TYPE, ER(ER_ILLEGAL_VALUE_FOR_TYPE),
- MYF(0), "double", (char*) str_arg);
+ my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", (char*) str_arg);
}
presentation= name=(char*) 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;
if (ref == not_found_item && from_field == not_found_field)
{
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- this->full_name(), current_thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0),
+ this->full_name(), current_thd->where);
ref= 0; // Safety
return TRUE;
}
@@ -2889,8 +2882,8 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
else
{
/* The current reference cannot be resolved in this query. */
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- this->full_name(), current_thd->where);
+ my_error(ER_BAD_FIELD_ERROR,MYF(0),
+ this->full_name(), current_thd->where);
return TRUE;
}
}
@@ -2907,11 +2900,10 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
current_sel->having_fix_field))) ||
!(*ref)->fixed)
{
- my_printf_error(ER_ILLEGAL_REFERENCE, ER(ER_ILLEGAL_REFERENCE), MYF(0),
- name,
- ((*ref)->with_sum_func?
- "reference to group function":
- "forward reference in item list"));
+ my_error(ER_ILLEGAL_REFERENCE, MYF(0),
+ name, ((*ref)->with_sum_func?
+ "reference to group function":
+ "forward reference in item list"));
return TRUE;
}
max_length= (*ref)->max_length;
@@ -2932,8 +2924,6 @@ void Item_ref::cleanup()
DBUG_ENTER("Item_ref::cleanup");
Item_ident::cleanup();
result_field= 0;
- if (hook_ptr)
- *hook_ptr= orig_item;
DBUG_VOID_RETURN;
}
@@ -3046,8 +3036,7 @@ bool Item_default_value::fix_fields(THD *thd,
field_arg= (Item_field *)arg;
if (field_arg->field->flags & NO_DEFAULT_VALUE_FLAG)
{
- my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD),
- MYF(0), field_arg->field->field_name);
+ my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), field_arg->field->field_name);
return TRUE;
}
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();
if (item_type == STRING_RESULT && collation.aggregate(item->collation))
{
- my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
- ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
- old_cs, old_derivation,
- item->collation.collation->name,
- item->collation.derivation_name(),
- "UNION");
+ my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
+ old_cs, old_derivation,
+ item->collation.collation->name,
+ item->collation.derivation_name(),
+ "UNION");
return 1;
}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 63d20b2dab3..4a4485ba2da 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -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)
{
- my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
- ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
- c1.collation->name,c1.derivation_name(),
- c2.collation->name,c2.derivation_name(),
- fname);
+ my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
+ c1.collation->name,c1.derivation_name(),
+ c2.collation->name,c2.derivation_name(),
+ fname);
}
@@ -2437,7 +2436,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
cmp_collation.collation)))
{
(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;
}
regex_compiled=regex_is_const=1;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 65e1cceb5bb..8d4ad54b511 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -45,11 +45,10 @@ bool check_reserved_words(LEX_STRING *name)
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
- my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
- ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
- c1.collation->name, c1.derivation_name(),
- c2.collation->name, c2.derivation_name(),
- fname);
+ my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
+ c1.collation->name, c1.derivation_name(),
+ c2.collation->name, c2.derivation_name(),
+ fname);
}
static void my_coll_agg_error(DTCollation &c1,
@@ -57,12 +56,11 @@ static void my_coll_agg_error(DTCollation &c1,
DTCollation &c3,
const char *fname)
{
- my_printf_error(ER_CANT_AGGREGATE_3COLLATIONS,
- ER(ER_CANT_AGGREGATE_3COLLATIONS), MYF(0),
- c1.collation->name, c1.derivation_name(),
- c2.collation->name, c2.derivation_name(),
- c3.collation->name, c3.derivation_name(),
- fname);
+ my_error(ER_CANT_AGGREGATE_3COLLATIONS, MYF(0),
+ c1.collation->name, c1.derivation_name(),
+ c2.collation->name, c2.derivation_name(),
+ c3.collation->name, c3.derivation_name(),
+ fname);
}
@@ -76,8 +74,7 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname)
args[2]->collation,
fname);
else
- my_printf_error(ER_CANT_AGGREGATE_NCOLLATIONS,
- ER(ER_CANT_AGGREGATE_NCOLLATIONS), MYF(0),fname);
+ my_error(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)
{
- my_printf_error(ER_CANT_FIND_UDF,ER(ER_CANT_FIND_UDF),MYF(0),u_d->name.str,
- errno);
+ my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str, errno);
DBUG_RETURN(TRUE);
}
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;
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),
- u_d->name.str, thd->net.last_error);
+ my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
+ u_d->name.str, thd->net.last_error);
free_udf(u_d);
DBUG_RETURN(TRUE);
}
@@ -1851,8 +1847,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
initialized=1;
if (error)
{
- my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
- u_d->name.str, ER(ER_UNKNOWN_ERROR));
+ my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
+ u_d->name.str, ER(ER_UNKNOWN_ERROR));
DBUG_RETURN(TRUE);
}
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())
{
- my_printf_error(ER_VARIABLE_IS_NOT_STRUCT, ER(ER_VARIABLE_IS_NOT_STRUCT),
- MYF(0), base_name->str);
+ my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), base_name->str);
return 0;
}
}
@@ -3544,8 +3539,7 @@ Item_func_sp::execute(Item **itp)
m_sp= sp_find_function(thd, m_name);
if (! m_sp)
{
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- "FUNCTION", m_name->m_qname);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
DBUG_RETURN(-1);
}
@@ -3579,8 +3573,7 @@ Item_func_sp::field_type() const
DBUG_PRINT("info", ("m_returns = %d", 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),
- "FUNCTION", m_name->m_qname);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
DBUG_RETURN(MYSQL_TYPE_STRING);
}
@@ -3596,8 +3589,7 @@ Item_func_sp::result_type() const
{
DBUG_RETURN(m_sp->result());
}
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- "FUNCTION", m_name->m_qname);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
DBUG_RETURN(STRING_RESULT);
}
@@ -3610,8 +3602,7 @@ Item_func_sp::fix_length_and_dec()
m_sp= sp_find_function(current_thd, m_name);
if (! m_sp)
{
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- "FUNCTION", m_name->m_qname);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname);
}
else
{
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b3ba0b4a4f3..891cf48f7ca 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -42,11 +42,10 @@ String my_empty_string("",default_charset_info);
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
- my_printf_error(ER_CANT_AGGREGATE_2COLLATIONS,
- ER(ER_CANT_AGGREGATE_2COLLATIONS), MYF(0),
- c1.collation->name, c1.derivation_name(),
- c2.collation->name, c2.derivation_name(),
- fname);
+ my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
+ c1.collation->name, c1.derivation_name(),
+ c2.collation->name, c2.derivation_name(),
+ fname);
}
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))))
{
- my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
- colname);
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
return;
}
}
@@ -2228,9 +2226,8 @@ void Item_func_set_collation::fix_length_and_dec()
if (!set_collation ||
!my_charset_same(args[0]->collation.collation,set_collation))
{
- my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
- ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
- colname, args[0]->collation.collation->csname);
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ colname, args[0]->collation.collation->csname);
return;
}
collation.set(set_collation, DERIVATION_EXPLICIT);
diff --git a/sql/lock.cc b/sql/lock.cc
index 76b85946a4a..c4f1d681b76 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -430,8 +430,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*write_lock_used=table;
if (table->db_stat & HA_READ_ONLY)
{
- my_printf_error(ER_OPEN_AS_READONLY, ER(ER_OPEN_AS_READONLY), MYF(0),
- table->table_name);
+ my_error(ER_OPEN_AS_READONLY, MYF(0), table->table_name);
my_free((gptr) sql_lock,MYF(0));
return 0;
}
diff --git a/sql/log.cc b/sql/log.cc
index 7f273247c6f..8f7e15d0db8 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1517,8 +1517,7 @@ err:
if (my_errno == EFBIG)
my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(0));
else
- my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
- name, errno);
+ my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno);
write_error=1;
}
if (file == &log_file)
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index 91b29ce9b61..6c3a81384a6 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -350,8 +350,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
if (stat_info.st_size > INT_MAX-1)
{
- my_printf_error(ER_FPARSER_TOO_BIG_FILE,
- ER(ER_FPARSER_TOO_BIG_FILE), MYF(0), file_name->str);
+ my_error(ER_FPARSER_TOO_BIG_FILE, MYF(0), file_name->str);
DBUG_RETURN(0);
}
@@ -413,8 +412,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
frm_error:
if (bad_format_errors)
{
- my_printf_error(ER_FPARSER_BAD_HEADER, ER(ER_FPARSER_BAD_HEADER), MYF(0),
- file_name->str);
+ my_error(ER_FPARSER_BAD_HEADER, MYF(0), file_name->str);
DBUG_RETURN(0);
}
else
@@ -627,8 +625,7 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
// it is comment
if (!(ptr= strchr(ptr, '\n')))
{
- my_printf_error(ER_FPARSER_EOF_IN_COMMENT,
- ER(ER_FPARSER_EOF_IN_COMMENT), MYF(0), line);
+ my_error(ER_FPARSER_EOF_IN_COMMENT, MYF(0), line);
DBUG_RETURN(TRUE);
}
ptr++;
@@ -670,9 +667,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
(LEX_STRING *)(base +
parameter->offset))))
{
- my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
- ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
- parameter->name.str, line);
+ my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
+ parameter->name.str, line);
DBUG_RETURN(TRUE);
}
break;
@@ -683,9 +679,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
(LEX_STRING *)
(base + parameter->offset))))
{
- my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
- ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
- parameter->name.str, line);
+ my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
+ parameter->name.str, line);
DBUG_RETURN(TRUE);
}
break;
@@ -694,9 +689,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
case FILE_OPTIONS_REV:
if (!(eol= strchr(ptr, '\n')))
{
- my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
- ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
- parameter->name.str, line);
+ my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
+ parameter->name.str, line);
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 */
if (ptr[PARSE_FILE_TIMESTAMPLENGTH] != '\n')
{
- my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
- ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
- parameter->name.str, line);
+ my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
+ parameter->name.str, line);
DBUG_RETURN(TRUE);
}
memcpy(val->str, ptr, PARSE_FILE_TIMESTAMPLENGTH);
@@ -754,9 +747,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
break;
list_err_w_message:
- my_printf_error(ER_FPARSER_ERROR_IN_PARAMETER,
- ER(ER_FPARSER_ERROR_IN_PARAMETER), MYF(0),
- parameter->name.str, line);
+ my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
+ parameter->name.str, line);
list_err:
DBUG_RETURN(TRUE);
}
@@ -769,9 +761,7 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
// skip unknown parameter
if (!(ptr= strchr(ptr, '\n')))
{
- my_printf_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER,
- ER(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER), MYF(0),
- line);
+ my_error(ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER, MYF(0), line);
DBUG_RETURN(TRUE);
}
ptr++;
diff --git a/sql/procedure.cc b/sql/procedure.cc
index 7779f5ce085..420a4f6262b 100644
--- a/sql/procedure.cc
+++ b/sql/procedure.cc
@@ -65,8 +65,7 @@ setup_procedure(THD *thd,ORDER *param,select_result *result,
DBUG_RETURN(proc);
}
}
- my_printf_error(ER_UNKNOWN_PROCEDURE,ER(ER_UNKNOWN_PROCEDURE),MYF(0),
- (*param->item)->name);
+ my_error(ER_UNKNOWN_PROCEDURE, MYF(0), (*param->item)->name);
*error=1;
DBUG_RETURN(0);
}
diff --git a/sql/protocol.cc b/sql/protocol.cc
index e0d256fbe87..88be2710422 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -127,7 +127,6 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
thd->net.report_error= 0;
/* Abort multi-result sets */
- thd->lex->found_colon= 0;
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
DBUG_VOID_RETURN;
}
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index d49afb5f59d..5f67143065b 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -449,9 +449,8 @@ bool show_new_master(THD* thd)
if (translate_master(thd, lex_mi, errmsg))
{
if (errmsg[0])
- my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND,
- ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0),
- "SHOW NEW MASTER", errmsg);
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
+ "SHOW NEW MASTER", errmsg);
DBUG_RETURN(TRUE);
}
else
@@ -790,8 +789,7 @@ bool load_master_data(THD* thd)
if (connect_to_master(thd, &mysql, active_mi))
{
- my_printf_error(error= ER_CONNECT_TO_MASTER,
- ER(ER_CONNECT_TO_MASTER), MYF(0), mysql_error(&mysql));
+ my_error(error= ER_CONNECT_TO_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
@@ -803,8 +801,7 @@ bool load_master_data(THD* thd)
if (mysql_real_query(&mysql, "SHOW DATABASES", 14) ||
!(db_res = mysql_store_result(&mysql)))
{
- my_printf_error(error = ER_QUERY_ON_MASTER,
- ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
+ my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
@@ -831,8 +828,7 @@ bool load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW MASTER STATUS",18) ||
!(master_status_res = mysql_store_result(&mysql)))
{
- my_printf_error(error = ER_QUERY_ON_MASTER,
- ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
+ my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
@@ -885,8 +881,7 @@ bool load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW TABLES", 11) ||
!(*cur_table_res = mysql_store_result(&mysql)))
{
- my_printf_error(error = ER_QUERY_ON_MASTER,
- ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
+ my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
goto err;
}
@@ -943,8 +938,7 @@ bool load_master_data(THD* thd)
if (mysql_real_query(&mysql, "UNLOCK TABLES", 13))
{
- my_printf_error(error = ER_QUERY_ON_MASTER,
- ER(ER_QUERY_ON_MASTER), MYF(0), mysql_error(&mysql));
+ my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
}
@@ -953,7 +947,7 @@ bool load_master_data(THD* thd)
0 /* not only reset, but also reinit */,
&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);
pthread_mutex_unlock(&LOCK_active_mi);
return TRUE;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a183f815a59..e5f3e17d17d 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -899,8 +899,8 @@ bool sys_var_str::check(THD *thd, set_var *var)
return 0;
if ((res=(*check_func)(thd, var)) < 0)
- my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
- name, var->value->str_value.ptr());
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0),
+ name, var->value->str_value.ptr());
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)
{
char buf[64];
- my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
- MYF(0), var->var->name, llstr(val, buf));
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf));
return 1;
}
return 0;
@@ -1473,8 +1472,7 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names)
return 0;
err:
- my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
- name, value);
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, value);
return 1;
}
@@ -1515,8 +1513,7 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
return 0;
err:
- my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
- MYF(0), name, buff);
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff);
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)
{
- my_printf_error(ER_INCORRECT_GLOBAL_LOCAL_VAR,
- ER(ER_INCORRECT_GLOBAL_LOCAL_VAR), MYF(0),
- name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
+ my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
+ name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
return 0;
}
/* 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;
}
default:
- my_printf_error(ER_VAR_CANT_BE_READ, ER(ER_VAR_CANT_BE_READ), MYF(0),
- name);
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
}
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,
res->ptr(), res->length())))
{
- my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
- name, res->c_ptr());
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
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;
if (!(res=var->value->val_str(&str)))
{
- my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
- MYF(0), name, "NULL");
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
return 1;
}
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{
- my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
- res->c_ptr());
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr());
return 1;
}
}
@@ -1814,8 +1806,7 @@ bool sys_var_collation::check(THD *thd, set_var *var)
{
char buf[20];
int10_to_str((int) var->value->val_int(), buf, -10);
- my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
- buf);
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
return 1;
}
}
@@ -1836,8 +1827,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
{
if (!nullable)
{
- my_printf_error(ER_WRONG_VALUE_FOR_VAR,
- ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), name, "NULL");
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
return 1;
}
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))) &&
!(tmp=get_old_charset_by_name(res->c_ptr())))
{
- my_printf_error(ER_UNKNOWN_CHARACTER_SET, ER(ER_UNKNOWN_CHARACTER_SET),
- MYF(0), res->c_ptr());
+ my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
return 1;
}
}
@@ -2443,8 +2432,7 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
if (!(var->save_result.time_zone=
my_tz_find(res, thd->lex->time_zone_tables_used)))
{
- my_printf_error(ER_UNKNOWN_TIME_ZONE, ER(ER_UNKNOWN_TIME_ZONE), MYF(0),
- res ? res->c_ptr() : "NULL");
+ my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL");
return 1;
}
return 0;
@@ -2726,8 +2714,7 @@ sys_var *find_sys_var(const char *str, uint length)
length ? length :
strlen(str));
if (!var)
- my_printf_error(ER_UNKNOWN_SYSTEM_VARIABLE, ER(ER_UNKNOWN_SYSTEM_VARIABLE),
- MYF(0), (char*) str);
+ my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
return var;
}
@@ -2814,7 +2801,7 @@ int set_var::check(THD *thd)
if (var->check_type(type))
{
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;
}
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))
{
- 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 0;
@@ -2834,8 +2821,7 @@ int set_var::check(THD *thd)
return -1;
if (var->check_update_type(value->result_type()))
{
- my_printf_error(ER_WRONG_TYPE_FOR_VAR, ER(ER_WRONG_TYPE_FOR_VAR), MYF(0),
- var->name);
+ my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name);
return -1;
}
return var->check(thd, this) ? -1 : 0;
@@ -2859,7 +2845,7 @@ int set_var::light_check(THD *thd)
if (var->check_type(type))
{
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;
}
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";
err:
- my_printf_error(ER_UNKNOWN_STORAGE_ENGINE, ER(ER_UNKNOWN_STORAGE_ENGINE),
- MYF(0), value);
+ my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
return 1;
}
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 68816534d3a..c6ee78ffbb2 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -418,3 +418,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index f475c9cd371..37b523526ce 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -409,3 +409,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 471997e8a22..7cf441e899d 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -418,3 +418,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 293227e64b9..990e3819053 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 59e55207946..ff2f2a922ce 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -411,3 +411,5 @@ character-set=latin7
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index be6c440b509..2403eec4b60 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 3afdd3ab496..757274bf1d5 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -419,3 +419,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index b0b158f5851..ce8fece95e7 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -406,3 +406,5 @@ character-set=greek
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index ba5f662a196..e93970e7eb8 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -411,3 +411,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index d7ce95f8ed3..1745c31f114 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 56df55f3db4..969bacc8d8f 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -410,3 +410,5 @@ character-set=ujis
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 1672dcb7dc6..cdb67ba004c 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -406,3 +406,5 @@ character-set=euckr
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 187bab28cf1..35b5a3d464b 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -408,3 +408,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index ba1d11aa158..bb34b3d653c 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -408,3 +408,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 9d9940ca69d..e4dfb9442dd 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -411,3 +411,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 214b4753f1c..9b229613936 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -408,3 +408,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 2019bcc98f5..422143ea706 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -411,3 +411,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index 3354d6a7ee5..2da6cbdfc1a 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -411,3 +411,5 @@ character-set=koi8r
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 385f6f2044c..0abc324dfc8 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -399,3 +399,5 @@ character-set=cp1250
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 8ee06be1128..862ca741640 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -414,3 +414,5 @@ character-set=latin2
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 2215da6d57e..d3a4a029768 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -410,3 +410,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 92ef9e1659b..1b445e509c1 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -406,3 +406,5 @@ character-set=latin1
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index c1f86886870..a7b139bc2c3 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -412,3 +412,5 @@ character-set=koi8u
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"
+"Prepared statement contains too many placeholders"
+"Key part '%-.64s' length cannot be 0"
diff --git a/sql/slave.cc b/sql/slave.cc
index d14e9784834..34785f1a18f 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -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 &
CLIENT_PROTOCOL_41) ?
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);
}
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;
thd->net.vio = save_vio;
if (error)
- my_printf_error(ER_INDEX_REBUILD, ER(ER_INDEX_REBUILD), MYF(0),
- tables.table->real_name);
+ my_error(ER_INDEX_REBUILD, MYF(0), tables.table->real_name);
err:
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))
{
- my_printf_error(ER_CONNECT_TO_MASTER, ER(ER_CONNECT_TO_MASTER), MYF(0),
- mysql_error(mysql));
+ my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
mysql_close(mysql);
DBUG_RETURN(1);
}
diff --git a/sql/sp.cc b/sql/sp.cc
index bf1ad5d5fcf..5798eedbad9 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1001,8 +1001,7 @@ sp_cache_functions(THD *thd, LEX *lex)
{
delete newlex;
thd->lex= oldlex;
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- "FUNCTION", ls->str);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", ls->str);
ret= 1;
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))
{
- 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);
DBUG_RETURN(1);
}
@@ -1183,11 +1182,10 @@ sp_change_db(THD *thd, char *name, bool no_access_check)
if (!(db_access & DB_ACLS) &&
(!grant_option || check_grant_db(thd,dbname)))
{
- my_printf_error(ER_DBACCESS_DENIED_ERROR, ER(ER_DBACCESS_DENIED_ERROR),
- MYF(0),
- thd->priv_user,
- thd->priv_host,
- dbname);
+ my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
+ thd->priv_user,
+ thd->priv_host,
+ dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user,
thd->priv_host,
@@ -1203,7 +1201,7 @@ sp_change_db(THD *thd, char *name, bool no_access_check)
path[length-1]=0; // remove ending '\'
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));
DBUG_RETURN(1);
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index f07bb89e154..7db79128bb8 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -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
// invoking query properly.
- my_printf_error(ER_SP_WRONG_NO_OF_ARGS, ER(ER_SP_WRONG_NO_OF_ARGS), MYF(0),
- "FUNCTION", m_name.str, params, argcount);
+ my_error(ER_SP_WRONG_NO_OF_ARGS, MYF(0),
+ "FUNCTION", m_name.str, params, argcount);
DBUG_RETURN(-1);
}
@@ -596,8 +596,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
*resp= it;
else
{
- my_printf_error(ER_SP_NORETURNEND, ER(ER_SP_NORETURNEND), MYF(0),
- m_name.str);
+ my_error(ER_SP_NORETURNEND, MYF(0), m_name.str);
ret= -1;
}
}
@@ -623,8 +622,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (args->elements != params)
{
- my_printf_error(ER_SP_WRONG_NO_OF_ARGS, ER(ER_SP_WRONG_NO_OF_ARGS), MYF(0),
- "PROCEDURE", m_name.str, params, args->elements);
+ my_error(ER_SP_WRONG_NO_OF_ARGS, MYF(0), "PROCEDURE",
+ m_name.str, params, args->elements);
DBUG_RETURN(-1);
}
@@ -893,8 +892,7 @@ sp_head::check_backpatch(THD *thd)
{
if (bp->lab->type == SP_LAB_REF)
{
- my_printf_error(ER_SP_LILABEL_MISMATCH, ER(ER_SP_LILABEL_MISMATCH),
- MYF(0), "GOTO", bp->lab->name);
+ my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "GOTO", bp->lab->name);
return -1;
}
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index cd20888cb98..1ad125beb0e 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -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 &&
combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
- my_printf_error(ER_UNKNOWN_ERROR,
- "Password hash should be a %d-digit hexadecimal number",
- MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
+ my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
DBUG_RETURN(-1);
}
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 */
if (what == 'N')
{
- my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRAN), MYF(0),
- combo.user.str, combo.host.str);
+ my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
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) &&
!password_len) || !create_user)
{
- my_printf_error(ER_NO_PERMISSION_TO_CREATE_USER,
- ER(ER_NO_PERMISSION_TO_CREATE_USER), MYF(0),
- thd->user, thd->host_or_ip);
+ my_error(ER_NO_PERMISSION_TO_CREATE_USER, MYF(0),
+ thd->user, thd->host_or_ip);
goto end;
}
old_row_exists = 0;
@@ -1760,8 +1756,7 @@ static int replace_db_table(TABLE *table, const char *db,
{
if (what == 'N')
{ // no row, no revoke
- my_printf_error(ER_NONEXISTING_GRANT, ER(ER_NONEXISTING_GRANT), MYF(0),
- combo.user.str, combo.host.str);
+ my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
goto abort;
}
old_row_exists = 0;
@@ -2068,10 +2063,9 @@ static int replace_column_table(GRANT_TABLE *g_t,
{
if (revoke_grant)
{
- my_printf_error(ER_NONEXISTING_TABLE_GRANT,
- ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
- combo.user.str, combo.host.str,
- table_name); /* purecov: inspected */
+ my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
+ combo.user.str, combo.host.str,
+ table_name); /* purecov: inspected */
result= -1; /* purecov: inspected */
continue; /* purecov: inspected */
}
@@ -2237,10 +2231,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
*/
if (revoke_grant)
{ // no row, no revoke
- my_printf_error(ER_NONEXISTING_TABLE_GRANT,
- ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
- combo.user.str, combo.host.str,
- table_name); /* purecov: deadcode */
+ my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
+ combo.user.str, combo.host.str,
+ table_name); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */
}
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,
&unused_field_idx))
{
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- column->column.c_ptr(), table_list->alias);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0),
+ column->column.c_ptr(), table_list->alias);
DBUG_RETURN(TRUE);
}
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);
if (access(buf,F_OK))
{
- my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
- table_list->db, table_list->alias);
+ my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias);
DBUG_RETURN(TRUE);
}
}
@@ -2474,9 +2466,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{
if (revoke_grant)
{
- my_printf_error(ER_NONEXISTING_TABLE_GRANT,
- ER(ER_NONEXISTING_TABLE_GRANT), MYF(0),
- Str->user.str, Str->host.str, table_list->real_name);
+ my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
+ Str->user.str, Str->host.str, table_list->real_name);
result= TRUE;
continue;
}
@@ -2920,12 +2911,11 @@ err:
command= "create view";
else if (want_access & SHOW_VIEW_ACL)
command= "show create view";
- my_printf_error(ER_TABLEACCESS_DENIED_ERROR,
- ER(ER_TABLEACCESS_DENIED_ERROR), MYF(0),
- command,
- thd->priv_user,
- thd->host_or_ip,
- table ? table->real_name : "unknown");
+ my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
+ command,
+ thd->priv_user,
+ thd->host_or_ip,
+ table ? table->real_name : "unknown");
}
DBUG_RETURN(1);
}
@@ -2971,21 +2961,18 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant,
}
#endif
- /* We must use my_printf_error() here! */
err:
rw_unlock(&LOCK_grant);
if (!show_tables)
{
char command[128];
get_privilege_desc(command, sizeof(command), want_access);
- my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
- ER(ER_COLUMNACCESS_DENIED_ERROR),
- MYF(0),
- command,
- thd->priv_user,
- thd->host_or_ip,
- name,
- table_name);
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
+ command,
+ thd->priv_user,
+ thd->host_or_ip,
+ name,
+ table_name);
}
return 1;
}
@@ -3032,7 +3019,6 @@ bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant,
rw_unlock(&LOCK_grant);
return 0;
- /* We must use my_printf_error() here! */
err:
rw_unlock(&LOCK_grant);
err2:
@@ -3041,14 +3027,12 @@ err2:
command= "select";
else if (want_access & INSERT_ACL)
command= "insert";
- my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
- ER(ER_COLUMNACCESS_DENIED_ERROR),
- MYF(0),
- command,
- thd->priv_user,
- thd->host_or_ip,
- fields->name(),
- table_name);
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
+ command,
+ thd->priv_user,
+ thd->host_or_ip,
+ fields->name(),
+ table_name);
return 1;
}
@@ -3232,9 +3216,8 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
if (counter == acl_users.elements)
{
- my_printf_error(ER_NONEXISTING_GRANT,
- ER(ER_NONEXISTING_GRANT), MYF(0),
- lex_user->user.str, lex_user->host.str);
+ my_error(ER_NONEXISTING_GRANT, MYF(0),
+ lex_user->user.str, lex_user->host.str);
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 69b7b987152..2259d3bead8 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -81,18 +81,14 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val_real() < 0)
{
delete pc;
- my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
- ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0),
- proc_name);
+ my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
DBUG_RETURN(0);
}
pc->max_tree_elements = (uint) (*param->item)->val_int();
param = param->next;
if (param->next) // no third parameter possible
{
- my_printf_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE,
- ER(ER_WRONG_PARAMCOUNT_TO_PROCEDURE), MYF(0),
- proc_name);
+ my_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE, MYF(0), proc_name);
DBUG_RETURN(0);
}
// second parameter
@@ -100,9 +96,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val_real() < 0)
{
delete pc;
- my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
- ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0),
- proc_name);
+ my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
DBUG_RETURN(0);
}
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)
{
delete pc;
- my_printf_error(ER_WRONG_PARAMETERS_TO_PROCEDURE,
- ER(ER_WRONG_PARAMETERS_TO_PROCEDURE), MYF(0), proc_name);
+ my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
DBUG_RETURN(0);
}
// if only one parameter was given, it will be the value of max_tree_elements
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index b32aa033209..5c9beb44e4c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -891,8 +891,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
{
if (table->query_id == thd->query_id)
{
- my_printf_error(ER_CANT_REOPEN_TABLE,
- ER(ER_CANT_REOPEN_TABLE), MYF(0), table->table_name);
+ my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->table_name);
DBUG_RETURN(0);
}
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));
}
}
- 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);
}
@@ -1262,8 +1261,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
next=table->next;
if (!tables || (!db_stat && reopen_table(table,1)))
{
- my_printf_error(ER_CANT_REOPEN_TABLE, ER(ER_CANT_REOPEN_TABLE),
- MYF(0),table->table_name);
+ my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->table_name);
VOID(hash_delete(&open_cache,(byte*) table));
error=1;
}
@@ -1548,8 +1546,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
{
/* Give right error message */
thd->clear_error();
- my_printf_error(ER_NOT_KEYFILE, ER(ER_NOT_KEYFILE), MYF(0),
- name, my_errno);
+ my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno);
sql_print_error("Couldn't repair table: %s.%s",db,name);
if (entry->file)
closefrm(entry);
@@ -1614,8 +1611,7 @@ err:
{
TABLE_LIST * view= table_desc->belong_to_view;
thd->clear_error();
- my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0),
- view->view_db.str, view->view_name.str);
+ my_error(ER_VIEW_INVALID, MYF(0), view->view_db.str, view->view_name.str);
}
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 &&
(int) table->reginfo.lock_type < (int) TL_WRITE_ALLOW_READ)
{
- my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,
- ER(ER_TABLE_NOT_LOCKED_FOR_WRITE),
- MYF(0),table->table_name);
+ my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),table->table_name);
DBUG_RETURN(1);
}
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 ||
report_error == IGNORE_EXCEPT_NON_UNIQUE)
- my_printf_error(ER_NON_UNIQ_ERROR,ER(ER_NON_UNIQ_ERROR),MYF(0),
- item->full_name(),thd->where);
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ item->full_name(),thd->where);
return (Field*) 0;
}
found=find;
@@ -2351,16 +2345,14 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
}
if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE)
- my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
- table_name, thd->where);
+ my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, thd->where);
else
return (Field*) not_found_field;
}
else
if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE)
- my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0),
- item->full_name(),thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(),thd->where);
else
return (Field*) not_found_field;
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 ||
report_error == REPORT_EXCEPT_NON_UNIQUE)
- my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0),
- item->full_name(),thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(),thd->where);
return (Field*) not_found_field;
}
@@ -2399,8 +2390,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
break;
if (report_error == REPORT_ALL_ERRORS ||
report_error == IGNORE_EXCEPT_NON_UNIQUE)
- my_printf_error(ER_NON_UNIQ_ERROR,ER(ER_NON_UNIQ_ERROR),MYF(0),
- name,thd->where);
+ my_error(ER_NON_UNIQ_ERROR, MYF(0), name, thd->where);
return (Field*) 0;
}
found=field;
@@ -2410,8 +2400,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
return found;
if (report_error == REPORT_ALL_ERRORS ||
report_error == REPORT_EXCEPT_NON_UNIQUE)
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
- MYF(0), item->full_name(), thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(), thd->where);
else
return (Field*) not_found_field;
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.
*/
if (report_error != IGNORE_ERRORS)
- my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR),
- MYF(0), find->full_name(), current_thd->where);
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ find->full_name(), current_thd->where);
return (Item**) 0;
}
found_unaliased= li.ref();
@@ -2548,8 +2537,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if ((*found)->eq(item, 0))
continue; // Same field twice
if (report_error != IGNORE_ERRORS)
- my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR),
- MYF(0), find->full_name(), current_thd->where);
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ find->full_name(), current_thd->where);
return (Item**) 0;
}
found= li.ref();
@@ -2592,8 +2581,8 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if (found_unaliased_non_uniq)
{
if (report_error != IGNORE_ERRORS)
- my_printf_error(ER_NON_UNIQ_ERROR, ER(ER_NON_UNIQ_ERROR), MYF(0),
- find->full_name(), current_thd->where);
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ find->full_name(), current_thd->where);
return (Item **) 0;
}
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_ALL_ERRORS)
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- find->full_name(), current_thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0),
+ find->full_name(), current_thd->where);
return (Item **) 0;
}
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)) <=
0)
{
- my_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS,
- ER(ER_KEY_COLUMN_DOES_NOT_EXITS), MYF(0),
- name->c_ptr(), table->real_name);
+ my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0),
+ name->c_ptr(), table->real_name);
map->set_all();
return 1;
}
@@ -2994,14 +2982,12 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
fld->field_name) &
VIEW_ANY_ACL)))
{
- my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
- ER(ER_COLUMNACCESS_DENIED_ERROR),
- MYF(0),
- "ANY",
- thd->priv_user,
- thd->host_or_ip,
- fld->field_name,
- tab);
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
+ "ANY",
+ thd->priv_user,
+ thd->host_or_ip,
+ fld->field_name,
+ tab);
goto err;
}
}
@@ -3042,8 +3028,7 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
if (!table_name)
my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
else
- my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
- table_name);
+ my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name);
err:
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)
{
- my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
- db, table_name, "BASE TABLE");
+ my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE");
goto err;
}
if (mysql_make_view(parser, table_desc))
@@ -3583,8 +3567,7 @@ open_new_frm(const char *path, const char *alias,
else
{
/* only VIEWs are supported now */
- my_printf_error(ER_FRM_UNKNOWN_TYPE, ER(ER_FRM_UNKNOWN_TYPE), MYF(0),
- path, parser->type()->str);
+ my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), path, parser->type()->str);
goto err;
}
DBUG_RETURN(0);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 6f236f42df9..e69c0f52c93 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -701,8 +701,8 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
key_length + 1);
if (!new_table)
{
- my_printf_error(EE_OUTOFMEMORY, ER(EE_OUTOFMEMORY), MYF(ME_BELL),
- ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL),
+ ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
killed= KILL_CONNECTION;
return 0;
}
@@ -1018,8 +1018,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
if (!access(path, F_OK))
{
- my_printf_error(ER_FILE_EXISTS_ERROR, ER(ER_FILE_EXISTS_ERROR), MYF(0),
- exchange->file_name);
+ my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
return -1;
}
/* 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()))
{
- my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
- path, my_errno);
+ my_error(ER_ERROR_ON_WRITE, MYF(0), path, my_errno);
goto err;
}
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 42d6549f843..ad4887146d8 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -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))
{
- my_printf_error(ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), MYF(0),
- db);
+ my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
error= -1;
goto exit;
}
@@ -419,13 +418,12 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
{
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;
}
if (my_mkdir(path,0777,MYF(0)) < 0)
{
- my_printf_error(ER_CANT_CREATE_DB, ER(ER_CANT_CREATE_DB),
- MYF(0), db, my_errno);
+ my_error(ER_CANT_CREATE_DB, MYF(0), db, my_errno);
error= -1;
goto exit;
}
@@ -579,7 +577,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
if (!if_exists)
{
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;
}
else
@@ -803,8 +801,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
*/
if (found_other_files)
{
- my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0),
- org_path, EEXIST);
+ my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, EEXIST);
DBUG_RETURN(-1);
}
else
@@ -867,8 +864,7 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
*--pos=0;
if (rmdir(path) < 0 && send_error)
{
- my_printf_error(ER_DB_DROP_RMDIR, ER(ER_DB_DROP_RMDIR), MYF(0),
- path, errno);
+ my_error(ER_DB_DROP_RMDIR, MYF(0), path, errno);
DBUG_RETURN(-1);
}
DBUG_RETURN(0);
@@ -995,7 +991,7 @@ bool mysql_change_db(THD *thd, const char *name)
}
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);
DBUG_RETURN(1);
}
@@ -1008,11 +1004,10 @@ bool mysql_change_db(THD *thd, const char *name)
thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{
- my_printf_error(ER_DBACCESS_DENIED_ERROR,
- ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
- thd->priv_user,
- thd->priv_host,
- dbname);
+ my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
+ thd->priv_user,
+ thd->priv_host,
+ dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user,
thd->priv_host,
@@ -1027,7 +1022,7 @@ bool mysql_change_db(THD *thd, const char *name)
path[length-1]=0; // remove ending '\'
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));
DBUG_RETURN(1);
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 31363583806..a1ac6162b82 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -290,14 +290,12 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
DBUG_RETURN(TRUE);
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),
- table_list->alias, "DELETE");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
DBUG_RETURN(TRUE);
}
if (unique_table(table_list, table_list->next_global))
{
- my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0),
- table_list->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(TRUE);
}
select_lex->fix_prepare_information(thd, conds);
@@ -354,8 +352,8 @@ bool mysql_multi_delete_prepare(THD *thd)
if (!target_tbl->correspondent_table->updatable ||
check_key_in_view(thd, target_tbl->correspondent_table))
{
- my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
- MYF(0), target_tbl->real_name, "DELETE");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
+ target_tbl->real_name, "DELETE");
DBUG_RETURN(TRUE);
}
/*
@@ -372,8 +370,8 @@ bool mysql_multi_delete_prepare(THD *thd)
un->check_updateable(target_tbl->correspondent_table->db,
target_tbl->correspondent_table->real_name))
{
- my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
- MYF(0), target_tbl->correspondent_table->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0),
+ target_tbl->correspondent_table->real_name);
DBUG_RETURN(TRUE);
}
}
@@ -736,8 +734,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
db_type table_type;
if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN)
{
- my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
- table_list->db, table_list->real_name);
+ my_error(ER_NO_SUCH_TABLE, MYF(0),
+ table_list->db, table_list->real_name);
DBUG_RETURN(TRUE);
}
if (!ha_supports_generate(table_type))
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index e1df25ae724..853b3dd37c6 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -173,8 +173,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
{
DBUG_PRINT("info",("duplicate '%s'", tables->alias));
if (! reopen)
- my_printf_error(ER_NONUNIQ_TABLE, ER(ER_NONUNIQ_TABLE),
- MYF(0), tables->alias);
+ my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias);
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 (! 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);
goto err;
}
@@ -257,11 +256,11 @@ err:
will be closed. Broadcasts a COND_refresh condition.
RETURN
- 0 ok
- != 0 error
+ FALSE ok
+ 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 **table_ptr;
@@ -299,15 +298,14 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
}
else
{
- my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
- tables->alias, "HANDLER");
+ my_error(ER_UNKNOWN_TABLE, MYF(0), tables->alias, "HANDLER");
DBUG_PRINT("exit",("ERROR"));
- DBUG_RETURN(-1);
+ DBUG_RETURN(TRUE);
}
send_ok(thd);
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);
else
strncpy(buff, tables->alias, sizeof(buff));
- my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
- buff, "HANDLER");
+ my_error(ER_UNKNOWN_TABLE, MYF(0), buff, "HANDLER");
#else
- my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
- tables->alias, "HANDLER");
+ my_error(ER_UNKNOWN_TABLE, MYF(0), tables->alias, "HANDLER");
#endif
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)
{
- my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0),
- keyname,tables->alias);
+ my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
goto err0;
}
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;
if (key_expr->elements > keyinfo->key_parts)
{
- my_printf_error(ER_TOO_MANY_KEY_PARTS,ER(ER_TOO_MANY_KEY_PARTS),
- MYF(0),keyinfo->key_parts);
+ my_error(ER_TOO_MANY_KEY_PARTS, MYF(0), keyinfo->key_parts);
goto err;
}
List_iterator<Item> it_ke(*key_expr);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index f39753f0e62..2fddaed5f45 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -58,9 +58,7 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
{
if (values.elements != table->fields)
{
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0),counter);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
return -1;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -82,9 +80,7 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
int res;
if (fields.elements != values.elements)
{
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0),counter);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
return -1;
}
@@ -100,8 +96,7 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
if (check_unique && thd->dupp_field)
{
- my_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE),
- MYF(0), thd->dupp_field->field_name);
+ my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name);
return -1;
}
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->real_name))
{
- my_printf_error(ER_DELAYED_INSERT_TABLE_LOCKED,
- ER(ER_DELAYED_INSERT_TABLE_LOCKED),
- MYF(0), table_list->real_name);
+ my_error(ER_DELAYED_INSERT_TABLE_LOCKED, MYF(0),
+ table_list->real_name);
DBUG_RETURN(TRUE);
}
}
@@ -228,9 +222,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
counter++;
if (values->elements != value_count)
{
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0),counter);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
goto abort;
}
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 &&
check_view_insertability(table_list, thd->query_id)))
{
- my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
- MYF(0), table_list->alias, "INSERT");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "INSERT");
DBUG_RETURN(1);
}
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))
{
- my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
- MYF(0), table_list->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(TRUE);
}
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 &&
((*field)->flags & NO_DEFAULT_VALUE_FLAG))
{
- my_printf_error(ER_NO_DEFAULT_FOR_FIELD,
- ER(ER_NO_DEFAULT_FOR_FIELD),MYF(0),
- (*field)->field_name);
+ my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), (*field)->field_name);
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))
{
thd->fatal_error();
- my_printf_error(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0),
- di->table_list.real_name);
+ my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.real_name);
goto end;
}
di->table->copy_blobs=1;
@@ -1886,9 +1873,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if (table->fields < values.elements)
{
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0),1);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1);
DBUG_RETURN(-1);
}
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 4f5cf463fb6..d9e4943f322 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -125,8 +125,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(-1);
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), table_list->alias, "LOAD");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD");
DBUG_RETURN(TRUE);
}
table= table_list->table;
@@ -149,8 +148,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(TRUE);
if (thd->dupp_field)
{
- my_printf_error(ER_FIELD_SPECIFIED_TWICE, ER(ER_FIELD_SPECIFIED_TWICE),
- MYF(0), thd->dupp_field->field_name);
+ my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name);
DBUG_RETURN(TRUE);
}
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_IFIFO) == S_IFIFO)))
{
- my_printf_error(ER_TEXTFILE_NOT_READABLE,
- ER(ER_TEXTFILE_NOT_READABLE), MYF(0), name);
+ my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
DBUG_RETURN(TRUE);
}
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
index 917a8f2c30f..687e60b7c72 100644
--- a/sql/sql_map.cc
+++ b/sql/sql_map.cc
@@ -47,13 +47,12 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
0L)))
{
error=errno;
- my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0),
- (my_string) name, error);
+ my_error(ER_NO_FILE_MAPPING, MYF(0), (my_string) name, error);
}
}
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));
map=0;
}
@@ -112,8 +111,7 @@ mapped_files *map_file(const my_string name,byte *magic,uint magic_length)
{
map->use_count++;
if (!map->map)
- my_printf_error(ER_NO_FILE_MAPPING, ER(ER_NO_FILE_MAPPING), MYF(0),
- path, map->error);
+ my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error);
}
VOID(pthread_mutex_unlock(&LOCK_mapped_file));
return map;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 652a0493f6b..9d56ea27130 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1204,8 +1204,7 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
if (!db || check_db_name(db))
{
- my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
- db ? db : "NULL");
+ my_error(ER_WRONG_DB_NAME ,MYF(0), db ? db : "NULL");
goto err;
}
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));
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;
/*
@@ -1620,8 +1619,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
// null test to handle EOM
if (!db || !(alias= thd->strdup(db)) || check_db_name(db))
{
- my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
- db ? db : "NULL");
+ my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL");
break;
}
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));
if (mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db),
&create_info, 0) < 0)
- send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0);
+ error= TRUE;
break;
}
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 */
if (!db || !(alias= thd->strdup(db)) || check_db_name(db))
{
- my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME),
- MYF(0), db ? db : "NULL");
+ my_error(ER_WRONG_DB_NAME, MYF(0), db ? db : "NULL");
break;
}
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);
if (mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db),
0, 0) < 0)
- send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0);
+ error= TRUE;
break;
}
#ifndef EMBEDDED_LIBRARY
@@ -2189,11 +2186,10 @@ mysql_execute_command(THD *thd)
}
else
{
- my_printf_error(ER_UNKNOWN_STMT_HANDLER, ER(ER_UNKNOWN_STMT_HANDLER),
- MYF(0),
- lex->prepared_stmt_name.length,
- lex->prepared_stmt_name.str,
- "DEALLOCATE PREPARE");
+ my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0),
+ lex->prepared_stmt_name.length,
+ lex->prepared_stmt_name.str,
+ "DEALLOCATE PREPARE");
goto error;
}
break;
@@ -2386,8 +2382,7 @@ mysql_execute_command(THD *thd)
}
if (strlen(first_table->real_name) > NAME_LEN)
{
- my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
- first_table->real_name);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), first_table->real_name);
break;
}
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) &&
unique_table(create_table, select_tables))
{
- my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
- MYF(0), create_table->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0), create_table->real_name);
goto create_error;
}
/* 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))
{
- my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED),
- MYF(0), tab->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0), tab->real_name);
goto create_error;
}
}
@@ -2579,8 +2572,7 @@ create_error:
ulong priv=0;
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),
- lex->name);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), lex->name);
goto error;
}
if (!select_lex->db)
@@ -3054,18 +3046,17 @@ create_error:
remove_escape(db); // Fix escaped '_'
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;
}
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
if (!thd->col_access && check_grant_db(thd,db))
{
- my_printf_error(ER_DBACCESS_DENIED_ERROR,
- ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
- thd->priv_user,
- thd->priv_host,
- db);
+ my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
+ thd->priv_user,
+ thd->priv_host,
+ db);
goto error;
}
/* grant is checked in mysqld_show_tables */
@@ -3231,8 +3222,7 @@ create_error:
char *alias;
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),
- lex->name);
+ my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
break;
}
/*
@@ -3262,8 +3252,7 @@ create_error:
char *alias;
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),
- lex->name);
+ my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
break;
}
/*
@@ -3298,8 +3287,7 @@ create_error:
{
if (!strip_sp(lex->name) || check_db_name(lex->name))
{
- my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
- lex->name);
+ my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
break;
}
/*
@@ -3333,8 +3321,7 @@ create_error:
{
if (!strip_sp(lex->name) || check_db_name(lex->name))
{
- my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0),
- lex->name);
+ my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
break;
}
if (check_access(thd,SELECT_ACL,lex->name,0,1,0))
@@ -3356,8 +3343,7 @@ create_error:
#ifdef HAVE_DLOPEN
if ((sph= sp_find_function(thd, lex->spname)))
{
- my_printf_error(ER_UDF_EXISTS, ER(ER_UDF_EXISTS), MYF(0),
- lex->spname->m_name.str);
+ my_error(ER_UDF_EXISTS, MYF(0), lex->spname->m_name.str);
goto error;
}
if (!(res = mysql_create_function(thd,&lex->udf)))
@@ -3642,7 +3628,7 @@ create_error:
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;
lex->sphead= 0;
goto error;
@@ -3652,7 +3638,7 @@ create_error:
if (lex->sphead->m_type == TYPE_ENUM_FUNCTION &&
!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;
lex->sphead= 0;
goto error;
@@ -3667,22 +3653,19 @@ create_error:
lex->sphead= 0;
break;
case SP_WRITE_ROW_FAILED:
- my_printf_error(ER_SP_ALREADY_EXISTS, ER(ER_SP_ALREADY_EXISTS), MYF(0),
- SP_TYPE_STRING(lex), name);
+ my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
lex->unit.cleanup();
delete lex->sphead;
lex->sphead= 0;
goto error;
case SP_NO_DB_ERROR:
- my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0),
- lex->sphead->m_db.str);
+ my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str);
lex->unit.cleanup();
delete lex->sphead;
lex->sphead= 0;
goto error;
default:
- my_printf_error(ER_SP_STORE_FAILED, ER(ER_SP_STORE_FAILED), MYF(0),
- SP_TYPE_STRING(lex), name);
+ my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
lex->unit.cleanup();
delete lex->sphead;
lex->sphead= 0;
@@ -3696,8 +3679,7 @@ create_error:
if (!(sp= sp_find_procedure(thd, lex->spname)))
{
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
- MYF(0), "PROCEDURE",
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PROCEDURE",
lex->spname->m_qname.str);
goto error;
}
@@ -3795,12 +3777,12 @@ create_error:
send_ok(thd);
break;
case SP_KEY_NOT_FOUND:
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- SP_COM_STRING(lex), lex->spname->m_qname.str);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error;
default:
- my_printf_error(ER_SP_CANT_ALTER, ER(ER_SP_CANT_ALTER), MYF(0),
- SP_COM_STRING(lex), lex->spname->m_qname.str);
+ my_error(ER_SP_CANT_ALTER, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error;
}
break;
@@ -3862,12 +3844,12 @@ create_error:
send_ok(thd);
break;
}
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- SP_COM_STRING(lex), lex->spname->m_qname.str);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error;
default:
- my_printf_error(ER_SP_DROP_FAILED, ER(ER_SP_DROP_FAILED), MYF(0),
- SP_COM_STRING(lex), lex->spname->m_qname.str);
+ my_error(ER_SP_DROP_FAILED, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_qname.str);
goto error;
}
break;
@@ -3876,14 +3858,13 @@ create_error:
{
if (lex->spname->m_name.length > NAME_LEN)
{
- my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
- lex->spname->m_name.str);
+ my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
goto error;
}
if (sp_show_create_procedure(thd, lex->spname) != SP_OK)
{ /* We don't distinguish between errors for now */
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- SP_COM_STRING(lex), lex->spname->m_name.str);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_name.str);
goto error;
}
break;
@@ -3892,14 +3873,13 @@ create_error:
{
if (lex->spname->m_name.length > NAME_LEN)
{
- my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
- lex->spname->m_name.str);
+ my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
goto error;
}
if (sp_show_create_function(thd, lex->spname) != SP_OK)
{ /* We don't distinguish between errors for now */
- my_printf_error(ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), MYF(0),
- SP_COM_STRING(lex), lex->spname->m_name.str);
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_name.str);
goto error;
}
break;
@@ -4103,13 +4083,12 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
{ // We can never grant this
DBUG_PRINT("error",("No possible access"));
if (!no_errors)
- my_printf_error(ER_ACCESS_DENIED_ERROR,
- ER(ER_ACCESS_DENIED_ERROR), MYF(0),
- thd->priv_user,
- thd->priv_host,
- (thd->password ?
- ER(ER_YES) :
- ER(ER_NO)));/* purecov: tested */
+ my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
+ thd->priv_user,
+ thd->priv_host,
+ (thd->password ?
+ ER(ER_YES) :
+ ER(ER_NO))); /* 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"));
if (!no_errors)
- my_printf_error(ER_DBACCESS_DENIED_ERROR,
- ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
- thd->priv_user,
- thd->priv_host,
- (db ? db : (thd->db ?
- thd->db :
- "unknown"))); /* purecov: tested */
+ my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
+ thd->priv_user,
+ thd->priv_host,
+ (db ? db : (thd->db ?
+ thd->db :
+ "unknown"))); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
@@ -4176,8 +4154,7 @@ bool check_global_access(THD *thd, ulong want_access)
if ((thd->master_access & want_access))
return 0;
get_privilege_desc(command, sizeof(command), want_access);
- my_printf_error(ER_SPECIFIC_ACCESS_DENIED_ERROR,
- ER(ER_SPECIFIC_ACCESS_DENIED_ERROR), MYF(0), command);
+ my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
return 1;
#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)
return FALSE; /* Both user and host must match */
- my_printf_error(ER_SP_ACCESS_DENIED_ERROR, ER(ER_SP_ACCESS_DENIED_ERROR),
- MYF(0), sp->m_qname.str);
+ my_error(ER_SP_ACCESS_DENIED_ERROR, MYF(0), sp->m_qname.str);
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)
{
- my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
- field_name); /* purecov: inspected */
+ my_error(ER_TOO_LONG_IDENT, MYF(0), field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
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 &&
type == FIELD_TYPE_TIMESTAMP))
{
- my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
- field_name);
+ my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
DBUG_RETURN(1);
}
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)) ==
NOT_NULL_FLAG)
{
- my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
- field_name);
+ my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
DBUG_RETURN(1);
}
}
else if (type_modifier & AUTO_INCREMENT_FLAG)
{
- my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
- field_name);
+ my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
DBUG_RETURN(1);
}
}
if (on_update_value && type != FIELD_TYPE_TIMESTAMP)
{
- my_printf_error(ER_INVALID_ON_UPDATE, ER(ER_INVALID_ON_UPDATE), MYF(0),
- field_name);
+ my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name);
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);
if (res->length())
{
- my_printf_error(ER_BLOB_CANT_HAVE_DEFAULT,
- ER(ER_BLOB_CANT_HAVE_DEFAULT), MYF(0),
- field_name); /* purecov: inspected */
+ my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0),
+ field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
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;
if (tmp_length > PRECISION_FOR_DOUBLE)
{
- my_printf_error(ER_WRONG_FIELD_SPEC, ER(ER_WRONG_FIELD_SPEC), MYF(0),
- field_name);
+ my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name);
DBUG_RETURN(1);
}
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)
{
- my_printf_error(ER_TOO_BIG_SET, ER(ER_TOO_BIG_SET), MYF(0),
- field_name); /* purecov: inspected */
+ my_error(ER_TOO_BIG_SET, MYF(0), field_name); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
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);
if (thd->cuted_fields)
{
- my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
- field_name);
+ my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
DBUG_RETURN(1);
}
}
@@ -5064,8 +5031,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
res->strip_sp();
if (!find_type(interval, res->ptr(), res->length(), 0))
{
- my_printf_error(ER_INVALID_DEFAULT, ER(ER_INVALID_DEFAULT), MYF(0),
- field_name);
+ my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
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_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 */
DBUG_RETURN(1); /* purecov: inspected */
}
type_modifier&= AUTO_INCREMENT_FLAG;
if ((~allowed_type_modifier) & type_modifier)
{
- my_printf_error(ER_WRONG_FIELD_SPEC, ER(ER_WRONG_FIELD_SPEC), MYF(0),
- field_name);
+ my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name);
DBUG_RETURN(1);
}
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) ||
table->db.str && check_db_name(table->db.str))
{
- my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
- table->table.str);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
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) &&
!strcmp(ptr->db, tables->db))
{
- my_printf_error(ER_NONUNIQ_TABLE, ER(ER_NONUNIQ_TABLE), MYF(0),
- alias_str); /* purecov: tested */
+ my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str); /* 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 ||
!test_if_hard_path(*filename_ptr))
{
- my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME), MYF(0),
- *filename_ptr);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), *filename_ptr);
return 1;
}
/* Fix is using unix filename format on dos */
@@ -5863,8 +5825,7 @@ bool check_simple_select()
char command[80];
strmake(command, lex->yylval->symbol.str,
min(lex->yylval->symbol.length, sizeof(command)-1));
- my_printf_error(ER_CANT_USE_OPTION_HERE, ER(ER_CANT_USE_OPTION_HERE),
- MYF(0), command);
+ my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command);
return 1;
}
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)
{
- 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);
}
/*
@@ -6113,8 +6074,8 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
}
if (!walk)
{
- my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
- target_tbl->real_name, "MULTI DELETE");
+ my_error(ER_UNKNOWN_TABLE, MYF(0),
+ target_tbl->real_name, "MULTI DELETE");
DBUG_RETURN(TRUE);
}
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,
create_table->real_name))
{
- net_printf(thd,ER_UPDATE_TABLE_USED, create_table->real_name);
-
+ error= FALSE;
goto err;
}
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e29f6329e58..9e3395cf893 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -926,9 +926,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
counter++;
if (values->elements != value_count)
{
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0), counter);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
goto error;
}
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);
#endif
+ result= TRUE;
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
- {
- send_error(thd);
goto err;
- }
- if ((result= open_and_lock_tables(thd, tables)))
+ if (open_and_lock_tables(thd, tables))
goto err;
- result= TRUE;
+
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)
{
/* Error code to be defined in 5.0 */
- send_error(thd, ER_UNKNOWN_ERROR,
- "Prepared statement contains too many placeholders.");
- return 1;
+ my_message(ER_PS_MANY_PARAM, ER(ER_PS_MANY_PARAM), MYF(0));
+ return TRUE;
}
Item_param **to;
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,
sizeof(Item_param*) * stmt->param_count);
if (!stmt->param_array)
- return 1;
+ return TRUE;
for (to= stmt->param_array;
to < stmt->param_array + stmt->param_count;
++to)
@@ -1537,7 +1532,7 @@ static bool init_param_array(Prepared_statement *stmt)
*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 */
thd->stmt_map.erase(stmt);
stmt= NULL;
- if (thd->net.report_error)
- send_error(thd);
- /* otherwise the error is sent inside yyparse/check_preapred_statement */
}
else
{
@@ -1968,7 +1960,7 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
alloc_query(thd, (char *)expanded_query->ptr(),
expanded_query->length()+1))
{
- my_error(ER_OUTOFMEMORY, 0, expanded_query->length());
+ my_error(ER_OUTOFMEMORY, MYF(0), expanded_query->length());
DBUG_VOID_RETURN;
}
/*
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 25874e1335a..9f29a975441 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -157,8 +157,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
unpack_filename(name, name);
if (!access(name,F_OK))
{
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- MYF(0), new_alias);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
DBUG_RETURN(ren_table); // This can't be skipped
}
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);
if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN)
{
- my_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), MYF(0),
- name, my_errno);
+ my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
if (!skip_error)
DBUG_RETURN(ren_table);
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 3ef7e01d248..d2e3e72618d 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1002,7 +1002,7 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
err:
unlock_slave_threads(mi);
if (error)
- my_printf_error(sql_errno, ER(sql_errno), MYF(0), errmsg);
+ my_error(sql_errno, MYF(0), errmsg);
DBUG_RETURN(error);
}
@@ -1195,8 +1195,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
0 /* not only reset, but also reinit */,
&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(mi);
DBUG_RETURN(TRUE);
}
@@ -1212,7 +1211,7 @@ bool change_master(THD* thd, MASTER_INFO* mi)
0 /*no data lock*/,
&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);
DBUG_RETURN(TRUE);
}
@@ -1406,9 +1405,8 @@ err:
if (errmsg)
{
- my_printf_error(ER_ERROR_WHEN_EXECUTING_COMMAND,
- ER(ER_ERROR_WHEN_EXECUTING_COMMAND), MYF(0),
- "SHOW BINLOG EVENTS", errmsg);
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
+ "SHOW BINLOG EVENTS", errmsg);
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f0584837028..2f3687c28bd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1883,7 +1883,7 @@ Cursor::fetch(ulong num_rows)
thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
}
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_items(free_list);
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();
if (!count || count > fields.elements)
{
- my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),
- MYF(0), order_item->full_name(), thd->where);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0),
+ order_item->full_name(), thd->where);
return 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 */
if ((*order->item)->with_sum_func)
{
- my_printf_error(ER_WRONG_GROUP_FIELD, ER(ER_WRONG_GROUP_FIELD),MYF(0),
- (*order->item)->full_name());
+ my_error(ER_WRONG_GROUP_FIELD, MYF(0), (*order->item)->full_name());
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 &&
!item->const_item())
{
- my_printf_error(ER_WRONG_FIELD_WITH_GROUP,
- ER(ER_WRONG_FIELD_WITH_GROUP),
- MYF(0),item->full_name());
+ my_error(ER_WRONG_FIELD_WITH_GROUP, MYF(0), item->full_name());
return 1;
}
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b46834882c6..7a483086584 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -868,8 +868,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
/* TODO: add environment variables show when it become possible */
if (thd->lex->only_view && !table_list->view)
{
- my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
- table_list->db, table_list->real_name, "VIEW");
+ my_error(ER_WRONG_OBJECT, MYF(0),
+ table_list->db, table_list->real_name, "VIEW");
DBUG_RETURN(TRUE);
}
@@ -938,7 +938,7 @@ bool mysqld_show_create_db(THD *thd, char *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);
}
@@ -950,9 +950,8 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{
- my_printf_error(ER_DBACCESS_DENIED_ERROR,
- ER(ER_DBACCESS_DENIED_ERROR), MYF(0),
- thd->priv_user, thd->host_or_ip, dbname);
+ my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
+ thd->priv_user, thd->host_or_ip, dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user, thd->host_or_ip, dbname);
DBUG_RETURN(TRUE);
@@ -969,7 +968,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
}
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);
}
if (found_libchar)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 301130c13ca..cb327990a78 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -84,9 +84,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
{
if (thd->global_read_lock)
{
- my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,
- ER(ER_TABLE_NOT_LOCKED_FOR_WRITE), MYF(0),
- tables->real_name);
+ my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), tables->real_name);
error= TRUE;
goto err;
}
@@ -269,8 +267,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (wrong_tables.length())
{
if (!foreign_key_error)
- my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
- wrong_tables.c_ptr());
+ my_error(ER_BAD_TABLE_ERROR, MYF(0), wrong_tables.c_ptr());
else
my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
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))
{
- my_printf_error(ER_WRONG_COLUMN_NAME, ER(ER_WRONG_COLUMN_NAME), MYF(0),
- sql_field->field_name);
+ my_error(ER_WRONG_COLUMN_NAME, MYF(0), sql_field->field_name);
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)
{
- my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME), MYF(0),
- sql_field->field_name);
+ my_error(ER_DUP_FIELDNAME, MYF(0), sql_field->field_name);
DBUG_RETURN(-1);
}
else
@@ -541,8 +536,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
#ifdef HAVE_SPATIAL
if (!(file->table_flags() & HA_CAN_GEOMETRY))
{
- my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED),
- MYF(0), "GEOMETRY");
+ my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY");
DBUG_RETURN(-1);
}
sql_field->pack_flag=FIELDFLAG_GEOM |
@@ -555,8 +549,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
blob_columns++;
break;
#else
- my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED), MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ sym_group_geom.name, sym_group_geom.needed_define);
DBUG_RETURN(-1);
#endif /*HAVE_SPATIAL*/
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 &&
fk_key->ref_columns.elements != fk_key->columns.elements)
{
- my_printf_error(ER_WRONG_FK_DEF, ER(ER_WRONG_FK_DEF), MYF(0),
- (fk_key->name ?
- fk_key->name :
- "foreign key without name"),
- ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
+ my_error(ER_WRONG_FK_DEF, MYF(0),
+ (fk_key->name ? fk_key->name : "foreign key without name"),
+ ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
DBUG_RETURN(-1);
}
continue;
@@ -694,8 +686,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
if (key->name && strlen(key->name) > NAME_LEN)
{
- my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
- key->name);
+ my_error(ER_TOO_LONG_IDENT, MYF(0), key->name);
DBUG_RETURN(-1);
}
key_iterator2.rewind ();
@@ -735,8 +726,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (key->name && !tmp_table &&
!my_strcasecmp(system_charset_info,key->name,primary_key_name))
{
- my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
- MYF(0), key->name);
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
DBUG_RETURN(-1);
}
}
@@ -781,8 +771,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key_info->flags= HA_SPATIAL;
break;
#else
- my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ sym_group_geom.name, sym_group_geom.needed_define);
DBUG_RETURN(-1);
#endif
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)
{
- my_printf_error(ER_WRONG_ARGUMENTS,
- ER(ER_WRONG_ARGUMENTS),MYF(0),"SPATIAL INDEX");
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
DBUG_RETURN(-1);
}
}
@@ -833,17 +822,15 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
#ifdef HAVE_RTREE_KEYS
if ((key_info->key_parts & 1) == 1)
{
- my_printf_error(ER_WRONG_ARGUMENTS,
- ER(ER_WRONG_ARGUMENTS),MYF(0),"RTREE INDEX");
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "RTREE INDEX");
DBUG_RETURN(-1);
}
/* TODO: To be deleted */
- my_printf_error(ER_NOT_SUPPORTED_YET, ER(ER_NOT_SUPPORTED_YET),
- MYF(0), "RTREE INDEX");
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RTREE INDEX");
DBUG_RETURN(-1);
#else
- my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0),
- sym_group_rtree.name, sym_group_rtree.needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ sym_group_rtree.name, sym_group_rtree.needed_define);
DBUG_RETURN(-1);
#endif
}
@@ -861,9 +848,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
field++;
if (!sql_field)
{
- my_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS,
- ER(ER_KEY_COLUMN_DOES_NOT_EXITS),MYF(0),
- column->field_name);
+ my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name);
DBUG_RETURN(-1);
}
/* 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
(ft_key_charset && sql_field->charset != ft_key_charset))
{
- my_printf_error(ER_BAD_FT_COLUMN,ER(ER_BAD_FT_COLUMN),MYF(0),
- column->field_name);
+ my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name);
DBUG_RETURN(-1);
}
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))
{
- my_printf_error(ER_BLOB_USED_AS_KEY,ER(ER_BLOB_USED_AS_KEY),MYF(0),
- column->field_name);
+ my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name);
DBUG_RETURN(-1);
}
if (!column->length)
{
- my_printf_error(ER_BLOB_KEY_WITHOUT_LENGTH,
- ER(ER_BLOB_KEY_WITHOUT_LENGTH),MYF(0),
- column->field_name);
+ my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name);
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;
if (!(file->table_flags() & HA_NULL_IN_KEY))
{
- my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX),
- MYF(0),column->field_name);
+ my_error(ER_NULL_COLUMN_IN_INDEX, MYF(0), column->field_name);
DBUG_RETURN(-1);
}
if (key->type == Key::SPATIAL)
@@ -1001,8 +981,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
else if (length == 0)
{
- my_printf_error(ER_WRONG_KEY_COLUMN, ER(ER_WRONG_KEY_COLUMN), MYF(0),
- column->field_name);
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name);
DBUG_RETURN(-1);
}
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);
if (check_if_keyname_exists(key_name,key_info_buffer,key_info))
{
- my_printf_error(ER_DUP_KEYNAME, ER(ER_DUP_KEYNAME), MYF(0),
- key_name);
+ my_error(ER_DUP_KEYNAME, MYF(0), key_name);
DBUG_RETURN(-1);
}
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))
{
- my_printf_error(ER_WRONG_NAME_FOR_INDEX, ER(ER_WRONG_NAME_FOR_INDEX),
- MYF(0), key_info->name);
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name);
DBUG_RETURN(-1);
}
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) &&
(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);
}
#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
DBUG_RETURN(FALSE);
}
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0),
- alias);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
DBUG_RETURN(TRUE);
}
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;
}
else
- my_printf_error(ER_TABLE_EXISTS_ERROR,
- ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
goto end;
}
}
@@ -1275,8 +1250,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
error= FALSE;
}
else
- my_printf_error(ER_TABLE_EXISTS_ERROR,
- ER(ER_TABLE_EXISTS_ERROR), MYF(0), table_name);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
goto end;
}
}
@@ -1495,8 +1469,7 @@ mysql_rename_table(enum db_type base,
}
delete file;
if (error)
- my_printf_error(ER_ERROR_ON_RENAME, ER(ER_ERROR_ON_RENAME),
- MYF(0), from, to, error);
+ my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
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)))
{
pthread_mutex_unlock(&LOCK_global_system_variables);
- my_printf_error(ER_UNKNOWN_KEY_CACHE, ER(ER_UNKNOWN_KEY_CACHE), MYF(0),
- key_cache_name->str);
+ my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
DBUG_RETURN(TRUE);
}
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)) ||
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),
- src_table);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table);
DBUG_RETURN(TRUE);
}
@@ -2179,8 +2150,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
reg_ext, NullS);
if (access(src_path, F_OK))
{
- my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
- src_table);
+ my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
goto err;
}
}
@@ -2263,8 +2233,7 @@ table_exists:
res= FALSE;
}
else
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR), MYF(0),
- table_name);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
err:
pthread_mutex_lock(&LOCK_open);
@@ -2523,8 +2492,7 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
}
if (idx>= table->keys)
{
- my_printf_error(ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY),
- MYF(0), drop_key->name);
+ my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop_key->name);
/*don't need to free((gptr) key_numbers);*/
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))
{
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- MYF(0), new_name_buff);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name_buff);
DBUG_RETURN(TRUE);
}
}
@@ -2660,8 +2627,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
F_OK))
{
/* Table will be closed in do_command() */
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- MYF(0), new_alias);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
DBUG_RETURN(TRUE);
}
}
@@ -2702,8 +2668,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error=0;
if (!access(new_name_buff,F_OK))
{
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- MYF(0), new_name);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name);
error= -1;
}
else
@@ -2847,8 +2812,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
if (def->sql_type == FIELD_TYPE_BLOB)
{
- my_printf_error(ER_BLOB_CANT_HAVE_DEFAULT,
- ER(ER_BLOB_CANT_HAVE_DEFAULT), MYF(0), def->change);
+ my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
DBUG_RETURN(TRUE);
}
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)
{
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- def->change, table_name);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, table_name);
DBUG_RETURN(TRUE);
}
if (!def->after)
@@ -2881,8 +2844,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
if (!find)
{
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
- MYF(0), def->after, table_name);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), def->after, table_name);
DBUG_RETURN(TRUE);
}
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)
{
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0),
- alter_info->alter_list.head()->name, table_name);
+ my_error(ER_BAD_FIELD_ERROR, MYF(0),
+ alter_info->alter_list.head()->name, table_name);
DBUG_RETURN(TRUE);
}
if (!create_list.elements)
@@ -2986,8 +2948,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (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),
- MYF(0), key->name);
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
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)
{
- my_printf_error(ER_CANT_DROP_FIELD_OR_KEY,
- ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0),
- alter_info->drop_list.head()->name);
+ my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
+ alter_info->drop_list.head()->name);
goto err;
}
if (alter_info->alter_list.elements)
{
- my_printf_error(ER_CANT_DROP_FIELD_OR_KEY,
- ER(ER_CANT_DROP_FIELD_OR_KEY), MYF(0),
- alter_info->alter_list.head()->name);
+ my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
+ alter_info->alter_list.head()->name);
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))
{
error=1;
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- MYF(0), new_name_buff);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name_buff);
VOID(quick_rm_table(new_db_type,new_db,tmp_name));
VOID(pthread_mutex_unlock(&LOCK_open));
goto err;
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 4a99296a7a5..7637679430f 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -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)
{
- my_printf_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE,
- ER(ER_TRG_ON_VIEW_OR_TEMP_TABLE), MYF(0), tables->alias);
+ my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias);
DBUG_RETURN(TRUE);
}
@@ -418,8 +417,8 @@ err_with_lex_cleanup:
We don't care about this error message much because .TRG files will
be merged into .FRM anyway.
*/
- my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
- table_name, triggers_file_ext, "TRIGGER");
+ my_error(ER_WRONG_OBJECT, MYF(0),
+ table_name, triggers_file_ext, "TRIGGER");
DBUG_RETURN(1);
}
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 964021ce7fa..7fd81f22e66 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -384,15 +384,14 @@ int mysql_create_function(THD *thd,udf_func *udf)
}
if (udf->name.length > NAME_LEN)
{
- my_printf_error(ER_TOO_LONG_IDENT, ER(ER_TOO_LONG_IDENT), MYF(0),
- udf->name);
+ my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name);
DBUG_RETURN(1);
}
rw_wrlock(&THR_LOCK_udf);
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;
}
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)",
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());
goto err;
}
@@ -412,8 +411,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (udf->func == NULL)
{
- my_printf_error(ER_CANT_FIND_DL_ENTRY, ER(ER_CANT_FIND_DL_ENTRY), MYF(0),
- udf->name);
+ my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), udf->name);
goto err;
}
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);
if (error)
{
- my_printf_error(ER_ERROR_ON_WRITE, ER(ER_ERROR_ON_WRITE), MYF(0),
- "func@mysql", error);
+ my_error(ER_ERROR_ON_WRITE, MYF(0), "func@mysql", error);
del_udf(u_d);
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,
(uint) udf_name->length)))
{
- my_printf_error(ER_FUNCTION_NOT_DEFINED, ER(ER_FUNCTION_NOT_DEFINED),
- MYF(0), udf_name->str);
+ my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
goto err;
}
del_udf(udf);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index dfc46150847..c5167018701 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -38,15 +38,15 @@ static bool compare_record(TABLE *table, ulong query_id)
if (memcmp(table->null_flags,
table->null_flags+table->rec_buff_length,
table->null_bytes))
- return 1; // Diff in NULL value
+ return TRUE; // Diff in NULL value
/* Compare updated fields */
for (Field **ptr=table->field ; *ptr ; ptr++)
{
if ((*ptr)->query_id == query_id &&
(*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()))
{
/* item has name, because it comes from VIEW SELECT list */
- my_printf_error(ER_NONUPDATEABLE_COLUMN, ER(ER_NONUPDATEABLE_COLUMN),
- MYF(0), item->name);
+ my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
return TRUE;
}
/*
@@ -134,8 +133,8 @@ bool mysql_update(THD *thd,
table_list->grant.want_privilege :
table->grant.want_privilege);
#endif
- if ((error= mysql_prepare_update(thd, table_list, &conds, order_num, order)))
- DBUG_RETURN(error);
+ if (mysql_prepare_update(thd, table_list, &conds, order_num, order))
+ DBUG_RETURN(TRUE);
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))
{
- my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
- MYF(0), table_list->alias, "UPDATE");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(TRUE);
}
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 */
if (unique_table(table_list, table_list->next_global))
{
- my_printf_error(ER_UPDATE_TABLE_USED, ER(ER_UPDATE_TABLE_USED), MYF(0),
- table_list->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(TRUE);
}
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 */
if (open_tables(thd, table_list, & table_count) ||
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
SET part
@@ -658,9 +655,7 @@ bool mysql_multi_update_prepare(THD *thd)
{
if (!tl->updatable || check_key_in_view(thd, tl))
{
- my_printf_error(ER_NON_UPDATABLE_TABLE,
- ER(ER_NON_UPDATABLE_TABLE), MYF(0),
- tl->alias, "UPDATE");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE");
DBUG_RETURN(TRUE);
}
@@ -671,8 +666,7 @@ bool mysql_multi_update_prepare(THD *thd)
if (lex->select_lex.check_updateable_in_subqueries(tl->db,
tl->real_name))
{
- my_printf_error(ER_UPDATE_TABLE_USED,
- ER(ER_UPDATE_TABLE_USED), MYF(0), tl->real_name);
+ my_error(ER_UPDATE_TABLE_USED, MYF(0), tl->real_name);
DBUG_RETURN(TRUE);
}
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() &&
mysql_handle_derived(lex, &mysql_derived_filling))
- DBUG_RETURN(thd->net.report_error ? -1 : 1);
+ DBUG_RETURN(TRUE);
DBUG_RETURN (FALSE);
}
@@ -749,8 +743,8 @@ bool mysql_multi_update(THD *thd,
multi_update *result;
DBUG_ENTER("mysql_multi_update");
- if ((res= mysql_multi_update_prepare(thd)))
- DBUG_RETURN(res);
+ if (mysql_multi_update_prepare(thd))
+ DBUG_RETURN(TRUE);
if (!(result= new multi_update(thd, table_list, fields, values,
handle_duplicates)))
@@ -1021,7 +1015,7 @@ static bool safe_update_on_fly(JOIN_TAB *join_tab, List<Item> *fields)
case JT_SYSTEM:
case JT_CONST:
case JT_EQ_REF:
- return 1; // At most one matching row
+ return TRUE; // At most one matching row
case JT_REF:
return !check_if_key_used(table, join_tab->ref.key, *fields);
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) &&
table->primary_key < MAX_KEY)
return !check_if_key_used(table, table->primary_key, *fields);
- return 1;
+ return TRUE;
default:
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) */
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
MYF(0));
- return 1;
+ return TRUE;
}
@@ -1370,5 +1364,5 @@ bool multi_update::send_eof()
(thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
::send_ok(thd, (ulong) thd->row_count_func,
thd->insert_id_used ? thd->insert_id() : 0L,buff);
- return 0;
+ return FALSE;
}
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index cd739071d7b..f7f3a362696 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -113,13 +113,8 @@ bool mysql_create_view(THD *thd,
*/
if (check_some_access(thd, VIEW_ANY_ACL, tbl))
{
- my_printf_error(ER_TABLEACCESS_DENIED_ERROR,
- ER(ER_TABLEACCESS_DENIED_ERROR),
- MYF(0),
- "ANY",
- thd->priv_user,
- thd->host_or_ip,
- tbl->real_name);
+ my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
+ "ANY", thd->priv_user, thd->host_or_ip, tbl->real_name);
DBUG_RETURN(TRUE);
}
/*
@@ -190,8 +185,7 @@ bool mysql_create_view(THD *thd,
/* is this table temporary and is not view? */
if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view)
{
- my_printf_error(ER_VIEW_SELECT_TMPTABLE,
- ER(ER_VIEW_SELECT_TMPTABLE), MYF(0), tbl->alias);
+ my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias);
res= TRUE;
goto err;
}
@@ -201,8 +195,7 @@ bool mysql_create_view(THD *thd,
strcmp(tbl->view_db.str, view->db) == 0 &&
strcmp(tbl->view_name.str, view->real_name) == 0)
{
- my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
- tbl->view_db.str, tbl->view_name.str);
+ my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str);
res= TRUE;
goto err;
}
@@ -257,8 +250,7 @@ bool mysql_create_view(THD *thd,
{
if (strcmp(item->name, check->name) == 0)
{
- my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME),
- MYF(0), item->name);
+ my_error(ER_DUP_FIELDNAME, MYF(0), item->name);
DBUG_RETURN(TRUE);
}
}
@@ -290,14 +282,9 @@ bool mysql_create_view(THD *thd,
if ((~fld->have_privileges & priv))
{
/* VIEW column has more privileges */
- my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
- ER(ER_COLUMNACCESS_DENIED_ERROR),
- MYF(0),
- "create view",
- thd->priv_user,
- thd->host_or_ip,
- item->name,
- view->real_name);
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
+ "create view", thd->priv_user, thd->host_or_ip, item->name,
+ view->real_name);
DBUG_RETURN(TRUE);
}
}
@@ -432,8 +419,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{
if (mode == VIEW_CREATE_NEW)
{
- my_printf_error(ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- MYF(0), view->alias);
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), view->alias);
DBUG_RETURN(-1);
}
@@ -443,9 +429,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
if (!parser->ok() ||
strncmp("VIEW", parser->type()->str, parser->type()->length))
{
- my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
- (view->db ? view->db : thd->db),
- view->real_name, "VIEW");
+ my_error(ER_WRONG_OBJECT, MYF(0),
+ (view->db ? view->db : thd->db), view->real_name, "VIEW");
DBUG_RETURN(-1);
}
@@ -465,8 +450,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{
if (mode == VIEW_ALTER)
{
- my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
- view->db, view->alias);
+ my_error(ER_NO_SUCH_TABLE, MYF(0), view->db, view->alias);
DBUG_RETURN(-1);
}
}
@@ -529,8 +513,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
if (view->with_check != VIEW_CHECK_NONE &&
!view->updatable_view)
{
- my_printf_error(ER_VIEW_NONUPD_CHECK, ER(ER_VIEW_NONUPD_CHECK), MYF(0),
- view->db, view->real_name);
+ my_error(ER_VIEW_NONUPD_CHECK, MYF(0), view->db, view->real_name);
DBUG_RETURN(-1);
}
@@ -880,11 +863,9 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
continue;
}
if (type)
- my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
- view->db, view->real_name, "VIEW");
+ my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->real_name, "VIEW");
else
- my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
- name);
+ my_error(ER_BAD_TABLE_ERROR, MYF(0), name);
goto err;
}
if (my_delete(path, MYF(MY_WME)))
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 9974c7934dd..11c38a244a2 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1467,8 +1467,7 @@ sp_fdparam:
if (spc->find_pvar(&$1, TRUE))
{
- my_printf_error(ER_SP_DUP_PARAM, ER(ER_SP_DUP_PARAM), MYF(0),
- $1.str);
+ my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
YYABORT;
}
spc->push_pvar(&$1, (enum enum_field_types)$2, sp_param_in);
@@ -1494,8 +1493,7 @@ sp_pdparam:
if (spc->find_pvar(&$2, TRUE))
{
- my_printf_error(ER_SP_DUP_PARAM, ER(ER_SP_DUP_PARAM), MYF(0),
- $2.str);
+ my_error(ER_SP_DUP_PARAM, MYF(0), $2.str);
YYABORT;
}
spc->push_pvar(&$2, (enum enum_field_types)$3,
@@ -1588,8 +1586,7 @@ sp_decl:
if (spc->find_cond(&$2, TRUE))
{
- my_printf_error(ER_SP_DUP_COND, ER(ER_SP_DUP_COND), MYF(0),
- $2.str);
+ my_error(ER_SP_DUP_COND, MYF(0), $2.str);
YYABORT;
}
YYTHD->lex->spcont->push_cond(&$2, $5);
@@ -1646,8 +1643,7 @@ sp_decl:
if (ctx->find_cursor(&$2, &offp, TRUE))
{
- my_printf_error(ER_SP_DUP_CURS, ER(ER_SP_DUP_CURS), MYF(0),
- $2.str);
+ my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
delete $5;
YYABORT;
}
@@ -1751,8 +1747,7 @@ sp_hcond:
$$= Lex->spcont->find_cond(&$1);
if ($$ == NULL)
{
- my_printf_error(ER_SP_COND_MISMATCH, ER(ER_SP_COND_MISMATCH),
- MYF(0), $1.str);
+ my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
YYABORT;
}
}
@@ -1781,8 +1776,7 @@ sp_decl_idents:
if (spc->find_pvar(&$1, TRUE))
{
- my_printf_error(ER_SP_DUP_VAR, ER(ER_SP_DUP_VAR), MYF(0),
- $1.str);
+ my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
YYABORT;
}
spc->push_pvar(&$1, (enum_field_types)0, sp_param_in);
@@ -1795,8 +1789,7 @@ sp_decl_idents:
if (spc->find_pvar(&$3, TRUE))
{
- my_printf_error(ER_SP_DUP_VAR, ER(ER_SP_DUP_VAR), MYF(0),
- $3.str);
+ my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
YYABORT;
}
spc->push_pvar(&$3, (enum_field_types)0, sp_param_in);
@@ -1950,9 +1943,7 @@ sp_proc_stmt:
if (! lab)
{
- my_printf_error(ER_SP_LILABEL_MISMATCH,
- ER(ER_SP_LILABEL_MISMATCH), MYF(0),
- "LEAVE", $2.str);
+ my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
YYABORT;
}
else
@@ -1982,9 +1973,7 @@ sp_proc_stmt:
if (! lab || lab->type != SP_LAB_ITER)
{
- my_printf_error(ER_SP_LILABEL_MISMATCH,
- ER(ER_SP_LILABEL_MISMATCH), MYF(0),
- "ITERATE", $2.str);
+ my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
YYABORT;
}
else
@@ -2012,8 +2001,7 @@ sp_proc_stmt:
if (lab)
{
- my_printf_error(ER_SP_LABEL_REDEFINE,
- ER(ER_SP_LABEL_REDEFINE), MYF(0), $2.str);
+ my_error(ER_SP_LABEL_REDEFINE, MYF(0), $2.str);
YYABORT;
}
else
@@ -2088,8 +2076,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset))
{
- my_printf_error(ER_SP_CURSOR_MISMATCH,
- ER(ER_SP_CURSOR_MISMATCH), MYF(0), $2.str);
+ my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT;
}
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
@@ -2104,8 +2091,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$3, &offset))
{
- my_printf_error(ER_SP_CURSOR_MISMATCH,
- ER(ER_SP_CURSOR_MISMATCH), MYF(0), $3.str);
+ my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
YYABORT;
}
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
@@ -2122,8 +2108,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset))
{
- my_printf_error(ER_SP_CURSOR_MISMATCH,
- ER(ER_SP_CURSOR_MISMATCH), MYF(0), $2.str);
+ my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT;
}
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
@@ -2147,8 +2132,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$1)))
{
- my_printf_error(ER_SP_UNDECLARED_VAR,
- ER(ER_SP_UNDECLARED_VAR), MYF(0), $1.str);
+ my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT;
}
else
@@ -2170,8 +2154,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$3)))
{
- my_printf_error(ER_SP_UNDECLARED_VAR,
- ER(ER_SP_UNDECLARED_VAR), MYF(0), $3.str);
+ my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
YYABORT;
}
else
@@ -2295,8 +2278,7 @@ sp_labeled_control:
if (lab)
{
- my_printf_error(ER_SP_LABEL_REDEFINE,
- ER(ER_SP_LABEL_REDEFINE), MYF(0), $1.str);
+ my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
YYABORT;
}
else
@@ -2317,8 +2299,7 @@ sp_labeled_control:
if (!lab ||
my_strcasecmp(system_charset_info, $5.str, lab->name) != 0)
{
- my_printf_error(ER_SP_LABEL_MISMATCH,
- ER(ER_SP_LABEL_MISMATCH), MYF(0), $5.str);
+ my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
YYABORT;
}
}
@@ -2576,11 +2557,9 @@ default_charset:
cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4))
{
- my_printf_error(ER_CONFLICTING_DECLARATIONS,
- ER(ER_CONFLICTING_DECLARATIONS), MYF(0),
- "CHARACTER SET ",
- cinfo->default_table_charset->csname,
- "CHARACTER SET ", $4->csname);
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ "CHARACTER SET ", cinfo->default_table_charset->csname,
+ "CHARACTER SET ", $4->csname);
YYABORT;
}
Lex->create_info.default_table_charset= $4;
@@ -2595,9 +2574,8 @@ default_collation:
cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4))
{
- my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
- ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
- $4->name, cinfo->default_table_charset->csname);
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ $4->name, cinfo->default_table_charset->csname);
YYABORT;
}
Lex->create_info.default_table_charset= $4;
@@ -2609,8 +2587,7 @@ storage_engines:
{
$$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) {
- my_printf_error(ER_UNKNOWN_STORAGE_ENGINE,
- ER(ER_UNKNOWN_STORAGE_ENGINE), MYF(0), $1.str);
+ my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
YYABORT;
}
};
@@ -2807,10 +2784,8 @@ type:
Lex->uint_geom_type= (uint)$1;
$$=FIELD_TYPE_GEOMETRY;
#else
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0)
- sym_group_geom.name,
- sym_group_geom.needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0)
+ sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
}
@@ -2977,9 +2952,8 @@ attribute:
{
if (Lex->charset && !my_charset_same(Lex->charset,$2))
{
- my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
- ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
- $2->name,Lex->charset->csname);
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ $2->name,Lex->charset->csname);
YYABORT;
}
else
@@ -3004,8 +2978,7 @@ charset_name:
{
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
{
- my_printf_error(ER_UNKNOWN_CHARACTER_SET,
- ER(ER_UNKNOWN_CHARACTER_SET), MYF(0), $1.str);
+ my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
YYABORT;
}
}
@@ -3023,8 +2996,7 @@ old_or_new_charset_name:
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str)))
{
- my_printf_error(ER_UNKNOWN_CHARACTER_SET,
- ER(ER_UNKNOWN_CHARACTER_SET), MYF(0), $1.str);
+ my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
YYABORT;
}
}
@@ -3040,8 +3012,7 @@ collation_name:
{
if (!($$=get_charset_by_name($1.str,MYF(0))))
{
- my_printf_error(ER_UNKNOWN_COLLATION,
- ER(ER_UNKNOWN_COLLATION), MYF(0), $1.str);
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
YYABORT;
}
};
@@ -3130,9 +3101,8 @@ key_type:
#ifdef HAVE_SPATIAL
$$= Key::SPATIAL;
#else
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
};
@@ -3195,9 +3165,7 @@ key_part:
int key_part_len= atoi($3.str);
if (!key_part_len)
{
- my_printf_error(ER_UNKNOWN_ERROR,
- "Key part '%s' length cannot be 0",
- MYF(0), $1.str);
+ my_error(ER_KEY_PART_0, MYF(0), $1.str);
}
$$=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) ||
$3->db.str && check_db_name($3->db.str))
{
- my_printf_error(ER_WRONG_TABLE_NAME, ER(ER_WRONG_TABLE_NAME),
- MYF(0), $3->table.str);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
YYABORT;
}
lex->alter_info.flags|= ALTER_RENAME;
@@ -3422,9 +3389,8 @@ alter_list_item:
$5= $5 ? $5 : $4;
if (!my_charset_same($4,$5))
{
- my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
- ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
- $5->name, $4->csname);
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ $5->name, $4->csname);
YYABORT;
}
LEX *lex= Lex;
@@ -4269,10 +4235,9 @@ simple_expr:
{
if (!$1.symbol->create_func)
{
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0),
- $1.symbol->group->name,
- $1.symbol->group->needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ $1.symbol->group->name,
+ $1.symbol->group->needed_define);
YYABORT;
}
$$= ((Item*(*)(void))($1.symbol->create_func))();
@@ -4281,10 +4246,9 @@ simple_expr:
{
if (!$1.symbol->create_func)
{
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0),
- $1.symbol->group->name,
- $1.symbol->group->needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ $1.symbol->group->name,
+ $1.symbol->group->needed_define);
YYABORT;
}
$$= ((Item*(*)(Item*))($1.symbol->create_func))($3);
@@ -4293,10 +4257,9 @@ simple_expr:
{
if (!$1.symbol->create_func)
{
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0),
- $1.symbol->group->name,
- $1.symbol->group->needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ $1.symbol->group->name,
+ $1.symbol->group->needed_define);
YYABORT;
}
$$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5);
@@ -4305,10 +4268,9 @@ simple_expr:
{
if (!$1.symbol->create_func)
{
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0),
- $1.symbol->group->name,
- $1.symbol->group->needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ $1.symbol->group->name,
+ $1.symbol->group->needed_define);
YYABORT;
}
$$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7);
@@ -4411,9 +4373,8 @@ simple_expr:
#ifdef HAVE_SPATIAL
$$= $1;
#else
- my_printf_error(ER_FEATURE_DISABLED,
- ER(ER_FEATURE_DISABLED), MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
+ my_error(ER_FEATURE_DISABLED, MYF(0),
+ sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
}
@@ -5469,8 +5430,7 @@ select_var_ident:
if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1)))
{
- my_printf_error(ER_SP_UNDECLARED_VAR,
- ER(ER_SP_UNDECLARED_VAR), MYF(0), $1.str);
+ my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT;
}
if (! lex->result)
@@ -5826,9 +5786,8 @@ update:
else if (lex->select_lex.get_table_list()->derived)
{
/* it is single table update and it is update of derived table */
- my_printf_error(ER_NON_UPDATABLE_TABLE,
- ER(ER_NON_UPDATABLE_TABLE), MYF(0),
- lex->select_lex.get_table_list()->alias, "UPDATE");
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
+ lex->select_lex.get_table_list()->alias, "UPDATE");
YYABORT;
}
else
@@ -6686,9 +6645,8 @@ simple_ident_q:
FIXME. Far from perfect solution. See comment for
"SET NEW.field_name:=..." for more info.
*/
- my_printf_error(ER_BAD_FIELD_ERROR,
- ER(ER_BAD_FIELD_ERROR), MYF(0),
- $3.str, new_row ? "NEW": "OLD");
+ my_error(ER_BAD_FIELD_ERROR, MYF(0),
+ $3.str, new_row ? "NEW": "OLD");
YYABORT;
}
@@ -6699,9 +6657,8 @@ simple_ident_q:
SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed)
{
- my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE,
- ER(ER_TABLENAME_NOT_ALLOWED_HERE),
- MYF(0), $1.str, thd->where);
+ my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
+ MYF(0), $1.str, thd->where);
}
$$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
@@ -6716,9 +6673,8 @@ simple_ident_q:
SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed)
{
- my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE,
- ER(ER_TABLENAME_NOT_ALLOWED_HERE),
- MYF(0), $2.str, thd->where);
+ my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
+ MYF(0), $2.str, thd->where);
}
$$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
@@ -6732,9 +6688,8 @@ simple_ident_q:
SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed)
{
- my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE,
- ER(ER_TABLENAME_NOT_ALLOWED_HERE),
- MYF(0), $3.str, thd->where);
+ my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
+ MYF(0), $3.str, thd->where);
}
$$= (sel->parsing_place != IN_HAVING ||
sel->get_in_sum_expr() > 0) ?
@@ -6775,9 +6730,8 @@ IDENT_sys:
$1.length);
if (wlen < $1.length)
{
- my_printf_error(ER_INVALID_CHARACTER_STRING,
- ER(ER_INVALID_CHARACTER_STRING), MYF(0),
- cs->csname, $1.str + wlen);
+ my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
+ cs->csname, $1.str + wlen);
YYABORT;
}
$$= $1;
@@ -7214,8 +7168,7 @@ option_value:
Error message also should be improved.
*/
- my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
- MYF(0), $1.base_name, "NEW");
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), $1.base_name, "NEW");
YYABORT;
}
lex->sphead->add_instr(i);
@@ -7281,9 +7234,8 @@ option_value:
$3= $3 ? $3 : $2;
if (!my_charset_same($2,$3))
{
- my_printf_error(ER_COLLATION_CHARSET_MISMATCH,
- ER(ER_COLLATION_CHARSET_MISMATCH), MYF(0),
- $3->name, $2->csname);
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ $3->name, $2->csname);
YYABORT;
}
lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
@@ -7373,8 +7325,7 @@ internal_variable_name:
if (!tmp)
YYABORT;
if (!tmp->is_struct())
- my_printf_error(ER_VARIABLE_IS_NOT_STRUCT,
- ER(ER_VARIABLE_IS_NOT_STRUCT), MYF(0), $3.str);
+ my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp;
$$.base_name= $1;
}
@@ -7385,8 +7336,7 @@ internal_variable_name:
if (!tmp)
YYABORT;
if (!tmp->is_struct())
- my_printf_error(ER_VARIABLE_IS_NOT_STRUCT,
- ER(ER_VARIABLE_IS_NOT_STRUCT), MYF(0), $3.str);
+ my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp;
$$.base_name.str= (char*) "default";
$$.base_name.length= 7;
diff --git a/sql/table.cc b/sql/table.cc
index 095c3f037d5..e9ce118183f 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -984,12 +984,11 @@ static void frm_error(int error, TABLE *form, const char *name, myf errortype)
uint length=dirname_part(buff,name);
buff[length-1]=0;
db=buff+dirname_length(buff);
- my_printf_error(ER_NO_SUCH_TABLE, ER(ER_NO_SUCH_TABLE), MYF(0),
- db, form->real_name);
+ my_error(ER_NO_SUCH_TABLE, MYF(0), db, form->real_name);
}
else
- my_printf_error(ER_FILE_NOT_FOUND, ER(ER_FILE_NOT_FOUND), errortype,
- fn_format(buff, name, form_dev, reg_ext, 0), my_errno);
+ my_error(ER_FILE_NOT_FOUND, errortype,
+ fn_format(buff, name, form_dev, reg_ext, 0), my_errno);
break;
case 2:
{
@@ -997,15 +996,14 @@ static void frm_error(int error, TABLE *form, const char *name, myf errortype)
datext= datext==NullS ? "" : datext;
err_no= (my_errno == ENOENT) ? ER_FILE_NOT_FOUND : (my_errno == EAGAIN) ?
ER_FILE_USED : ER_CANT_OPEN_FILE;
- my_printf_error(err_no, ER(err_no), errortype,
- fn_format(buff, form->real_name, form_dev, datext, 2),
- my_errno);
+ my_error(err_no, errortype,
+ fn_format(buff, form->real_name, form_dev, datext, 2), my_errno);
break;
}
default: /* Better wrong error than none */
case 4:
- my_printf_error(ER_NOT_FORM_FILE, ER(ER_NOT_FORM_FILE), errortype,
- fn_format(buff, name, form_dev, reg_ext, 0));
+ my_error(ER_NOT_FORM_FILE, errortype,
+ fn_format(buff, name, form_dev, reg_ext, 0));
break;
}
DBUG_VOID_RETURN;
@@ -1728,8 +1726,7 @@ err:
if (thd->net.last_errno == ER_BAD_FIELD_ERROR)
{
thd->clear_error();
- my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0),
- view_db.str, view_name.str);
+ my_error(ER_VIEW_INVALID, MYF(0), view_db.str, view_name.str);
}
thd->lex->select_lex.no_wrap_view_item= save_wrapper;
thd->lex->current_select= current_select_save;
@@ -1783,8 +1780,7 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
}
else
{
- my_printf_error(ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), MYF(0),
- view_db.str, view_name.str);
+ my_error(ER_VIEW_CHECK_FAILED, MYF(0), view_db.str, view_name.str);
return(VIEW_CHECK_ERROR);
}
}
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 268f7d18f2a..4d7c17e977c 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -52,15 +52,30 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
if (*fmt == '-')
fmt++;
length= width= pre_zero= have_long= 0;
- for (;my_isdigit(&my_charset_latin1,*fmt); fmt++)
+ if (*fmt == '*')
{
- length=length*10+ (uint) (*fmt-'0');
- if (!length)
- pre_zero= 1; /* first digit was 0 */
+ fmt++;
+ length= va_arg(ap, int);
}
+ 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 == '.')
- 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
width= ~0;
if (*fmt == 'l')