Commit c9c92c81 authored by unknown's avatar unknown

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

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new
parents 090b0dd0 b642bb1f
This diff is collapsed.
...@@ -39,6 +39,9 @@ typedef byte *(*sys_value_ptr_func)(THD *thd); ...@@ -39,6 +39,9 @@ typedef byte *(*sys_value_ptr_func)(THD *thd);
class sys_var class sys_var
{ {
public: public:
static sys_var *first;
static uint sys_vars;
sys_var *next;
struct my_option *option_limits; /* Updated by by set_var_init() */ struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */ uint name_length; /* Updated by by set_var_init() */
const char *name; const char *name;
...@@ -48,12 +51,18 @@ class sys_var ...@@ -48,12 +51,18 @@ class sys_var
sys_var(const char *name_arg) sys_var(const char *name_arg)
:name(name_arg), after_update(0) :name(name_arg), after_update(0)
, no_support_one_shot(1) , no_support_one_shot(1)
{} { add_sys_var(); }
sys_var(const char *name_arg,sys_after_update_func func) sys_var(const char *name_arg,sys_after_update_func func)
:name(name_arg), after_update(func) :name(name_arg), after_update(func)
, no_support_one_shot(1) , no_support_one_shot(1)
{} { add_sys_var(); }
virtual ~sys_var() {} virtual ~sys_var() {}
void add_sys_var()
{
next= first;
first= this;
sys_vars++;
}
virtual bool check(THD *thd, set_var *var); virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names); bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
bool check_set(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 ...@@ -701,6 +710,30 @@ class sys_var_readonly: public sys_var
bool is_readonly() const { return 1; } 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 class sys_var_thd_time_zone :public sys_var_thd
{ {
public: public:
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
We are using pointer to this variable for distinguishing between assignment We are using pointer to this variable for distinguishing between assignment
to NEW row field (when parsing trigger definition) and structured variable. 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 */ /* Macros to look like lex */
......
...@@ -702,7 +702,7 @@ struct st_trg_chistics ...@@ -702,7 +702,7 @@ struct st_trg_chistics
enum trg_event_type event; 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, enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
XA_SUSPEND, XA_FOR_MIGRATE}; XA_SUSPEND, XA_FOR_MIGRATE};
......
...@@ -8529,7 +8529,7 @@ sys_option_value: ...@@ -8529,7 +8529,7 @@ sys_option_value:
{ {
LEX *lex=Lex; 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 */ /* We are in trigger and assigning value to field of new row */
Item *it; Item *it;
...@@ -8750,7 +8750,7 @@ internal_variable_name: ...@@ -8750,7 +8750,7 @@ internal_variable_name:
YYABORT; YYABORT;
} }
/* This special combination will denote field of NEW row */ /* This special combination will denote field of NEW row */
$$.var= &trg_new_row_fake_var; $$.var= trg_new_row_fake_var;
$$.base_name= $3; $$.base_name= $3;
} }
else 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