Commit 9b532768 authored by ramil@poseidon.ndb.mysql.com's avatar ramil@poseidon.ndb.mysql.com

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new
parents c1038ded 63a497a1
This diff is collapsed.
......@@ -39,6 +39,9 @@ typedef byte *(*sys_value_ptr_func)(THD *thd);
class sys_var
{
public:
static sys_var *first;
static uint sys_vars;
sys_var *next;
struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */
const char *name;
......@@ -48,12 +51,18 @@ class sys_var
sys_var(const char *name_arg)
:name(name_arg), after_update(0)
, no_support_one_shot(1)
{}
{ add_sys_var(); }
sys_var(const char *name_arg,sys_after_update_func func)
:name(name_arg), after_update(func)
, no_support_one_shot(1)
{}
{ add_sys_var(); }
virtual ~sys_var() {}
void add_sys_var()
{
next= first;
first= this;
sys_vars++;
}
virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
......@@ -701,6 +710,30 @@ class sys_var_readonly: public sys_var
bool is_readonly() const { return 1; }
};
class sys_var_have_variable: public sys_var
{
SHOW_COMP_OPTION *have_variable;
public:
sys_var_have_variable(const char *variable_name,
SHOW_COMP_OPTION *have_variable_arg):
sys_var(variable_name),
have_variable(have_variable_arg)
{ }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return (byte*) show_comp_option_name[*have_variable];
}
bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; }
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
bool check_update_type(Item_result type) { return 1; }
SHOW_TYPE type() { return SHOW_CHAR; }
bool is_readonly() const { return 1; }
};
class sys_var_thd_time_zone :public sys_var_thd
{
public:
......
......@@ -28,7 +28,8 @@
We are using pointer to this variable for distinguishing between assignment
to NEW row field (when parsing trigger definition) and structured variable.
*/
sys_var_long_ptr trg_new_row_fake_var(0, 0);
sys_var *trg_new_row_fake_var= (sys_var*) 0x01;
/* Macros to look like lex */
......
......@@ -702,7 +702,7 @@ struct st_trg_chistics
enum trg_event_type event;
};
extern sys_var_long_ptr trg_new_row_fake_var;
extern sys_var *trg_new_row_fake_var;
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
XA_SUSPEND, XA_FOR_MIGRATE};
......
......@@ -8529,7 +8529,7 @@ sys_option_value:
{
LEX *lex=Lex;
if ($2.var == &trg_new_row_fake_var)
if ($2.var == trg_new_row_fake_var)
{
/* We are in trigger and assigning value to field of new row */
Item *it;
......@@ -8750,7 +8750,7 @@ internal_variable_name:
YYABORT;
}
/* This special combination will denote field of NEW row */
$$.var= &trg_new_row_fake_var;
$$.var= trg_new_row_fake_var;
$$.base_name= $3;
}
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment