MDEV-5231: Per query variables from Percona Server (rewritten)
This commit is contained in:
parent
a03dd94be8
commit
1827d9e6d1
@ -218,13 +218,13 @@ drop event events_test.mysqltest_user1;
|
||||
drop user mysqltest_user1@localhost;
|
||||
drop database mysqltest_db1;
|
||||
create event e_53 on schedule at (select s1 from ttx) do drop table t;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
||||
ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
|
||||
create event e_53 on schedule every (select s1 from ttx) second do drop table t;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
||||
ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
|
||||
create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
||||
ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
|
||||
create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
||||
ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
|
||||
drop event if exists e_16;
|
||||
drop procedure if exists p_16;
|
||||
create event e_16 on schedule every 1 second do set @a=5;
|
||||
@ -265,7 +265,7 @@ begin
|
||||
call p22830_wait();
|
||||
select 123;
|
||||
end|
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
||||
ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
|
||||
create event e22830_1 on schedule every 1 hour do
|
||||
begin
|
||||
call p22830_wait();
|
||||
|
@ -24,7 +24,7 @@ SELECT 4;
|
||||
4
|
||||
4
|
||||
KILL (SELECT COUNT(*) FROM mysql.user);
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
||||
ERROR 42000: KILL does not support subqueries or stored functions.
|
||||
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
|
||||
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
|
||||
|
1102
mysql-test/r/set_statement.result
Normal file
1102
mysql-test/r/set_statement.result
Normal file
File diff suppressed because it is too large
Load Diff
22
mysql-test/r/set_statement_debug.result
Normal file
22
mysql-test/r/set_statement_debug.result
Normal file
@ -0,0 +1,22 @@
|
||||
set @save_debug_dbug= @@debug_dbug;
|
||||
set statement debug_dbug="d,something" for select @@debug_dbug;
|
||||
@@debug_dbug
|
||||
d,something
|
||||
set @@debug_dbug= @save_debug_dbug;
|
||||
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
|
||||
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
|
||||
CALL mtr.add_suppression("Out of sort memory");
|
||||
SET statement debug_dbug= '+d,alloc_sort_buffer_fail' for SELECT * FROM t1 ORDER BY f1 ASC, f0;
|
||||
ERROR HY001: Out of sort memory, consider increasing server sort buffer size
|
||||
SELECT * FROM t1 ORDER BY f1 ASC, f0;
|
||||
f0 f1
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
6 5
|
||||
DROP TABLE t1;
|
||||
set @@debug_dbug= @save_debug_dbug;
|
||||
set statement DEBUG_SYNC = 'now SIGNAL hi' for select 1;
|
||||
ERROR 42000: The system variable debug_sync cannot be set in SET STATEMENT.
|
4
mysql-test/r/set_statement_profiling.result
Normal file
4
mysql-test/r/set_statement_profiling.result
Normal file
@ -0,0 +1,4 @@
|
||||
set statement profiling=default for select 1;
|
||||
ERROR 42000: The system variable profiling cannot be set in SET STATEMENT.
|
||||
set statement profiling_history_size=default for select 1;
|
||||
ERROR 42000: The system variable profiling_history_size cannot be set in SET STATEMENT.
|
31
mysql-test/suite/rpl/include/rpl_set_statement.inc
Normal file
31
mysql-test/suite/rpl/include/rpl_set_statement.inc
Normal file
@ -0,0 +1,31 @@
|
||||
#Check if the variable is replicated correctly with "SET STATEMENT"
|
||||
# Usage:
|
||||
# $rpl_ssvt_var_name - the name of tested variable;
|
||||
# $rpl_ssvt_var_value - the value to set;
|
||||
# $rpl_ssvt_table - the table name to insert values.
|
||||
|
||||
--connection master
|
||||
--echo [connection master]
|
||||
eval SELECT @@$rpl_ssvt_var_name;
|
||||
|
||||
--connection slave
|
||||
--echo [connection slave]
|
||||
eval SELECT @@$rpl_ssvt_var_name;
|
||||
|
||||
--connection master
|
||||
--echo [connection master]
|
||||
--disable_result_log
|
||||
eval SET STATEMENT $rpl_ssvt_var_name=$rpl_ssvt_var_value FOR
|
||||
INSERT INTO $rpl_ssvt_table VALUES(@@$rpl_ssvt_var_name);
|
||||
--enable_result_log
|
||||
eval SELECT @@$rpl_ssvt_var_name;
|
||||
|
||||
--sync_slave_with_master
|
||||
--echo [connection slave]
|
||||
eval SELECT * FROM $rpl_ssvt_table;
|
||||
eval SELECT @@$rpl_ssvt_var_name;
|
||||
|
||||
--connection master
|
||||
--echo [connection master]
|
||||
eval DELETE FROM $rpl_ssvt_table;
|
||||
|
140
mysql-test/suite/rpl/r/rpl_set_statement.result
Normal file
140
mysql-test/suite/rpl/r/rpl_set_statement.result
Normal file
@ -0,0 +1,140 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log*");
|
||||
CREATE TABLE t1 (a bigint unsigned not null);
|
||||
CREATE TABLE t2 (a char(255) not null);
|
||||
|
||||
There are the following types of variables:
|
||||
1) variables that are NOT replicated correctly when using STATEMENT mode;
|
||||
|
||||
[connection master]
|
||||
SELECT @@max_join_size;
|
||||
@@max_join_size
|
||||
18446744073709551615
|
||||
[connection slave]
|
||||
SELECT @@max_join_size;
|
||||
@@max_join_size
|
||||
18446744073709551615
|
||||
[connection master]
|
||||
SET STATEMENT max_join_size=2 FOR
|
||||
INSERT INTO t1 VALUES(@@max_join_size);
|
||||
SELECT @@max_join_size;
|
||||
@@max_join_size
|
||||
18446744073709551615
|
||||
[connection slave]
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
18446744073709551615
|
||||
SELECT @@max_join_size;
|
||||
@@max_join_size
|
||||
18446744073709551615
|
||||
[connection master]
|
||||
DELETE FROM t1;
|
||||
|
||||
2) variables thar ARE replicated correctly
|
||||
They must be replicated correctly with "SET STATEMENT" too.
|
||||
|
||||
[connection master]
|
||||
SELECT @@auto_increment_increment;
|
||||
@@auto_increment_increment
|
||||
1
|
||||
[connection slave]
|
||||
SELECT @@auto_increment_increment;
|
||||
@@auto_increment_increment
|
||||
1
|
||||
[connection master]
|
||||
SET STATEMENT auto_increment_increment=10 FOR
|
||||
INSERT INTO t1 VALUES(@@auto_increment_increment);
|
||||
SELECT @@auto_increment_increment;
|
||||
@@auto_increment_increment
|
||||
1
|
||||
[connection slave]
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
10
|
||||
SELECT @@auto_increment_increment;
|
||||
@@auto_increment_increment
|
||||
1
|
||||
[connection master]
|
||||
DELETE FROM t1;
|
||||
|
||||
3) sql_mode which is replicated correctly exept NO_DIR_IN_CREATE value;
|
||||
|
||||
[connection master]
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection slave]
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection master]
|
||||
SET STATEMENT sql_mode='ERROR_FOR_DIVISION_BY_ZERO' FOR
|
||||
INSERT INTO t2 VALUES(@@sql_mode);
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection slave]
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
ERROR_FOR_DIVISION_BY_ZERO
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection master]
|
||||
DELETE FROM t2;
|
||||
[connection master]
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection slave]
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection master]
|
||||
SET STATEMENT sql_mode='NO_DIR_IN_CREATE' FOR
|
||||
INSERT INTO t2 VALUES(@@sql_mode);
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection slave]
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
[connection master]
|
||||
DELETE FROM t2;
|
||||
|
||||
4) variables that are not replicated at all:
|
||||
default_storage_engine, storage_engine, max_heap_table_size
|
||||
|
||||
[connection master]
|
||||
SELECT @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
1048576
|
||||
[connection slave]
|
||||
SELECT @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
1048576
|
||||
[connection master]
|
||||
SET STATEMENT max_heap_table_size=16384 FOR
|
||||
INSERT INTO t1 VALUES(@@max_heap_table_size);
|
||||
SELECT @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
1048576
|
||||
[connection slave]
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1048576
|
||||
SELECT @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
1048576
|
||||
[connection master]
|
||||
DELETE FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
include/stop_slave.inc
|
57
mysql-test/suite/rpl/t/rpl_set_statement.test
Normal file
57
mysql-test/suite/rpl/t/rpl_set_statement.test
Normal file
@ -0,0 +1,57 @@
|
||||
--source include/master-slave.inc
|
||||
--source include/have_binlog_format_statement.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log*");
|
||||
CREATE TABLE t1 (a bigint unsigned not null);
|
||||
CREATE TABLE t2 (a char(255) not null);
|
||||
|
||||
--echo
|
||||
--echo There are the following types of variables:
|
||||
--echo 1) variables that are NOT replicated correctly when using STATEMENT mode;
|
||||
--echo
|
||||
|
||||
--let $rpl_ssvt_var_name=max_join_size
|
||||
--let $rpl_ssvt_var_value=2
|
||||
--let $rpl_ssvt_table=t1
|
||||
--source suite/rpl/include/rpl_set_statement.inc
|
||||
|
||||
--echo
|
||||
--echo 2) variables thar ARE replicated correctly
|
||||
--echo They must be replicated correctly with "SET STATEMENT" too.
|
||||
--echo
|
||||
--let $rpl_ssvt_var_name=auto_increment_increment
|
||||
--let $rpl_ssvt_var_value=10
|
||||
--let $rpl_ssvt_table=t1
|
||||
--source suite/rpl/include/rpl_set_statement.inc
|
||||
|
||||
--echo
|
||||
--echo 3) sql_mode which is replicated correctly exept NO_DIR_IN_CREATE value;
|
||||
--echo
|
||||
--let $rpl_ssvt_var_name=sql_mode
|
||||
--let $rpl_ssvt_var_value='ERROR_FOR_DIVISION_BY_ZERO'
|
||||
--let $rpl_ssvt_table=t2
|
||||
--source suite/rpl/include/rpl_set_statement.inc
|
||||
--let $rpl_ssvt_var_name=sql_mode
|
||||
--let $rpl_ssvt_var_value='NO_DIR_IN_CREATE'
|
||||
--let $rpl_ssvt_table=t2
|
||||
--source suite/rpl/include/rpl_set_statement.inc
|
||||
|
||||
--echo
|
||||
--echo 4) variables that are not replicated at all:
|
||||
--echo default_storage_engine, storage_engine, max_heap_table_size
|
||||
--echo
|
||||
--let $rpl_ssvt_var_name=max_heap_table_size
|
||||
--let $rpl_ssvt_var_value=16384
|
||||
--let $rpl_ssvt_table=t1
|
||||
--source suite/rpl/include/rpl_set_statement.inc
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
sync_slave_with_master;
|
||||
source include/stop_slave.inc;
|
@ -508,13 +508,13 @@ drop database mysqltest_db1;
|
||||
#
|
||||
# START - BUG#16394: Events: Crash if schedule contains SELECT
|
||||
#
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||
create event e_53 on schedule at (select s1 from ttx) do drop table t;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||
create event e_53 on schedule every (select s1 from ttx) second do drop table t;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||
create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||
create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
|
||||
#
|
||||
# END - BUG#16394: Events: Crash if schedule contains SELECT
|
||||
@ -570,7 +570,7 @@ begin
|
||||
select release_lock('ee_22830');
|
||||
end|
|
||||
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||
create event e22830 on schedule every f22830() second do
|
||||
begin
|
||||
call p22830_wait();
|
||||
|
@ -70,7 +70,7 @@ connection con2;
|
||||
SELECT 4;
|
||||
connection default;
|
||||
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||
KILL (SELECT COUNT(*) FROM mysql.user);
|
||||
|
||||
connection con1;
|
||||
|
1049
mysql-test/t/set_statement.test
Normal file
1049
mysql-test/t/set_statement.test
Normal file
File diff suppressed because it is too large
Load Diff
24
mysql-test/t/set_statement_debug.test
Normal file
24
mysql-test/t/set_statement_debug.test
Normal file
@ -0,0 +1,24 @@
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
set @save_debug_dbug= @@debug_dbug;
|
||||
|
||||
# check that change debug_dbug visible in SELECT
|
||||
set statement debug_dbug="d,something" for select @@debug_dbug;
|
||||
set @@debug_dbug= @save_debug_dbug;
|
||||
|
||||
#check that change debug_dbug has influence of hooks...
|
||||
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
|
||||
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
|
||||
CALL mtr.add_suppression("Out of sort memory");
|
||||
--error ER_OUT_OF_SORTMEMORY
|
||||
SET statement debug_dbug= '+d,alloc_sort_buffer_fail' for SELECT * FROM t1 ORDER BY f1 ASC, f0;
|
||||
|
||||
# ... and works only for one statement
|
||||
SELECT * FROM t1 ORDER BY f1 ASC, f0;
|
||||
|
||||
DROP TABLE t1;
|
||||
set @@debug_dbug= @save_debug_dbug;
|
||||
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement DEBUG_SYNC = 'now SIGNAL hi' for select 1;
|
9
mysql-test/t/set_statement_profiling.test
Normal file
9
mysql-test/t/set_statement_profiling.test
Normal file
@ -0,0 +1,9 @@
|
||||
source include/have_profiling.inc;
|
||||
|
||||
#
|
||||
# Prohibited Variables
|
||||
#
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement profiling=default for select 1;
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement profiling_history_size=default for select 1;
|
11
sql/item.h
11
sql/item.h
@ -2819,6 +2819,16 @@ protected:
|
||||
fixed= 1;
|
||||
}
|
||||
public:
|
||||
Item_string(CHARSET_INFO *csi, const char *str_arg, uint length_arg)
|
||||
: m_cs_specified(FALSE)
|
||||
{
|
||||
collation.set(csi, DERIVATION_COERCIBLE);
|
||||
set_name(NULL, 0, system_charset_info);
|
||||
decimals= NOT_FIXED_DEC;
|
||||
fixed= 1;
|
||||
str_value.copy(str_arg, length_arg, csi);
|
||||
max_length= str_value.numchars() * csi->mbmaxlen;
|
||||
}
|
||||
// Constructors with the item name set from its value
|
||||
Item_string(const char *str, uint length, CHARSET_INFO *cs,
|
||||
Derivation dv, uint repertoire)
|
||||
@ -2954,6 +2964,7 @@ public:
|
||||
}
|
||||
return MYSQL_TYPE_STRING; // Not a temporal literal
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -5547,7 +5547,7 @@ get_var_with_binlog(THD *thd, enum_sql_command sql_command,
|
||||
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
|
||||
new Item_null())));
|
||||
/* Create the variable */
|
||||
if (sql_set_variables(thd, &tmp_var_list))
|
||||
if (sql_set_variables(thd, &tmp_var_list, false))
|
||||
{
|
||||
thd->lex= sav_lex;
|
||||
goto err;
|
||||
|
@ -567,6 +567,7 @@ static SYMBOL symbols[] = {
|
||||
{ "START", SYM(START_SYM)},
|
||||
{ "STARTING", SYM(STARTING)},
|
||||
{ "STARTS", SYM(STARTS_SYM)},
|
||||
{ "STATEMENT", SYM(STATEMENT_SYM)},
|
||||
{ "STATS_AUTO_RECALC",SYM(STATS_AUTO_RECALC_SYM)},
|
||||
{ "STATS_PERSISTENT", SYM(STATS_PERSISTENT_SYM)},
|
||||
{ "STATS_SAMPLE_PAGES",SYM(STATS_SAMPLE_PAGES_SYM)},
|
||||
|
@ -147,7 +147,7 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
|
||||
flags(flags_arg), show_val_type(show_val_type_arg),
|
||||
guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func),
|
||||
deprecation_substitute(substitute),
|
||||
is_os_charset(FALSE)
|
||||
is_os_charset(FALSE), default_val(FALSE)
|
||||
{
|
||||
/*
|
||||
There is a limitation in handle_options() related to short options:
|
||||
@ -675,9 +675,10 @@ sys_var *intern_find_sys_var(const char *str, uint length)
|
||||
-1 ERROR, message not sent
|
||||
*/
|
||||
|
||||
int sql_set_variables(THD *thd, List<set_var_base> *var_list)
|
||||
int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool free)
|
||||
{
|
||||
int error;
|
||||
int error= 0;
|
||||
bool was_error= thd->is_error();
|
||||
List_iterator_fast<set_var_base> it(*var_list);
|
||||
DBUG_ENTER("sql_set_variables");
|
||||
|
||||
@ -687,7 +688,7 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
|
||||
if ((error= var->check(thd)))
|
||||
goto err;
|
||||
}
|
||||
if (!(error= MY_TEST(thd->is_error())))
|
||||
if (was_error || !(error= MY_TEST(thd->is_error())))
|
||||
{
|
||||
it.rewind();
|
||||
while ((var= it++))
|
||||
@ -695,7 +696,8 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
|
||||
}
|
||||
|
||||
err:
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
if (free)
|
||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
@ -788,6 +790,7 @@ int set_var::light_check(THD *thd)
|
||||
*/
|
||||
int set_var::update(THD *thd)
|
||||
{
|
||||
var->set_is_default(value == 0);
|
||||
return value ? var->update(thd, this) : var->set_default(thd, this);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,8 @@ public:
|
||||
sys_var *next;
|
||||
LEX_CSTRING name;
|
||||
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
|
||||
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 };
|
||||
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096,
|
||||
NO_SET_STATEMENT=8192};
|
||||
enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 };
|
||||
enum where { CONFIG, AUTO, SQL, COMPILE_TIME, ENV };
|
||||
|
||||
@ -87,6 +88,7 @@ protected:
|
||||
on_update_function on_update;
|
||||
const char *const deprecation_substitute;
|
||||
bool is_os_charset; ///< true if the value is in character_set_filesystem
|
||||
bool default_val;
|
||||
|
||||
public:
|
||||
sys_var(sys_var_chain *chain, const char *name_arg, const char *comment,
|
||||
@ -133,6 +135,7 @@ public:
|
||||
that support the syntax @@keycache_name.variable_name
|
||||
*/
|
||||
bool is_struct() { return option.var_type & GET_ASK_ADDR; }
|
||||
bool is_set_stmt_ok() const { return !(flags & NO_SET_STATEMENT); }
|
||||
bool is_written_to_binlog(enum_var_type type)
|
||||
{ return type != OPT_GLOBAL && binlog_status == SESSION_VARIABLE_IN_BINLOG; }
|
||||
bool check_update_type(Item_result type)
|
||||
@ -191,6 +194,8 @@ public:
|
||||
return insert_dynamic(array, (uchar*)&option);
|
||||
}
|
||||
void do_deprecated_warning(THD *thd);
|
||||
bool is_default() { return default_val; }
|
||||
void set_is_default(bool def) { default_val= def; }
|
||||
|
||||
virtual uchar *default_value_ptr(THD *thd)
|
||||
{ return (uchar*)&option.def_value; }
|
||||
@ -249,6 +254,7 @@ public:
|
||||
virtual int check(THD *thd)=0; /* To check privileges etc. */
|
||||
virtual int update(THD *thd)=0; /* To set the value */
|
||||
virtual int light_check(THD *thd) { return check(thd); } /* for PS */
|
||||
virtual bool is_system() { return FALSE; }
|
||||
};
|
||||
|
||||
|
||||
@ -290,6 +296,7 @@ public:
|
||||
else
|
||||
value=value_arg;
|
||||
}
|
||||
virtual bool is_system() { return 1; }
|
||||
int check(THD *thd);
|
||||
int update(THD *thd);
|
||||
int light_check(THD *thd);
|
||||
@ -388,7 +395,7 @@ SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type type);
|
||||
int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond);
|
||||
|
||||
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
|
||||
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
|
||||
int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool free);
|
||||
|
||||
#define SYSVAR_AUTOSIZE(VAR,VAL) \
|
||||
do { \
|
||||
|
@ -7111,3 +7111,7 @@ ER_TABLE_DEFINITION_TOO_BIG
|
||||
eng "The definition for table %`s is too big"
|
||||
ER_STATEMENT_TIMEOUT 70100
|
||||
eng "Query execution was interrupted (max_statement_time exceeded)"
|
||||
ER_SUBQUERIES_NOT_SUPPORTED 42000
|
||||
eng "%s does not support subqueries or stored functions."
|
||||
ER_SET_STATEMENT_NOT_SUPPORTED 42000
|
||||
eng "The system variable %.200s cannot be set in SET STATEMENT."
|
||||
|
@ -3441,6 +3441,7 @@ void Query_arena::free_items()
|
||||
{
|
||||
next= free_list->next;
|
||||
DBUG_ASSERT(free_list != next);
|
||||
DBUG_PRINT("info", ("free item: 0x%lx", (ulong) free_list));
|
||||
free_list->delete_self();
|
||||
}
|
||||
/* Postcondition: free_list is 0 */
|
||||
|
@ -3826,6 +3826,10 @@ public:
|
||||
thr_timer_end(&query_timer);
|
||||
#endif
|
||||
}
|
||||
void restore_set_statement_var()
|
||||
{
|
||||
main_lex.restore_set_statement_var();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -542,6 +542,8 @@ void lex_start(THD *thd)
|
||||
lex->reset_slave_info.all= false;
|
||||
lex->limit_rows_examined= 0;
|
||||
lex->limit_rows_examined_cnt= ULONGLONG_MAX;
|
||||
lex->var_list.empty();
|
||||
lex->stmt_var_list.empty();
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -4233,6 +4235,17 @@ int LEX::print_explain(select_result_sink *output, uint8 explain_flags,
|
||||
return res;
|
||||
}
|
||||
|
||||
void LEX::restore_set_statement_var()
|
||||
{
|
||||
DBUG_ENTER("LEX::restore_set_statement_var");
|
||||
if (!old_var_list.is_empty())
|
||||
{
|
||||
DBUG_PRINT("info", ("vars: %d", old_var_list.elements));
|
||||
sql_set_variables(thd, &old_var_list, false);
|
||||
old_var_list.empty();
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
Save explain structures of a UNION. The only variable member is whether the
|
||||
|
@ -2401,6 +2401,8 @@ struct LEX: public Query_tables_list
|
||||
List<Item> *insert_list,field_list,value_list,update_list;
|
||||
List<List_item> many_values;
|
||||
List<set_var_base> var_list;
|
||||
List<set_var_base> stmt_var_list; //SET_STATEMENT values
|
||||
List<set_var_base> old_var_list; // SET STATEMENT old values
|
||||
List<Item_func_set_user_var> set_var_list; // in-query assignment list
|
||||
List<Item_param> param_list;
|
||||
List<LEX_STRING> view_list; // view list (list of field names in view)
|
||||
@ -2775,6 +2777,7 @@ struct LEX: public Query_tables_list
|
||||
|
||||
int print_explain(select_result_sink *output, uint8 explain_flags,
|
||||
bool is_analyze, bool *printed_anything);
|
||||
void restore_set_statement_var();
|
||||
};
|
||||
|
||||
|
||||
|
106
sql/sql_parse.cc
106
sql/sql_parse.cc
@ -2635,6 +2635,101 @@ mysql_execute_command(THD *thd)
|
||||
thd->get_binlog_format(&orig_binlog_format,
|
||||
&orig_current_stmt_binlog_format);
|
||||
|
||||
if (!lex->stmt_var_list.is_empty() && !thd->slave_thread)
|
||||
{
|
||||
DBUG_PRINT("info", ("SET STATEMENT %d vars", lex->stmt_var_list.elements));
|
||||
|
||||
lex->old_var_list.empty();
|
||||
List_iterator_fast<set_var_base> it(lex->stmt_var_list);
|
||||
set_var_base *var;
|
||||
while ((var=it++))
|
||||
{
|
||||
DBUG_ASSERT(var->is_system());
|
||||
set_var *o= NULL, *v= (set_var*)var;
|
||||
if (!v->var->is_set_stmt_ok())
|
||||
{
|
||||
my_error(ER_SET_STATEMENT_NOT_SUPPORTED, MYF(0), v->var->name.str);
|
||||
goto error;
|
||||
}
|
||||
if (v->var->is_default())
|
||||
o= new set_var(v->type, v->var, &v->base, NULL);
|
||||
else
|
||||
{
|
||||
switch (v->var->option.var_type & GET_TYPE_MASK)
|
||||
{
|
||||
case GET_BOOL:
|
||||
case GET_INT:
|
||||
case GET_LONG:
|
||||
case GET_LL:
|
||||
{
|
||||
bool null_value;
|
||||
longlong val= v->var->val_int(&null_value, thd, v->type, &v->base);
|
||||
o= new set_var(v->type, v->var, &v->base,
|
||||
(null_value ?
|
||||
(Item *)new Item_null() :
|
||||
(Item *)new Item_int(val)));
|
||||
}
|
||||
break;
|
||||
case GET_UINT:
|
||||
case GET_ULONG:
|
||||
case GET_ULL:
|
||||
{
|
||||
bool null_value;
|
||||
ulonglong val= v->var->val_int(&null_value, thd, v->type, &v->base);
|
||||
o= new set_var(v->type, v->var, &v->base,
|
||||
(null_value ?
|
||||
(Item *)new Item_null() :
|
||||
(Item *)new Item_uint(val)));
|
||||
}
|
||||
break;
|
||||
case GET_DOUBLE:
|
||||
{
|
||||
bool null_value;
|
||||
double val= v->var->val_real(&null_value, thd, v->type, &v->base);
|
||||
o= new set_var(v->type, v->var, &v->base,
|
||||
(null_value ?
|
||||
(Item *)new Item_null() :
|
||||
(Item *)new Item_float(val, 1)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case GET_NO_ARG:
|
||||
case GET_DISABLED:
|
||||
DBUG_ASSERT(0);
|
||||
case 0:
|
||||
case GET_FLAGSET:
|
||||
case GET_ENUM:
|
||||
case GET_SET:
|
||||
case GET_STR:
|
||||
case GET_STR_ALLOC:
|
||||
{
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmp(buff, sizeof(buff), v->var->charset(thd)),*val;
|
||||
val= v->var->val_str(&tmp, thd, v->type, &v->base);
|
||||
if (val)
|
||||
{
|
||||
Item_string *str= new Item_string(v->var->charset(thd),
|
||||
val->ptr(), val->length());
|
||||
o= new set_var(v->type, v->var, &v->base, str);
|
||||
}
|
||||
else
|
||||
o= new set_var(v->type, v->var, &v->base, new Item_null());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
DBUG_ASSERT(o);
|
||||
lex->old_var_list.push_back(o);
|
||||
}
|
||||
if (thd->is_error() ||
|
||||
(res= sql_set_variables(thd, &lex->stmt_var_list, false)))
|
||||
{
|
||||
if (!thd->is_error())
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "SET");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Force statement logging for DDL commands to allow us to update
|
||||
privilege, system or statistic tables directly without the updates
|
||||
@ -4100,7 +4195,7 @@ end_with_restore_list:
|
||||
if ((check_table_access(thd, SELECT_ACL, all_tables, FALSE, UINT_MAX, FALSE)
|
||||
|| open_and_lock_tables(thd, all_tables, TRUE, 0)))
|
||||
goto error;
|
||||
if (!(res= sql_set_variables(thd, lex_var_list)))
|
||||
if (!(res= sql_set_variables(thd, lex_var_list, true)))
|
||||
{
|
||||
my_ok(thd);
|
||||
}
|
||||
@ -4344,8 +4439,7 @@ end_with_restore_list:
|
||||
DBUG_ASSERT(lex->event_parse_data);
|
||||
if (lex->table_or_sp_used())
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "Usage of subqueries or stored "
|
||||
"function calls as part of this statement");
|
||||
my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "CREATE/ALTER EVENT");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4665,8 +4759,7 @@ end_with_restore_list:
|
||||
{
|
||||
if (lex->table_or_sp_used())
|
||||
{
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "Usage of subqueries or stored "
|
||||
"function calls as part of this statement");
|
||||
my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "KILL");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5059,6 +5152,7 @@ create_sp_error:
|
||||
case SQLCOM_COMPOUND:
|
||||
DBUG_ASSERT(all_tables == 0);
|
||||
DBUG_ASSERT(thd->in_sub_stmt == 0);
|
||||
lex->sphead->m_sql_mode= thd->variables.sql_mode;
|
||||
if (do_execute_sp(thd, lex->sphead))
|
||||
goto error;
|
||||
break;
|
||||
@ -5482,6 +5576,8 @@ finish:
|
||||
DBUG_ASSERT(!thd->in_active_multi_stmt_transaction() ||
|
||||
thd->in_multi_stmt_transaction_mode());
|
||||
|
||||
|
||||
lex->restore_set_statement_var();
|
||||
lex->unit.cleanup();
|
||||
|
||||
if (! thd->in_sub_stmt)
|
||||
|
@ -189,4 +189,5 @@ extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
|
||||
int type, uint state_mask, void *arg);
|
||||
extern bool plugin_dl_foreach(THD *thd, const LEX_STRING *dl,
|
||||
plugin_foreach_func *func, void *arg);
|
||||
|
||||
#endif
|
||||
|
@ -3299,7 +3299,7 @@ void Prepared_statement::cleanup_stmt()
|
||||
{
|
||||
DBUG_ENTER("Prepared_statement::cleanup_stmt");
|
||||
DBUG_PRINT("enter",("stmt: 0x%lx", (long) this));
|
||||
|
||||
thd->restore_set_statement_var();
|
||||
cleanup_items(free_list);
|
||||
thd->cleanup_after_query();
|
||||
thd->rollback_item_tree_changes();
|
||||
@ -3619,7 +3619,9 @@ Prepared_statement::execute_loop(String *expanded_query,
|
||||
Reprepare_observer reprepare_observer;
|
||||
bool error;
|
||||
int reprepare_attempt= 0;
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
Item *free_list_state= thd->free_list;
|
||||
#endif
|
||||
thd->select_number= select_number_after_prepare;
|
||||
/* Check if we got an error when sending long data */
|
||||
if (state == Query_arena::STMT_ERROR)
|
||||
@ -3646,7 +3648,7 @@ reexecute:
|
||||
allocated items when cleaning up after validation of the prepared
|
||||
statement.
|
||||
*/
|
||||
DBUG_ASSERT(thd->free_list == NULL);
|
||||
DBUG_ASSERT(thd->free_list == free_list_state);
|
||||
|
||||
/*
|
||||
Install the metadata observer. If some metadata version is
|
||||
|
@ -256,7 +256,6 @@ static bool maybe_start_compound_statement(THD *thd)
|
||||
|
||||
Lex->sp_chistics.suid= SP_IS_NOT_SUID;
|
||||
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_ptr());
|
||||
Lex->sphead->m_sql_mode= thd->variables.sql_mode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -788,8 +787,10 @@ static void sp_create_assignment_lex(THD *thd, bool no_lookahead)
|
||||
lex->var_list.empty();
|
||||
lex->autocommit= 0;
|
||||
/* get_ptr() is only correct with no lookahead. */
|
||||
DBUG_ASSERT(no_lookahead);
|
||||
lex->sphead->m_tmp_query= lip->get_ptr();
|
||||
if (no_lookahead)
|
||||
lex->sphead->m_tmp_query= lip->get_ptr();
|
||||
else
|
||||
lex->sphead->m_tmp_query= lip->get_tok_end();
|
||||
/* Inherit from outer lex. */
|
||||
lex->option_type= old_lex->option_type;
|
||||
}
|
||||
@ -932,10 +933,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||
%parse-param { THD *thd }
|
||||
%lex-param { THD *thd }
|
||||
/*
|
||||
Currently there are 163 shift/reduce conflicts.
|
||||
Currently there are 164 shift/reduce conflicts.
|
||||
We should not introduce new conflicts any more.
|
||||
*/
|
||||
%expect 163
|
||||
%expect 164
|
||||
|
||||
/*
|
||||
Comments for TOKENS.
|
||||
@ -1481,6 +1482,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||
%token STARTING
|
||||
%token STARTS_SYM
|
||||
%token START_SYM /* SQL-2003-R */
|
||||
%token STATEMENT_SYM
|
||||
%token STATS_AUTO_RECALC_SYM
|
||||
%token STATS_PERSISTENT_SYM
|
||||
%token STATS_SAMPLE_PAGES_SYM
|
||||
@ -14321,6 +14323,7 @@ keyword_sp:
|
||||
| SQL_NO_CACHE_SYM {}
|
||||
| SQL_THREAD {}
|
||||
| STARTS_SYM {}
|
||||
| STATEMENT_SYM {}
|
||||
| STATUS_SYM {}
|
||||
| STORAGE_SYM {}
|
||||
| STRING_SYM {}
|
||||
@ -14395,8 +14398,37 @@ set:
|
||||
}
|
||||
start_option_value_list
|
||||
{}
|
||||
| SET STATEMENT_SYM
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
mysql_init_select(lex);
|
||||
lex->option_type= OPT_SESSION;
|
||||
lex->sql_command= SQLCOM_SET_OPTION;
|
||||
lex->autocommit= 0;
|
||||
}
|
||||
set_stmt_option_value_following_option_type_list
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
if (lex->table_or_sp_used())
|
||||
{
|
||||
my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT");
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
lex->stmt_var_list= lex->var_list;
|
||||
lex->var_list.empty();
|
||||
}
|
||||
FOR_SYM verb_clause
|
||||
{}
|
||||
;
|
||||
|
||||
set_stmt_option_value_following_option_type_list:
|
||||
/*
|
||||
Only system variables can be used here. If this condition is changed
|
||||
please check careful code under lex->option_type == OPT_STATEMENT
|
||||
condition on wrong type casts.
|
||||
*/
|
||||
option_value_following_option_type
|
||||
| set_stmt_option_value_following_option_type_list ',' option_value_following_option_type
|
||||
|
||||
// Start of option value list
|
||||
start_option_value_list:
|
||||
|
@ -636,7 +636,7 @@ static bool fix_thd_charset(sys_var *self, THD *thd, enum_var_type type)
|
||||
static Sys_var_struct Sys_character_set_client(
|
||||
"character_set_client", "The character set for statements "
|
||||
"that arrive from the client",
|
||||
SESSION_VAR(character_set_client), NO_CMD_LINE,
|
||||
NO_SET_STMT SESSION_VAR(character_set_client), NO_CMD_LINE,
|
||||
offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info),
|
||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_cs_client),
|
||||
ON_UPDATE(fix_thd_charset));
|
||||
@ -645,7 +645,7 @@ static Sys_var_struct Sys_character_set_connection(
|
||||
"character_set_connection", "The character set used for "
|
||||
"literals that do not have a character set introducer and for "
|
||||
"number-to-string conversion",
|
||||
SESSION_VAR(collation_connection), NO_CMD_LINE,
|
||||
NO_SET_STMT SESSION_VAR(collation_connection), NO_CMD_LINE,
|
||||
offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info),
|
||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null),
|
||||
ON_UPDATE(fix_thd_charset));
|
||||
@ -659,7 +659,7 @@ static Sys_var_struct Sys_character_set_results(
|
||||
|
||||
static Sys_var_struct Sys_character_set_filesystem(
|
||||
"character_set_filesystem", "The filesystem character set",
|
||||
SESSION_VAR(character_set_filesystem), NO_CMD_LINE,
|
||||
NO_SET_STMT SESSION_VAR(character_set_filesystem), NO_CMD_LINE,
|
||||
offsetof(CHARSET_INFO, csname), DEFAULT(&character_set_filesystem),
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset_not_null),
|
||||
ON_UPDATE(fix_thd_charset));
|
||||
@ -705,7 +705,7 @@ static bool check_collation_not_null(sys_var *self, THD *thd, set_var *var)
|
||||
static Sys_var_struct Sys_collation_connection(
|
||||
"collation_connection", "The collation of the connection "
|
||||
"character set",
|
||||
SESSION_VAR(collation_connection), NO_CMD_LINE,
|
||||
NO_SET_STMT SESSION_VAR(collation_connection), NO_CMD_LINE,
|
||||
offsetof(CHARSET_INFO, name), DEFAULT(&default_charset_info),
|
||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_not_null),
|
||||
ON_UPDATE(fix_thd_charset));
|
||||
@ -997,7 +997,7 @@ static bool check_master_connection(sys_var *self, THD *thd, set_var *var)
|
||||
static Sys_var_session_lexstring Sys_default_master_connection(
|
||||
"default_master_connection",
|
||||
"Master connection to use for all slave variables and slave commands",
|
||||
SESSION_ONLY(default_master_connection),
|
||||
NO_SET_STMT SESSION_ONLY(default_master_connection),
|
||||
NO_CMD_LINE, IN_SYSTEM_CHARSET,
|
||||
DEFAULT(""), MAX_CONNECTION_NAME, ON_CHECK(check_master_connection));
|
||||
#endif
|
||||
@ -1024,7 +1024,7 @@ static Sys_var_ulong Sys_interactive_timeout(
|
||||
"interactive_timeout",
|
||||
"The number of seconds the server waits for activity on an interactive "
|
||||
"connection before closing it",
|
||||
SESSION_VAR(net_interactive_timeout),
|
||||
NO_SET_STMT SESSION_VAR(net_interactive_timeout),
|
||||
CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
|
||||
|
||||
@ -1182,7 +1182,7 @@ static Sys_var_double Sys_long_query_time(
|
||||
"Log all queries that have taken more than long_query_time seconds "
|
||||
"to execute to file. The argument will be treated as a decimal value "
|
||||
"with microsecond precision",
|
||||
SESSION_VAR(long_query_time_double),
|
||||
NO_SET_STMT SESSION_VAR(long_query_time_double),
|
||||
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(10),
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
|
||||
ON_UPDATE(update_cached_long_query_time));
|
||||
@ -1437,7 +1437,7 @@ static Sys_var_uint Sys_gtid_domain_id(
|
||||
"parallel paths (for example multiple masters), each independent "
|
||||
"source server must use a distinct domain_id. For simple tree-shaped "
|
||||
"replication topologies, it can be left at its default, 0.",
|
||||
SESSION_VAR(gtid_domain_id),
|
||||
NO_SET_STMT SESSION_VAR(gtid_domain_id),
|
||||
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, UINT_MAX32), DEFAULT(0),
|
||||
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
ON_CHECK(check_gtid_domain_id));
|
||||
@ -2037,7 +2037,7 @@ static Sys_var_ulong Sys_min_examined_row_limit(
|
||||
"min_examined_row_limit",
|
||||
"Don't write queries to slow log that examine fewer rows "
|
||||
"than that",
|
||||
SESSION_VAR(min_examined_row_limit), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(min_examined_row_limit), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -2130,8 +2130,9 @@ static bool check_old_passwords(sys_var *self, THD *thd, set_var *var)
|
||||
static Sys_var_mybool Sys_old_passwords(
|
||||
"old_passwords",
|
||||
"Use old password encryption method (needed for 4.0 and older clients)",
|
||||
SESSION_VAR(old_passwords), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_old_passwords));
|
||||
NO_SET_STMT SESSION_VAR(old_passwords), CMD_LINE(OPT_ARG),
|
||||
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
ON_CHECK(check_old_passwords));
|
||||
export sys_var *Sys_old_passwords_ptr= &Sys_old_passwords; // for sql_acl.cc
|
||||
|
||||
static Sys_var_ulong Sys_open_files_limit(
|
||||
@ -2675,7 +2676,7 @@ static Sys_var_enum Sys_query_cache_type(
|
||||
"OFF = Don't cache or retrieve results. ON = Cache all results "
|
||||
"except SELECT SQL_NO_CACHE ... queries. DEMAND = Cache only "
|
||||
"SELECT SQL_CACHE ... queries",
|
||||
SESSION_VAR(query_cache_type), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(query_cache_type), CMD_LINE(REQUIRED_ARG),
|
||||
query_cache_type_names, DEFAULT(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
ON_CHECK(check_query_cache_type),
|
||||
ON_UPDATE(fix_query_cache_type));
|
||||
@ -3192,7 +3193,7 @@ static bool check_tx_isolation(sys_var *self, THD *thd, set_var *var)
|
||||
// NO_CMD_LINE - different name of the option
|
||||
static Sys_var_tx_isolation Sys_tx_isolation(
|
||||
"tx_isolation", "Default transaction isolation level",
|
||||
SESSION_VAR(tx_isolation), NO_CMD_LINE,
|
||||
NO_SET_STMT SESSION_VAR(tx_isolation), NO_CMD_LINE,
|
||||
tx_isolation_names, DEFAULT(ISO_REPEATABLE_READ),
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_isolation));
|
||||
|
||||
@ -3284,7 +3285,7 @@ static Sys_var_ulong Sys_net_wait_timeout(
|
||||
"wait_timeout",
|
||||
"The number of seconds the server waits for activity on a "
|
||||
"connection before closing it",
|
||||
SESSION_VAR(net_wait_timeout), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(net_wait_timeout), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
|
||||
DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
|
||||
|
||||
@ -3321,7 +3322,7 @@ static Sys_var_plugin Sys_default_tmp_storage_engine(
|
||||
*/
|
||||
static Sys_var_debug_sync Sys_debug_sync(
|
||||
"debug_sync", "Debug Sync Facility",
|
||||
sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
|
||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||
|
||||
@ -3407,7 +3408,8 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
|
||||
|
||||
static Sys_var_bit Sys_autocommit(
|
||||
"autocommit", "autocommit",
|
||||
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_AUTOCOMMIT, DEFAULT(TRUE),
|
||||
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE,
|
||||
OPTION_AUTOCOMMIT, DEFAULT(TRUE),
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_autocommit));
|
||||
export sys_var *Sys_autocommit_ptr= &Sys_autocommit; // for sql_yacc.yy
|
||||
|
||||
@ -3423,7 +3425,7 @@ static Sys_var_bit Sys_big_selects(
|
||||
|
||||
static Sys_var_bit Sys_log_off(
|
||||
"sql_log_off", "sql_log_off",
|
||||
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_LOG_OFF,
|
||||
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_LOG_OFF,
|
||||
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
|
||||
|
||||
/**
|
||||
@ -3527,12 +3529,12 @@ static Sys_var_bit Sys_unique_checks(
|
||||
#ifdef ENABLED_PROFILING
|
||||
static Sys_var_bit Sys_profiling(
|
||||
"profiling", "profiling",
|
||||
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_PROFILING,
|
||||
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_PROFILING,
|
||||
DEFAULT(FALSE));
|
||||
|
||||
static Sys_var_ulong Sys_profiling_history_size(
|
||||
"profiling_history_size", "Limit of query profiling memory",
|
||||
SESSION_VAR(profiling_history_size), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(profiling_history_size), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(0, 100), DEFAULT(15), BLOCK_SIZE(1));
|
||||
#endif
|
||||
|
||||
@ -3566,7 +3568,8 @@ static bool check_skip_replication(sys_var *self, THD *thd, set_var *var)
|
||||
|
||||
static Sys_var_bit Sys_skip_replication(
|
||||
"skip_replication", "skip_replication",
|
||||
SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_SKIP_REPLICATION,
|
||||
NO_SET_STMT SESSION_ONLY(option_bits),
|
||||
NO_CMD_LINE, OPTION_SKIP_REPLICATION,
|
||||
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
ON_CHECK(check_skip_replication));
|
||||
|
||||
@ -3616,7 +3619,7 @@ static ulonglong read_last_insert_id(THD *thd)
|
||||
}
|
||||
static Sys_var_session_special Sys_last_insert_id(
|
||||
"last_insert_id", "The value to be returned from LAST_INSERT_ID()",
|
||||
sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
|
||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
||||
ON_UPDATE(update_last_insert_id), ON_READ(read_last_insert_id));
|
||||
@ -3688,7 +3691,7 @@ static ulonglong read_rand_seed(THD *thd)
|
||||
static Sys_var_session_special Sys_rand_seed1(
|
||||
"rand_seed1", "Sets the internal state of the RAND() "
|
||||
"generator for replication purposes",
|
||||
sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
|
||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
||||
ON_UPDATE(update_rand_seed1), ON_READ(read_rand_seed));
|
||||
@ -3706,7 +3709,7 @@ static bool update_rand_seed2(THD *thd, set_var *var)
|
||||
static Sys_var_session_special Sys_rand_seed2(
|
||||
"rand_seed2", "Sets the internal state of the RAND() "
|
||||
"generator for replication purposes",
|
||||
sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
|
||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
||||
ON_UPDATE(update_rand_seed2), ON_READ(read_rand_seed));
|
||||
@ -3738,7 +3741,7 @@ static Sys_var_session_special Sys_warning_count(
|
||||
static Sys_var_ulong Sys_default_week_format(
|
||||
"default_week_format",
|
||||
"The default week format used by WEEK() functions",
|
||||
SESSION_VAR(default_week_format), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(default_week_format), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(0, 7), DEFAULT(0), BLOCK_SIZE(1));
|
||||
|
||||
static Sys_var_ulonglong Sys_group_concat_max_len(
|
||||
@ -3961,7 +3964,7 @@ static Sys_var_mybool Sys_slow_query_log(
|
||||
"Log slow queries to a table or log file. Defaults logging to a file "
|
||||
"'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is "
|
||||
"used. Must be enabled to activate other slow log options",
|
||||
SESSION_VAR(sql_log_slow), CMD_LINE(OPT_ARG),
|
||||
NO_SET_STMT SESSION_VAR(sql_log_slow), CMD_LINE(OPT_ARG),
|
||||
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
ON_CHECK(0), ON_UPDATE(fix_log_state));
|
||||
|
||||
@ -4832,7 +4835,7 @@ static const char *log_slow_filter_names[]=
|
||||
static Sys_var_set Sys_log_slow_filter(
|
||||
"log_slow_filter",
|
||||
"Log only certain types of queries",
|
||||
SESSION_VAR(log_slow_filter), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(log_slow_filter), CMD_LINE(REQUIRED_ARG),
|
||||
log_slow_filter_names,
|
||||
DEFAULT(MAX_SET(array_elements(log_slow_filter_names)-1)));
|
||||
|
||||
@ -4879,7 +4882,7 @@ static Sys_var_ulong Sys_log_slow_rate_limit(
|
||||
"Write to slow log every #th slow query. Set to 1 to log everything. "
|
||||
"Increase it to reduce the size of the slow or the performance impact "
|
||||
"of slow logging",
|
||||
SESSION_VAR(log_slow_rate_limit), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(log_slow_rate_limit), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(1, UINT_MAX), DEFAULT(1), BLOCK_SIZE(1));
|
||||
|
||||
static const char *log_slow_verbosity_names[]= { "innodb", "query_plan",
|
||||
@ -4887,7 +4890,7 @@ static const char *log_slow_verbosity_names[]= { "innodb", "query_plan",
|
||||
static Sys_var_set Sys_log_slow_verbosity(
|
||||
"log_slow_verbosity",
|
||||
"Verbosity level for the slow log",
|
||||
SESSION_VAR(log_slow_verbosity), CMD_LINE(REQUIRED_ARG),
|
||||
NO_SET_STMT SESSION_VAR(log_slow_verbosity), CMD_LINE(REQUIRED_ARG),
|
||||
log_slow_verbosity_names, DEFAULT(LOG_SLOW_VERBOSITY_INIT));
|
||||
|
||||
static Sys_var_ulong Sys_join_cache_level(
|
||||
|
@ -57,6 +57,7 @@
|
||||
// this means that Sys_var_charptr initial value was malloc()ed
|
||||
#define PREALLOCATED sys_var::ALLOCATED+
|
||||
#define PARSED_EARLY sys_var::PARSE_EARLY+
|
||||
#define NO_SET_STMT sys_var::NO_SET_STATEMENT+
|
||||
|
||||
/*
|
||||
Sys_var_bit meaning is reversed, like in
|
||||
|
Loading…
x
Reference in New Issue
Block a user