summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-11-12 15:36:31 +0200
committerunknown <bell@sanja.is.com.ua>2004-11-12 15:36:31 +0200
commit067863e184e9a23034d410919d4c8075ee30bcee (patch)
treeab12f1be1300ed43430653785dd80f2a0e814d11 /sql/set_var.cc
parent980a4188f384902b902f6b5bad2258e0e78df646 (diff)
parent9e921615a1c3147961dc4a8314ebb0e455ea105b (diff)
downloadmariadb-git-067863e184e9a23034d410919d4c8075ee30bcee.tar.gz
merge
include/mysqld_error.h: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/rpl_charset.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/sp.test: Auto merged sql/filesort.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/handler.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_row.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/item_uniq.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysqld.cc: Auto merged sql/parse_file.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/protocol_cursor.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/repl_failsafe.h: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/german/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/sql_udf.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged sql/unireg.cc: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/serbian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc83
1 files changed, 46 insertions, 37 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index ccac3082d5b..a183f815a59 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_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name,
- var->value->str_value.ptr());
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
+ name, var->value->str_value.ptr());
return res;
}
@@ -1174,7 +1174,8 @@ static int check_max_delayed_threads(THD *thd, set_var *var)
val != (longlong) global_system_variables.max_insert_delayed_threads)
{
char buf[64];
- my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf));
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
+ MYF(0), var->var->name, llstr(val, buf));
return 1;
}
return 0;
@@ -1472,7 +1473,8 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names)
return 0;
err:
- my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, value);
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
+ name, value);
return 1;
}
@@ -1513,7 +1515,8 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
return 0;
err:
- my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff);
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
+ MYF(0), name, buff);
return 1;
}
@@ -1537,8 +1540,9 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
{
if (var_type != OPT_DEFAULT)
{
- net_printf(thd, ER_INCORRECT_GLOBAL_LOCAL_VAR,
- name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
+ my_printf_error(ER_INCORRECT_GLOBAL_LOCAL_VAR,
+ ER(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 */
@@ -1581,7 +1585,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
return tmp;
}
default:
- net_printf(thd, ER_VAR_CANT_BE_READ, name);
+ my_printf_error(ER_VAR_CANT_BE_READ, ER(ER_VAR_CANT_BE_READ), MYF(0),
+ name);
}
return 0;
}
@@ -1693,7 +1698,8 @@ 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_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR), MYF(0),
+ name, res->c_ptr());
return 1;
}
@@ -1791,12 +1797,14 @@ 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_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR, ER(ER_WRONG_VALUE_FOR_VAR),
+ MYF(0), name, "NULL");
return 1;
}
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{
- my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr());
+ my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
+ res->c_ptr());
return 1;
}
}
@@ -1806,7 +1814,8 @@ bool sys_var_collation::check(THD *thd, set_var *var)
{
char buf[20];
int10_to_str((int) var->value->val_int(), buf, -10);
- my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
+ my_printf_error(ER_UNKNOWN_COLLATION, ER(ER_UNKNOWN_COLLATION), MYF(0),
+ buf);
return 1;
}
}
@@ -1827,7 +1836,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
{
if (!nullable)
{
- my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
+ my_printf_error(ER_WRONG_VALUE_FOR_VAR,
+ ER(ER_WRONG_VALUE_FOR_VAR), MYF(0), name, "NULL");
return 1;
}
tmp= NULL;
@@ -1835,7 +1845,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) &&
!(tmp=get_old_charset_by_name(res->c_ptr())))
{
- my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
+ my_printf_error(ER_UNKNOWN_CHARACTER_SET, ER(ER_UNKNOWN_CHARACTER_SET),
+ MYF(0), res->c_ptr());
return 1;
}
}
@@ -1967,8 +1978,8 @@ bool sys_var_character_set_server::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running))
{
- my_printf_error(0, "Binary logging and replication forbid changing \
-the global server character set or collation", MYF(0));
+ my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
+ "character set, collation");
return 1;
}
return sys_var_character_set::check(thd,var);
@@ -2074,8 +2085,8 @@ bool sys_var_collation_server::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running))
{
- my_printf_error(0, "Binary logging and replication forbid changing \
-the global server character set or collation", MYF(0));
+ my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
+ "character set, collation");
return 1;
}
return sys_var_collation::check(thd,var);
@@ -2353,7 +2364,7 @@ bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
pthread_mutex_lock(&active_mi->rli.run_lock);
if (active_mi->rli.slave_running)
{
- my_error(ER_SLAVE_MUST_STOP, MYF(0));
+ my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
result=1;
}
pthread_mutex_unlock(&active_mi->rli.run_lock);
@@ -2424,8 +2435,7 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running))
{
- my_printf_error(0, "Binary logging and replication forbid changing "
- "of the global server time zone", MYF(0));
+ my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0), "time zone");
return 1;
}
#endif
@@ -2433,7 +2443,8 @@ 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_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL");
+ my_printf_error(ER_UNKNOWN_TIME_ZONE, ER(ER_UNKNOWN_TIME_ZONE), MYF(0),
+ res ? res->c_ptr() : "NULL");
return 1;
}
return 0;
@@ -2703,9 +2714,6 @@ void set_var_free()
length Length of variable. zero means that we should use strlen()
on the variable
- NOTE
- We have to use net_printf() as this is called during the parsing stage
-
RETURN VALUES
pointer pointer to variable definitions
0 Unknown variable (error message is given)
@@ -2718,7 +2726,8 @@ sys_var *find_sys_var(const char *str, uint length)
length ? length :
strlen(str));
if (!var)
- net_printf(current_thd, ER_UNKNOWN_SYSTEM_VARIABLE, (char*) str);
+ my_printf_error(ER_UNKNOWN_SYSTEM_VARIABLE, ER(ER_UNKNOWN_SYSTEM_VARIABLE),
+ MYF(0), (char*) str);
return var;
}
@@ -2804,9 +2813,8 @@ int set_var::check(THD *thd)
{
if (var->check_type(type))
{
- my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE,
- MYF(0),
- var->name);
+ int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
+ my_printf_error(err, ER(err), MYF(0), var->name);
return -1;
}
if ((type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)))
@@ -2816,7 +2824,7 @@ int set_var::check(THD *thd)
{
if (var->check_default(type))
{
- my_error(ER_NO_DEFAULT, MYF(0), var->name);
+ my_printf_error(ER_NO_DEFAULT, ER(ER_NO_DEFAULT), MYF(0), var->name);
return -1;
}
return 0;
@@ -2826,7 +2834,8 @@ int set_var::check(THD *thd)
return -1;
if (var->check_update_type(value->result_type()))
{
- my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name);
+ my_printf_error(ER_WRONG_TYPE_FOR_VAR, ER(ER_WRONG_TYPE_FOR_VAR), MYF(0),
+ var->name);
return -1;
}
return var->check(thd, this) ? -1 : 0;
@@ -2849,9 +2858,8 @@ int set_var::light_check(THD *thd)
{
if (var->check_type(type))
{
- my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE,
- MYF(0),
- var->name);
+ int err= type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE;
+ my_printf_error(err, ER(err), MYF(0), var->name);
return -1;
}
if (type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL))
@@ -2917,7 +2925,7 @@ int set_var_user::update(THD *thd)
if (user_var_item->update())
{
/* Give an error if it's not given already */
- my_error(ER_SET_CONSTANTS_ONLY, MYF(0));
+ my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), MYF(0));
return -1;
}
return 0;
@@ -2978,8 +2986,9 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
value= "unknown";
err:
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
- return 1;
+ my_printf_error(ER_UNKNOWN_STORAGE_ENGINE, ER(ER_UNKNOWN_STORAGE_ENGINE),
+ MYF(0), value);
+ return 1;
}