2002-07-23 17:31:22 +02:00
|
|
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
/* Classes to support the SET command */
|
|
|
|
|
2005-05-04 15:05:56 +02:00
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
2002-07-23 17:31:22 +02:00
|
|
|
#pragma interface /* gcc class implementation */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
Variables that are changable runtime are declared using the
|
|
|
|
following classes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
class sys_var;
|
|
|
|
class set_var;
|
|
|
|
typedef struct system_variables SV;
|
2003-01-16 01:04:50 +01:00
|
|
|
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
|
2002-07-23 17:31:22 +02:00
|
|
|
|
2004-02-16 18:53:00 +01:00
|
|
|
typedef int (*sys_check_func)(THD *, set_var *);
|
2002-07-23 17:31:22 +02:00
|
|
|
typedef bool (*sys_update_func)(THD *, set_var *);
|
|
|
|
typedef void (*sys_after_update_func)(THD *,enum_var_type);
|
|
|
|
typedef void (*sys_set_default_func)(THD *, enum_var_type);
|
2002-10-02 12:33:08 +02:00
|
|
|
typedef byte *(*sys_value_ptr_func)(THD *thd);
|
2002-07-23 17:31:22 +02:00
|
|
|
|
|
|
|
class sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct my_option *option_limits; /* Updated by by set_var_init() */
|
|
|
|
uint name_length; /* Updated by by set_var_init() */
|
|
|
|
const char *name;
|
2003-07-06 18:09:57 +02:00
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_after_update_func after_update;
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
bool no_support_one_shot;
|
|
|
|
sys_var(const char *name_arg)
|
|
|
|
:name(name_arg), after_update(0)
|
|
|
|
, no_support_one_shot(1)
|
|
|
|
{}
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_var(const char *name_arg,sys_after_update_func func)
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
:name(name_arg), after_update(func)
|
|
|
|
, no_support_one_shot(1)
|
2003-08-18 23:08:08 +02:00
|
|
|
{}
|
2002-07-23 17:31:22 +02:00
|
|
|
virtual ~sys_var() {}
|
2003-10-24 16:28:32 +02:00
|
|
|
virtual bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
|
2003-01-16 01:04:50 +01:00
|
|
|
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
|
2002-07-23 17:31:22 +02:00
|
|
|
virtual bool update(THD *thd, set_var *var)=0;
|
|
|
|
virtual void set_default(THD *thd, enum_var_type type) {}
|
|
|
|
virtual SHOW_TYPE type() { return SHOW_UNDEF; }
|
2003-07-06 18:09:57 +02:00
|
|
|
virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return 0; }
|
2002-07-23 17:31:22 +02:00
|
|
|
virtual bool check_type(enum_var_type type)
|
|
|
|
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */
|
|
|
|
virtual bool check_update_type(Item_result type)
|
|
|
|
{ return type != INT_RESULT; } /* Assume INT */
|
|
|
|
virtual bool check_default(enum_var_type type)
|
|
|
|
{ return option_limits == 0; }
|
2003-07-06 18:09:57 +02:00
|
|
|
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
virtual bool is_struct() { return 0; }
|
2005-05-13 13:18:27 +02:00
|
|
|
virtual bool is_readonly() const { return 0; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_long_ptr :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ulong *value;
|
|
|
|
sys_var_long_ptr(const char *name_arg, ulong *value_ptr)
|
|
|
|
:sys_var(name_arg),value(value_ptr) {}
|
|
|
|
sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
|
|
|
|
sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func), value(value_ptr) {}
|
2005-02-17 12:04:04 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-12-05 15:38:49 +01:00
|
|
|
class sys_var_ulonglong_ptr :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ulonglong *value;
|
|
|
|
sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr)
|
|
|
|
:sys_var(name_arg),value(value_ptr) {}
|
|
|
|
sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr,
|
|
|
|
sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func), value(value_ptr) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-12-05 15:38:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_bool_ptr :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
my_bool *value;
|
|
|
|
sys_var_bool_ptr(const char *name_arg, my_bool *value_arg)
|
|
|
|
:sys_var(name_arg),value(value_arg)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, &bool_typelib);
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_str :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char *value; // Pointer to allocated string
|
SCRUM:
Task 499 'init_connect, init_slave options'
mysql-test/mysql-test-run.sh:
Task 499 'init_connect, init_slave options'
This change needs because mysql-test-run cuts string variable on first space
sql/mysql_priv.h:
Task 499 'init_connect, init_slave options'
sql/mysqld.cc:
Task 499 'init_connect, init_slave options'
sql/protocol.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.h:
Task 499 'init_connect, init_slave options'
sql/slave.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.h:
Task 499 'init_connect, init_slave options'
sql/sql_parse.cc:
Task 499 'init_connect, init_slave options'
sql/sql_show.cc:
Task 499 'init_connect, init_slave options'
2003-07-18 11:11:01 +02:00
|
|
|
uint value_length;
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_check_func check_func;
|
|
|
|
sys_update_func update_func;
|
|
|
|
sys_set_default_func set_default_func;
|
|
|
|
sys_var_str(const char *name_arg,
|
|
|
|
sys_check_func check_func_arg,
|
|
|
|
sys_update_func update_func_arg,
|
2004-03-20 14:36:00 +01:00
|
|
|
sys_set_default_func set_default_func_arg,
|
|
|
|
char *value_arg)
|
2004-03-22 14:43:13 +01:00
|
|
|
:sys_var(name_arg), value(value_arg), check_func(check_func_arg),
|
2002-07-23 17:31:22 +02:00
|
|
|
update_func(update_func_arg),set_default_func(set_default_func_arg)
|
|
|
|
{}
|
2004-02-16 18:53:00 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return (*update_func)(thd, var);
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type)
|
|
|
|
{
|
2002-08-08 02:12:02 +02:00
|
|
|
(*set_default_func)(thd, type);
|
2002-07-23 17:31:22 +02:00
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{ return (byte*) value; }
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-03-06 09:43:35 +01:00
|
|
|
class sys_var_const_str :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char *value; // Pointer to const value
|
|
|
|
sys_var_const_str(const char *name_arg, const char *value_arg)
|
|
|
|
:sys_var(name_arg), value((char*) value_arg)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2004-03-17 09:30:40 +01:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|
|
|
{
|
|
|
|
return (byte*) value;
|
|
|
|
}
|
2004-03-06 09:43:35 +01:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
2005-09-07 12:38:09 +02:00
|
|
|
bool is_readonly() const { return 1; }
|
2004-03-06 09:43:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-08-13 01:18:39 +02:00
|
|
|
class sys_var_enum :public sys_var
|
|
|
|
{
|
|
|
|
uint *value;
|
|
|
|
TYPELIB *enum_names;
|
|
|
|
public:
|
|
|
|
sys_var_enum(const char *name_arg, uint *value_arg,
|
|
|
|
TYPELIB *typelib, sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, enum_names);
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-08-13 01:18:39 +02:00
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_thd :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd(const char *name_arg)
|
|
|
|
:sys_var(name_arg)
|
|
|
|
{}
|
|
|
|
sys_var_thd(const char *name_arg, sys_after_update_func func)
|
|
|
|
:sys_var(name_arg,func)
|
|
|
|
{}
|
|
|
|
bool check_type(enum_var_type type) { return 0; }
|
|
|
|
bool check_default(enum_var_type type)
|
|
|
|
{
|
|
|
|
return type == OPT_GLOBAL && !option_limits;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_thd_ulong :public sys_var_thd
|
|
|
|
{
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func check_func;
|
2002-07-23 17:31:22 +02:00
|
|
|
public:
|
|
|
|
ulong SV::*offset;
|
|
|
|
sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg)
|
2004-03-27 01:07:09 +01:00
|
|
|
:sys_var_thd(name_arg), check_func(0), offset(offset_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
|
|
|
sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg,
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func c_func, sys_after_update_func au_func)
|
|
|
|
:sys_var_thd(name_arg,au_func), check_func(c_func), offset(offset_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
2004-03-27 01:07:09 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-12-20 13:58:27 +01:00
|
|
|
class sys_var_thd_ha_rows :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ha_rows SV::*offset;
|
|
|
|
sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg,
|
|
|
|
sys_after_update_func func)
|
|
|
|
:sys_var_thd(name_arg,func), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_HA_ROWS; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-12-20 13:58:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_thd_ulonglong :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ulonglong SV::*offset;
|
2003-05-13 18:34:51 +02:00
|
|
|
bool only_global;
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
2002-11-11 16:28:58 +01:00
|
|
|
sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg,
|
2003-05-13 18:34:51 +02:00
|
|
|
sys_after_update_func func, bool only_global_arg)
|
|
|
|
:sys_var_thd(name_arg, func), offset(offset_arg),
|
|
|
|
only_global(only_global_arg)
|
2002-11-11 16:28:58 +01:00
|
|
|
{}
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-05-13 18:34:51 +02:00
|
|
|
bool check_default(enum_var_type type)
|
|
|
|
{
|
|
|
|
return type == OPT_GLOBAL && !option_limits;
|
|
|
|
}
|
|
|
|
bool check_type(enum_var_type type)
|
|
|
|
{
|
|
|
|
return (only_global && type != OPT_GLOBAL);
|
|
|
|
}
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_thd_bool :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
my_bool SV::*offset;
|
|
|
|
sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg,
|
|
|
|
sys_after_update_func func)
|
|
|
|
:sys_var_thd(name_arg,func), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, &bool_typelib);
|
|
|
|
}
|
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_thd_enum :public sys_var_thd
|
|
|
|
{
|
2003-01-16 01:04:50 +01:00
|
|
|
protected:
|
2002-07-23 17:31:22 +02:00
|
|
|
ulong SV::*offset;
|
|
|
|
TYPELIB *enum_names;
|
|
|
|
public:
|
|
|
|
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
|
|
|
|
TYPELIB *typelib)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib)
|
|
|
|
{}
|
|
|
|
sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
|
|
|
|
TYPELIB *typelib,
|
|
|
|
sys_after_update_func func)
|
|
|
|
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_enum(thd, var, enum_names);
|
|
|
|
}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
extern void fix_sql_mode_var(THD *thd, enum_var_type type);
|
|
|
|
|
2003-01-16 01:04:50 +01:00
|
|
|
class sys_var_thd_sql_mode :public sys_var_thd_enum
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_sql_mode(const char *name_arg, ulong SV::*offset_arg)
|
2003-06-04 17:28:51 +02:00
|
|
|
:sys_var_thd_enum(name_arg, offset_arg, &sql_mode_typelib,
|
|
|
|
fix_sql_mode_var)
|
2003-01-16 01:04:50 +01:00
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var)
|
|
|
|
{
|
|
|
|
return check_set(thd, var, enum_names);
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2005-07-28 21:39:11 +02:00
|
|
|
static byte *symbolic_mode_representation(THD *thd, ulong sql_mode,
|
|
|
|
ulong *length);
|
2003-01-16 01:04:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-12-17 23:52:03 +01:00
|
|
|
class sys_var_thd_storage_engine :public sys_var_thd
|
2003-12-02 21:23:13 +01:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
ulong SV::*offset;
|
|
|
|
public:
|
2003-12-17 23:52:03 +01:00
|
|
|
sys_var_thd_storage_engine(const char *name_arg, ulong SV::*offset_arg)
|
2003-12-02 21:23:13 +01:00
|
|
|
:sys_var_thd(name_arg), offset(offset_arg)
|
|
|
|
{}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
|
|
|
|
2003-12-17 23:52:03 +01:00
|
|
|
class sys_var_thd_table_type :public sys_var_thd_storage_engine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_table_type(const char *name_arg, ulong SV::*offset_arg)
|
|
|
|
:sys_var_thd_storage_engine(name_arg, offset_arg)
|
|
|
|
{}
|
|
|
|
void warn_deprecated(THD *thd);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
};
|
2003-12-02 21:23:13 +01:00
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_thd_bit :public sys_var_thd
|
|
|
|
{
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_check_func check_func;
|
2002-07-23 17:31:22 +02:00
|
|
|
sys_update_func update_func;
|
|
|
|
public:
|
|
|
|
ulong bit_flag;
|
|
|
|
bool reverse;
|
2004-03-27 01:07:09 +01:00
|
|
|
sys_var_thd_bit(const char *name_arg,
|
|
|
|
sys_check_func c_func, sys_update_func u_func,
|
|
|
|
ulong bit, bool reverse_arg=0)
|
|
|
|
:sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
|
|
|
|
bit_flag(bit), reverse(reverse_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{}
|
2004-03-27 01:07:09 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2002-07-23 17:31:22 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_update_type(Item_result type) { return 0; }
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* some variables that require special handling */
|
|
|
|
|
|
|
|
class sys_var_timestamp :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_timestamp(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_last_insert_id :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_last_insert_id(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class sys_var_insert_id :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_insert_id(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-06-10 15:56:13 +02:00
|
|
|
#ifdef HAVE_REPLICATION
|
2002-07-23 17:31:22 +02:00
|
|
|
class sys_var_slave_skip_counter :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_slave_skip_counter(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
|
|
|
|
/*
|
|
|
|
We can't retrieve the value of this, so we don't have to define
|
|
|
|
type() or value_ptr()
|
|
|
|
*/
|
|
|
|
};
|
2004-06-10 15:56:13 +02:00
|
|
|
|
|
|
|
class sys_var_sync_binlog_period :public sys_var_long_ptr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_sync_binlog_period(const char *name_arg, ulong *value_ptr)
|
|
|
|
:sys_var_long_ptr(name_arg,value_ptr) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
};
|
2002-12-16 14:33:29 +01:00
|
|
|
#endif
|
2002-07-23 17:31:22 +02:00
|
|
|
|
2002-11-07 03:02:37 +01:00
|
|
|
class sys_var_rand_seed1 :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_rand_seed1(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_rand_seed2 :public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_rand_seed2(const char *name_arg) :sys_var(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-04-07 13:10:27 +02:00
|
|
|
class sys_var_collation :public sys_var_thd
|
2003-02-26 13:37:41 +01:00
|
|
|
{
|
|
|
|
public:
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
sys_var_collation(const char *name_arg) :sys_var_thd(name_arg)
|
|
|
|
{
|
|
|
|
no_support_one_shot= 0;
|
|
|
|
}
|
2003-02-26 13:37:41 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2003-04-07 13:10:27 +02:00
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-02-26 13:37:41 +01:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
return ((type != STRING_RESULT) && (type != INT_RESULT));
|
2003-02-26 13:37:41 +01:00
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
2003-04-07 13:10:27 +02:00
|
|
|
virtual void set_default(THD *thd, enum_var_type type)= 0;
|
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_character_set :public sys_var_thd
|
2003-04-07 13:10:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-05-30 10:56:02 +02:00
|
|
|
bool nullable;
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
sys_var_character_set(const char *name_arg) :
|
|
|
|
sys_var_thd(name_arg)
|
|
|
|
{
|
|
|
|
nullable= 0;
|
|
|
|
/*
|
|
|
|
In fact only almost all variables derived from sys_var_character_set
|
|
|
|
support ONE_SHOT; character_set_results doesn't. But that's good enough.
|
|
|
|
*/
|
|
|
|
no_support_one_shot= 0;
|
|
|
|
}
|
2003-05-21 14:44:12 +02:00
|
|
|
bool check(THD *thd, set_var *var);
|
2004-03-30 21:13:25 +02:00
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
2003-05-21 14:44:12 +02:00
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
return ((type != STRING_RESULT) && (type != INT_RESULT));
|
2003-05-21 14:44:12 +02:00
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
2003-05-30 10:03:56 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-05-21 14:44:12 +02:00
|
|
|
virtual void set_default(THD *thd, enum_var_type type)= 0;
|
2003-05-30 10:03:56 +02:00
|
|
|
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
|
2003-05-21 14:44:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_character_set_client :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_client(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
2003-04-07 13:10:27 +02:00
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-05-30 10:03:56 +02:00
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
2003-04-07 13:10:27 +02:00
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_character_set_results :public sys_var_character_set
|
2003-04-07 13:10:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-05-21 14:44:12 +02:00
|
|
|
sys_var_character_set_results(const char *name_arg) :
|
2003-05-30 10:56:02 +02:00
|
|
|
sys_var_character_set(name_arg)
|
|
|
|
{ nullable= 1; }
|
2003-04-07 13:10:27 +02:00
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-05-30 10:03:56 +02:00
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_character_set_server :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_server(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_character_set_database :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_database(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
2003-02-26 13:37:41 +01:00
|
|
|
};
|
|
|
|
|
2003-05-30 10:24:24 +02:00
|
|
|
class sys_var_character_set_connection :public sys_var_character_set
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_character_set_connection(const char *name_arg) :
|
|
|
|
sys_var_character_set(name_arg) {}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
2003-05-21 14:44:12 +02:00
|
|
|
class sys_var_collation_connection :public sys_var_collation
|
2003-04-08 11:38:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-05-21 14:44:12 +02:00
|
|
|
sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
|
2003-04-08 11:38:17 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-04-08 11:38:17 +02:00
|
|
|
};
|
|
|
|
|
2003-09-15 13:31:04 +02:00
|
|
|
class sys_var_collation_server :public sys_var_collation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
|
|
|
|
|
|
|
class sys_var_collation_database :public sys_var_collation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
2003-07-06 18:09:57 +02:00
|
|
|
|
2003-11-18 12:47:27 +01:00
|
|
|
|
2003-10-02 05:20:17 +02:00
|
|
|
class sys_var_key_cache_param :public sys_var
|
2003-07-06 18:09:57 +02:00
|
|
|
{
|
2003-10-02 05:20:17 +02:00
|
|
|
protected:
|
2003-11-18 12:47:27 +01:00
|
|
|
size_t offset;
|
2003-07-06 18:09:57 +02:00
|
|
|
public:
|
2003-11-18 12:47:27 +01:00
|
|
|
sys_var_key_cache_param(const char *name_arg, size_t offset_arg)
|
|
|
|
:sys_var(name_arg), offset(offset_arg)
|
|
|
|
{}
|
2003-10-02 05:20:17 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
2003-11-18 12:47:27 +01:00
|
|
|
bool check_default(enum_var_type type) { return 1; }
|
|
|
|
bool is_struct() { return 1; }
|
2003-10-02 05:20:17 +02:00
|
|
|
};
|
|
|
|
|
2003-11-18 12:47:27 +01:00
|
|
|
|
2003-10-02 05:20:17 +02:00
|
|
|
class sys_var_key_buffer_size :public sys_var_key_cache_param
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_key_buffer_size(const char *name_arg)
|
2003-11-20 21:06:25 +01:00
|
|
|
:sys_var_key_cache_param(name_arg, offsetof(KEY_CACHE, param_buff_size))
|
2003-11-18 12:47:27 +01:00
|
|
|
{}
|
2003-07-06 18:09:57 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
2003-10-02 05:20:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-18 12:47:27 +01:00
|
|
|
class sys_var_key_cache_long :public sys_var_key_cache_param
|
2003-10-02 05:20:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2003-11-18 12:47:27 +01:00
|
|
|
sys_var_key_cache_long(const char *name_arg, size_t offset_arg)
|
|
|
|
:sys_var_key_cache_param(name_arg, offset_arg)
|
|
|
|
{}
|
2003-10-02 05:20:17 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_LONG; }
|
2003-07-06 18:09:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-03 13:01:59 +01:00
|
|
|
class sys_var_thd_date_time_format :public sys_var_thd
|
2003-10-20 10:24:18 +02:00
|
|
|
{
|
2003-11-03 13:01:59 +01:00
|
|
|
DATE_TIME_FORMAT *SV::*offset;
|
Fix for Bug#4030 "Client side conversion string -> date type doesn't
work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.
VC++Files/libmysql/libmysql.dsp:
new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
new file: my_time.c
VC++Files/sql/mysqld.dsp:
new file: my_time.c
include/Makefile.am:
- mysql_time.h added to the list of installed client library headers
include/mysql.h:
- declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to
mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
- my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
Fix for bug#4030 "Client side conversion string -> date type doesn't work
(prepared statements)" and cleanup.
- added case labels for TIME/DATE/DATETIME types to send_data_str
- comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
- my_time.c added
sql-common/Makefile.am:
- my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
my_time.c added to the list of mysqld sources.
sql/field.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
- added typedefs for TIME and timestamp_type
- removed declarations for str_to_time and str_to_TIME (now this functions
reside in mysys)
sql/mysqld.cc:
- log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
- enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
- fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
- TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
- embedded library implementation of set_param_{time,date,datetime} is
much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
- s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
- declarations for TIME and timestamp_type replaced with typedefs
- str_to_datetime arguments moved to mysys headers
sql/time.cc:
- str_to_time and str_to_TIME moved to mysys
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
exported to client.
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
- a test case for Bug#4030 "Client side conversion string -> date type
doesn't work (prepared statements)"
2004-06-24 17:08:36 +02:00
|
|
|
timestamp_type date_time_type;
|
2003-10-20 10:24:18 +02:00
|
|
|
public:
|
2003-11-03 13:01:59 +01:00
|
|
|
sys_var_thd_date_time_format(const char *name_arg,
|
|
|
|
DATE_TIME_FORMAT *SV::*offset_arg,
|
|
|
|
timestamp_type date_time_type_arg)
|
|
|
|
:sys_var_thd(name_arg), offset(offset_arg),
|
|
|
|
date_time_type(date_time_type_arg)
|
2003-10-20 10:24:18 +02:00
|
|
|
{}
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
2003-11-03 13:01:59 +01:00
|
|
|
bool check(THD *thd, set_var *var);
|
2003-10-20 10:24:18 +02:00
|
|
|
bool update(THD *thd, set_var *var);
|
2003-11-03 13:01:59 +01:00
|
|
|
void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
|
2003-10-20 10:24:18 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
/* Variable that you can only read from */
|
|
|
|
|
|
|
|
class sys_var_readonly: public sys_var
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum_var_type var_type;
|
|
|
|
SHOW_TYPE show_type;
|
|
|
|
sys_value_ptr_func value_ptr_func;
|
|
|
|
sys_var_readonly(const char *name_arg, enum_var_type type,
|
|
|
|
SHOW_TYPE show_type_arg,
|
|
|
|
sys_value_ptr_func value_ptr_func_arg)
|
|
|
|
:sys_var(name_arg), var_type(type),
|
|
|
|
show_type(show_type_arg), value_ptr_func(value_ptr_func_arg)
|
|
|
|
{}
|
|
|
|
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 != var_type; }
|
|
|
|
bool check_update_type(Item_result type) { return 1; }
|
2003-07-06 18:09:57 +02:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
|
|
|
return (*value_ptr_func)(thd);
|
|
|
|
}
|
|
|
|
SHOW_TYPE type() { return show_type; }
|
2005-05-13 13:18:27 +02:00
|
|
|
bool is_readonly() const { return 1; }
|
2002-10-02 12:33:08 +02:00
|
|
|
};
|
|
|
|
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
class sys_var_thd_time_zone :public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_thd_time_zone(const char *name_arg):
|
|
|
|
sys_var_thd(name_arg)
|
|
|
|
{
|
|
|
|
no_support_one_shot= 0;
|
|
|
|
}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
SHOW_TYPE type() { return SHOW_CHAR; }
|
|
|
|
bool check_update_type(Item_result type)
|
|
|
|
{
|
|
|
|
return type != STRING_RESULT; /* Only accept strings */
|
|
|
|
}
|
|
|
|
bool check_default(enum_var_type type) { return 0; }
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
virtual void set_default(THD *thd, enum_var_type type);
|
|
|
|
};
|
|
|
|
|
2004-12-29 18:30:37 +01:00
|
|
|
|
|
|
|
class sys_var_max_user_conn : public sys_var_thd
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var_max_user_conn(const char *name_arg):
|
|
|
|
sys_var_thd(name_arg) {}
|
|
|
|
bool check(THD *thd, set_var *var);
|
|
|
|
bool update(THD *thd, set_var *var);
|
|
|
|
bool check_default(enum_var_type type)
|
|
|
|
{
|
|
|
|
return type != OPT_GLOBAL || !option_limits;
|
|
|
|
}
|
|
|
|
void set_default(THD *thd, enum_var_type type);
|
2005-01-19 22:54:01 +01:00
|
|
|
SHOW_TYPE type() { return SHOW_INT; }
|
2004-12-29 18:30:37 +01:00
|
|
|
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
|
|
|
};
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
/****************************************************************************
|
|
|
|
Classes for parsing of the SET command
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
class set_var_base :public Sql_alloc
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
set_var_base() {}
|
|
|
|
virtual ~set_var_base() {}
|
2002-09-22 17:02:39 +02:00
|
|
|
virtual int check(THD *thd)=0; /* To check privileges etc. */
|
|
|
|
virtual int update(THD *thd)=0; /* To set the value */
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/* light check for PS */
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
virtual int light_check(THD *thd) { return check(thd); }
|
|
|
|
virtual bool no_support_one_shot() { return 1; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* MySQL internal variables, like query_cache_size */
|
|
|
|
|
|
|
|
class set_var :public set_var_base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sys_var *var;
|
|
|
|
Item *value;
|
|
|
|
enum_var_type type;
|
|
|
|
union
|
|
|
|
{
|
2003-02-26 13:37:41 +01:00
|
|
|
CHARSET_INFO *charset;
|
2002-07-23 17:31:22 +02:00
|
|
|
ulong ulong_value;
|
2003-10-24 16:28:32 +02:00
|
|
|
ulonglong ulonglong_value;
|
2003-11-03 13:01:59 +01:00
|
|
|
DATE_TIME_FORMAT *date_time_format;
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
Time_zone *time_zone;
|
2002-07-23 17:31:22 +02:00
|
|
|
} save_result;
|
2003-08-18 23:08:08 +02:00
|
|
|
LEX_STRING base; /* for structs */
|
2002-07-23 17:31:22 +02:00
|
|
|
|
XA (not completely polished out yet)
include/my_pthread.h:
cleanup. don't use gcc extensions
innobase/include/trx0sys.ic:
Jan's fix for innobase_xa_prepare
innobase/read/read0read.c:
Jan's fix for innobase_xa_prepare
innobase/trx/trx0trx.c:
Jan's fix for innobase_xa_prepare
mysql-test/include/varchar.inc:
test fix
mysql-test/r/ctype_ucs.result:
new log event - all binlog positions are changed :(
mysql-test/r/drop_temp_table.result:
new log event - all binlog positions are changed :(
mysql-test/r/insert_select.result:
new log event - all binlog positions are changed :(
mysql-test/r/mix_innodb_myisam_binlog.result:
new log event - all binlog positions are changed :(
mysql-test/r/myisam.result:
test fix
mysql-test/r/rpl000015.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_change_master.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_charset.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_error_ignored_table.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_flush_log_loop.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_flush_tables.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_loaddata.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_loaddata_rule_m.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_loaddata_rule_s.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_log.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_log_pos.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_max_relay_size.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_relayrotate.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_replicate_do.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_reset_slave.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_rotate_logs.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_server_id1.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_server_id2.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_temporary.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_timezone.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_until.result:
new log event - all binlog positions are changed :(
mysql-test/r/rpl_user_variables.result:
new log event - all binlog positions are changed :(
mysql-test/r/user_var.result:
new log event - all binlog positions are changed :(
mysql-test/t/ctype_ucs.test:
new log event - all binlog positions are changed :(
mysql-test/t/mix_innodb_myisam_binlog.test:
new log event - all binlog positions are changed :(
mysql-test/t/mysqlbinlog.test:
new log event - all binlog positions are changed :(
mysql-test/t/mysqlbinlog2.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_charset.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_error_ignored_table.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_loaddata_rule_m.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_loaddata_rule_s.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_log.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_log_pos.test:
new log event - all binlog positions are changed :(
mysql-test/t/rpl_user_variables.test:
new log event - all binlog positions are changed :(
mysql-test/t/user_var.test:
new log event - all binlog positions are changed :(
mysys/hash.c:
typo fixed
sql/ha_berkeley.cc:
handlerton framework
sql/ha_berkeley.h:
handlerton framework
sql/ha_innodb.cc:
handlerton framework
sql/ha_innodb.h:
handlerton framework
sql/handler.cc:
new transaction handling, handlerton framework, two-phase commit, XA support
sql/handler.h:
new transaction handling, handlerton framework, two-phase commit, XA support
sql/lex.h:
XA commands
sql/log.cc:
new transaction handling, handlerton framework, two-phase commit,
XA support, tc-logging, TC_LOG_MMAP class
sql/log_event.cc:
Xid_log_event
sql/log_event.h:
Xid_log_event, LOG_EVENT_BINLOG_CLOSED_F flag
sql/mysql_priv.h:
wrapper for query_id++
sql/mysqld.cc:
new command-line options --log-tc, --log-tc-size, --tc-heuristic-recover,
new status variables Tc_log_page_size, Tc_log_max_pages_used, Tc_log_page_waits.
init/stop tc logging
sql/set_var.h:
warning fixed
sql/share/errmsg.txt:
XA error messages
sql/sp_head.cc:
s/query_id++/next_query_id()/
sql/sql_base.cc:
typo fixed. new transaction handling.
sql/sql_class.cc:
cleanup of THD.transaction
sql/sql_class.h:
TC_LOG classes, new status variables, new savepoint handling, XA support
sql/sql_insert.cc:
comments
sql/sql_lex.cc:
s/found_colon/found_semicolon/
sql/sql_lex.h:
SQLCOM_XA_xxx, XA related changes in Lex
sql/sql_parse.cc:
cleanup, XA commands, new savepoint handling
sql/sql_repl.cc:
two functions moved to log.cc
sql/sql_repl.h:
two functions moved to log.cc
sql/sql_trigger.cc:
s/lex.name_and_length/lex.ident/
sql/sql_yacc.yy:
XA commands, cleanup
2005-01-16 13:16:23 +01:00
|
|
|
set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg,
|
2003-08-18 23:08:08 +02:00
|
|
|
Item *value_arg)
|
|
|
|
:var(var_arg), type(type_arg), base(*base_name_arg)
|
2002-07-23 17:31:22 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
If the set value is a field, change it to a string to allow things like
|
|
|
|
SET table_type=MYISAM;
|
|
|
|
*/
|
|
|
|
if (value_arg && value_arg->type() == Item::FIELD_ITEM)
|
|
|
|
{
|
|
|
|
Item_field *item= (Item_field*) value_arg;
|
2005-06-13 12:41:15 +02:00
|
|
|
if (!(value=new Item_string(item->field_name,
|
|
|
|
(uint) strlen(item->field_name),
|
2003-08-05 09:52:37 +02:00
|
|
|
item->collation.collation)))
|
2002-07-23 17:31:22 +02:00
|
|
|
value=value_arg; /* Give error message later */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
value=value_arg;
|
|
|
|
}
|
2002-09-22 17:02:39 +02:00
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
int light_check(THD *thd);
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
bool no_support_one_shot() { return var->no_support_one_shot; }
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* User variables like @my_own_variable */
|
|
|
|
|
|
|
|
class set_var_user: public set_var_base
|
|
|
|
{
|
|
|
|
Item_func_set_user_var *user_var_item;
|
|
|
|
public:
|
|
|
|
set_var_user(Item_func_set_user_var *item)
|
|
|
|
:user_var_item(item)
|
|
|
|
{}
|
2002-09-22 17:02:39 +02:00
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
int light_check(THD *thd);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* For SET PASSWORD */
|
|
|
|
|
|
|
|
class set_var_password: public set_var_base
|
|
|
|
{
|
|
|
|
LEX_USER *user;
|
|
|
|
char *password;
|
|
|
|
public:
|
|
|
|
set_var_password(LEX_USER *user_arg,char *password_arg)
|
|
|
|
:user(user_arg), password(password_arg)
|
|
|
|
{}
|
2002-09-22 17:02:39 +02:00
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
2002-07-23 17:31:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-04-05 12:59:29 +02:00
|
|
|
/* For SET NAMES and SET CHARACTER SET */
|
|
|
|
|
2003-04-23 15:19:22 +02:00
|
|
|
class set_var_collation_client: public set_var_base
|
2003-04-05 12:59:29 +02:00
|
|
|
{
|
2003-05-21 14:44:12 +02:00
|
|
|
CHARSET_INFO *character_set_client;
|
|
|
|
CHARSET_INFO *character_set_results;
|
2003-04-23 15:19:22 +02:00
|
|
|
CHARSET_INFO *collation_connection;
|
2003-04-05 12:59:29 +02:00
|
|
|
public:
|
2003-04-23 15:19:22 +02:00
|
|
|
set_var_collation_client(CHARSET_INFO *client_coll_arg,
|
2003-04-22 09:27:35 +02:00
|
|
|
CHARSET_INFO *connection_coll_arg,
|
2003-04-08 11:38:17 +02:00
|
|
|
CHARSET_INFO *result_coll_arg)
|
2003-05-21 14:44:12 +02:00
|
|
|
:character_set_client(client_coll_arg),
|
|
|
|
character_set_results(result_coll_arg),
|
|
|
|
collation_connection(connection_coll_arg)
|
2003-04-05 12:59:29 +02:00
|
|
|
{}
|
|
|
|
int check(THD *thd);
|
|
|
|
int update(THD *thd);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-07-06 18:09:57 +02:00
|
|
|
/* Named lists (used for keycaches) */
|
|
|
|
|
|
|
|
class NAMED_LIST :public ilink
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
uint name_length;
|
|
|
|
public:
|
|
|
|
gptr data;
|
|
|
|
|
|
|
|
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
|
2003-08-18 23:08:08 +02:00
|
|
|
uint name_length_arg, gptr data_arg)
|
|
|
|
:name_length(name_length_arg), data(data_arg)
|
|
|
|
{
|
2003-11-18 12:47:27 +01:00
|
|
|
name= my_strdup_with_length((byte*) name_arg, name_length, MYF(MY_WME));
|
2003-08-18 23:08:08 +02:00
|
|
|
links->push_back(this);
|
|
|
|
}
|
2003-07-06 18:09:57 +02:00
|
|
|
inline bool cmp(const char *name_cmp, uint length)
|
|
|
|
{
|
|
|
|
return length == name_length && !memcmp(name, name_cmp, length);
|
|
|
|
}
|
|
|
|
~NAMED_LIST()
|
|
|
|
{
|
|
|
|
my_free((char*) name, MYF(0));
|
|
|
|
}
|
2003-11-18 12:47:27 +01:00
|
|
|
friend bool process_key_caches(int (* func) (const char *name,
|
2003-11-20 21:06:25 +01:00
|
|
|
KEY_CACHE *));
|
2003-11-18 12:47:27 +01:00
|
|
|
friend void delete_elements(I_List<NAMED_LIST> *list,
|
|
|
|
void (*free_element)(const char*, gptr));
|
2003-07-06 18:09:57 +02:00
|
|
|
};
|
|
|
|
|
2003-07-09 16:24:43 +02:00
|
|
|
/* updated in sql_acl.cc */
|
|
|
|
|
|
|
|
extern sys_var_thd_bool sys_old_passwords;
|
2003-11-18 12:47:27 +01:00
|
|
|
extern LEX_STRING default_key_cache_base;
|
2003-07-06 18:09:57 +02:00
|
|
|
|
2003-08-18 23:08:08 +02:00
|
|
|
/* For sql_yacc */
|
|
|
|
struct sys_var_with_base
|
|
|
|
{
|
|
|
|
sys_var *var;
|
|
|
|
LEX_STRING base_name;
|
|
|
|
};
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
/*
|
|
|
|
Prototypes for helper functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
void set_var_init();
|
|
|
|
void set_var_free();
|
|
|
|
sys_var *find_sys_var(const char *str, uint length=0);
|
2002-09-22 17:02:39 +02:00
|
|
|
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
|
Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill.
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput if query uses
variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
mysql-test/r/rpl_server_id1.result:
it's normal to not run as I have added a test to compare server ids of master and slave
at startup and stop if equal (unless --replicate-same-server-id)
mysql-test/r/rpl_user_variables.result:
result update (as we now print charset of user var).
mysql-test/r/user_var.result:
result update
mysql-test/t/rpl_server_id1.test:
no need to select as slave is not running
mysql-test/t/user_var.test:
testing if the content of user vars is escaped when mysqlbinlog prints them,
and if the name is backquoted.
sql/lex.h:
new keyword ONE_SHOT
sql/log.cc:
when writing to the binlog, before writing the actual statement, write some SET ONE_SHOT CHARACTER_SET_CLIENT etc
for the slave to know the charset variables (which are important as they affect the inserted data).
sql/log_event.cc:
print charset and collation of user var in mysqlbinlog and SHOW BINLOG EVENTS.
escape the content of the var. Backquote its name.
Will ask Bar to check that using my_charset_bin for escaping is ok.
sql/set_var.cc:
understand SET CHARACTER_SET_CLIENT=10 (don't require a string, accept a number).
Refuse changing of GLOBAL CHARACTER_SET_SERVER/COLLATION_SERVER if binlog or slave,
as it will make the master or slave make wrong assumptions.
A function to catch SET ONE_SHOT on non-charset variables (which is forbidden)
sql/set_var.h:
no_support_one_shot to know if the var supports ONE_SHOT (only charset vars do, soon timezones).
Accept int arg in SET CHARACTER_SET_etc
sql/slave.cc:
when I/O slave thread starts, verify that master's and slave charsets match.
And by the way verify that server ids are different.
Don't fail if UNIX_TIMESTAMP() can't be done on master (very old master), that's
not fatal.
sql/sql_class.cc:
one_shot
sql/sql_class.h:
one_shot
sql/sql_lex.h:
one_shot
sql/sql_parse.cc:
when SET ONE_SHOT is used, verify that it's only used for charset/collation vars;
otherwise refuse.
sql/sql_yacc.yy:
ONE_SHOT keyword in SET
2004-06-03 23:17:18 +02:00
|
|
|
bool not_all_support_one_shot(List<set_var_base> *var_list);
|
2002-08-13 01:18:39 +02:00
|
|
|
void fix_delay_key_write(THD *thd, enum_var_type type);
|
2003-06-04 17:28:51 +02:00
|
|
|
ulong fix_sql_mode(ulong sql_mode);
|
2005-09-07 12:38:09 +02:00
|
|
|
extern sys_var_const_str sys_charset_system;
|
SCRUM:
Task 499 'init_connect, init_slave options'
mysql-test/mysql-test-run.sh:
Task 499 'init_connect, init_slave options'
This change needs because mysql-test-run cuts string variable on first space
sql/mysql_priv.h:
Task 499 'init_connect, init_slave options'
sql/mysqld.cc:
Task 499 'init_connect, init_slave options'
sql/protocol.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.cc:
Task 499 'init_connect, init_slave options'
sql/set_var.h:
Task 499 'init_connect, init_slave options'
sql/slave.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.cc:
Task 499 'init_connect, init_slave options'
sql/sql_class.h:
Task 499 'init_connect, init_slave options'
sql/sql_parse.cc:
Task 499 'init_connect, init_slave options'
sql/sql_show.cc:
Task 499 'init_connect, init_slave options'
2003-07-18 11:11:01 +02:00
|
|
|
extern sys_var_str sys_init_connect;
|
|
|
|
extern sys_var_str sys_init_slave;
|
2004-08-10 10:42:31 +02:00
|
|
|
extern sys_var_thd_time_zone sys_time_zone;
|
2005-09-13 17:16:12 +02:00
|
|
|
extern sys_var_thd_bit sys_autocommit;
|
2003-04-05 15:56:15 +02:00
|
|
|
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
|
2003-08-18 23:08:08 +02:00
|
|
|
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
|
|
|
|
NAMED_LIST **found);
|
2003-07-06 18:09:57 +02:00
|
|
|
|
|
|
|
/* key_cache functions */
|
2003-11-20 21:06:25 +01:00
|
|
|
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
|
|
|
|
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
|
|
|
|
void free_key_cache(const char *name, KEY_CACHE *key_cache);
|
|
|
|
bool process_key_caches(int (* func) (const char *name, KEY_CACHE *));
|
2003-11-20 02:11:33 +01:00
|
|
|
void delete_elements(I_List<NAMED_LIST> *list,
|
|
|
|
void (*free_element)(const char*, gptr));
|