Fix for BUG#59432 "--autocommit=on does not work (@@global.autocommit is 0)"
This commit is contained in:
parent
b23c9fd203
commit
b2c4b4636a
@ -20,6 +20,7 @@ The following options may be given as the first argument:
|
|||||||
Offset added to Auto-increment columns. Used when
|
Offset added to Auto-increment columns. Used when
|
||||||
auto-increment-increment != 1
|
auto-increment-increment != 1
|
||||||
--autocommit Set default value for autocommit (0 or 1)
|
--autocommit Set default value for autocommit (0 or 1)
|
||||||
|
(Defaults to on; use --skip-autocommit to disable.)
|
||||||
--automatic-sp-privileges
|
--automatic-sp-privileges
|
||||||
Creating and dropping stored procedures alters ACLs
|
Creating and dropping stored procedures alters ACLs
|
||||||
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
|
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
|
||||||
@ -732,6 +733,7 @@ abort-slave-event-count 0
|
|||||||
allow-suspicious-udfs FALSE
|
allow-suspicious-udfs FALSE
|
||||||
auto-increment-increment 1
|
auto-increment-increment 1
|
||||||
auto-increment-offset 1
|
auto-increment-offset 1
|
||||||
|
autocommit TRUE
|
||||||
automatic-sp-privileges TRUE
|
automatic-sp-privileges TRUE
|
||||||
back-log 50
|
back-log 50
|
||||||
big-tables FALSE
|
big-tables FALSE
|
||||||
|
@ -20,6 +20,7 @@ The following options may be given as the first argument:
|
|||||||
Offset added to Auto-increment columns. Used when
|
Offset added to Auto-increment columns. Used when
|
||||||
auto-increment-increment != 1
|
auto-increment-increment != 1
|
||||||
--autocommit Set default value for autocommit (0 or 1)
|
--autocommit Set default value for autocommit (0 or 1)
|
||||||
|
(Defaults to on; use --skip-autocommit to disable.)
|
||||||
--automatic-sp-privileges
|
--automatic-sp-privileges
|
||||||
Creating and dropping stored procedures alters ACLs
|
Creating and dropping stored procedures alters ACLs
|
||||||
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
|
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
|
||||||
@ -736,6 +737,7 @@ abort-slave-event-count 0
|
|||||||
allow-suspicious-udfs FALSE
|
allow-suspicious-udfs FALSE
|
||||||
auto-increment-increment 1
|
auto-increment-increment 1
|
||||||
auto-increment-offset 1
|
auto-increment-offset 1
|
||||||
|
autocommit TRUE
|
||||||
automatic-sp-privileges TRUE
|
automatic-sp-privileges TRUE
|
||||||
back-log 50
|
back-log 50
|
||||||
big-tables FALSE
|
big-tables FALSE
|
||||||
|
46
mysql-test/suite/sys_vars/r/autocommit_func4.result
Normal file
46
mysql-test/suite/sys_vars/r/autocommit_func4.result
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
CREATE TABLE t1
|
||||||
|
(
|
||||||
|
id INT NOT NULL auto_increment,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
name varchar(30)
|
||||||
|
) ENGINE = INNODB;
|
||||||
|
SELECT @@global.autocommit;
|
||||||
|
@@global.autocommit
|
||||||
|
1
|
||||||
|
SELECT @@autocommit;
|
||||||
|
@@autocommit
|
||||||
|
1
|
||||||
|
INSERT into t1(name) values('Record_1');
|
||||||
|
INSERT into t1(name) values('Record_2');
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
1 Record_1
|
||||||
|
2 Record_2
|
||||||
|
ROLLBACK;
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
1 Record_1
|
||||||
|
2 Record_2
|
||||||
|
set @@global.autocommit = 1-@@global.autocommit;
|
||||||
|
set @@autocommit = 1-@@autocommit;
|
||||||
|
SELECT @@global.autocommit;
|
||||||
|
@@global.autocommit
|
||||||
|
0
|
||||||
|
SELECT @@autocommit;
|
||||||
|
@@autocommit
|
||||||
|
0
|
||||||
|
INSERT into t1(name) values('Record_1');
|
||||||
|
INSERT into t1(name) values('Record_2');
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
1 Record_1
|
||||||
|
2 Record_2
|
||||||
|
3 Record_1
|
||||||
|
4 Record_2
|
||||||
|
ROLLBACK;
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
1 Record_1
|
||||||
|
2 Record_2
|
||||||
|
DROP TABLE t1;
|
||||||
|
set @@global.autocommit = 1-@@global.autocommit;
|
42
mysql-test/suite/sys_vars/r/autocommit_func5.result
Normal file
42
mysql-test/suite/sys_vars/r/autocommit_func5.result
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
CREATE TABLE t1
|
||||||
|
(
|
||||||
|
id INT NOT NULL auto_increment,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
name varchar(30)
|
||||||
|
) ENGINE = INNODB;
|
||||||
|
SELECT @@global.autocommit;
|
||||||
|
@@global.autocommit
|
||||||
|
0
|
||||||
|
SELECT @@autocommit;
|
||||||
|
@@autocommit
|
||||||
|
0
|
||||||
|
INSERT into t1(name) values('Record_1');
|
||||||
|
INSERT into t1(name) values('Record_2');
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
1 Record_1
|
||||||
|
2 Record_2
|
||||||
|
ROLLBACK;
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
set @@global.autocommit = 1-@@global.autocommit;
|
||||||
|
set @@autocommit = 1-@@autocommit;
|
||||||
|
SELECT @@global.autocommit;
|
||||||
|
@@global.autocommit
|
||||||
|
1
|
||||||
|
SELECT @@autocommit;
|
||||||
|
@@autocommit
|
||||||
|
1
|
||||||
|
INSERT into t1(name) values('Record_1');
|
||||||
|
INSERT into t1(name) values('Record_2');
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
3 Record_1
|
||||||
|
4 Record_2
|
||||||
|
ROLLBACK;
|
||||||
|
SELECT * from t1;
|
||||||
|
id name
|
||||||
|
3 Record_1
|
||||||
|
4 Record_2
|
||||||
|
DROP TABLE t1;
|
||||||
|
set @@global.autocommit = 1-@@global.autocommit;
|
1
mysql-test/suite/sys_vars/t/autocommit_func4-master.opt
Normal file
1
mysql-test/suite/sys_vars/t/autocommit_func4-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--autocommit=on
|
1
mysql-test/suite/sys_vars/t/autocommit_func4.test
Normal file
1
mysql-test/suite/sys_vars/t/autocommit_func4.test
Normal file
@ -0,0 +1 @@
|
|||||||
|
--source suite/sys_vars/inc/autocommit_func2.inc
|
1
mysql-test/suite/sys_vars/t/autocommit_func5-master.opt
Normal file
1
mysql-test/suite/sys_vars/t/autocommit_func5-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--autocommit=off
|
1
mysql-test/suite/sys_vars/t/autocommit_func5.test
Normal file
1
mysql-test/suite/sys_vars/t/autocommit_func5.test
Normal file
@ -0,0 +1 @@
|
|||||||
|
--source suite/sys_vars/inc/autocommit_func2.inc
|
@ -283,6 +283,7 @@ const char *first_keyword= "first", *binary_keyword= "BINARY";
|
|||||||
const char *my_localhost= "localhost", *delayed_user= "DELAYED";
|
const char *my_localhost= "localhost", *delayed_user= "DELAYED";
|
||||||
|
|
||||||
bool opt_large_files= sizeof(my_off_t) > 4;
|
bool opt_large_files= sizeof(my_off_t) > 4;
|
||||||
|
static my_bool opt_autocommit; ///< for --autocommit command-line option
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Used with --help for detailed option
|
Used with --help for detailed option
|
||||||
@ -5655,8 +5656,9 @@ struct my_option my_long_options[]=
|
|||||||
Because Sys_var_bit does not support command-line options, we need to
|
Because Sys_var_bit does not support command-line options, we need to
|
||||||
explicitely add one for --autocommit
|
explicitely add one for --autocommit
|
||||||
*/
|
*/
|
||||||
{"autocommit", OPT_AUTOCOMMIT, "Set default value for autocommit (0 or 1)",
|
{"autocommit", 0, "Set default value for autocommit (0 or 1)",
|
||||||
NULL, NULL, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, NULL},
|
&opt_autocommit, &opt_autocommit, 0,
|
||||||
|
GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, NULL},
|
||||||
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
|
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
|
||||||
&my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
|
&my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -7111,13 +7113,6 @@ mysqld_get_one_option(int optid,
|
|||||||
if (argument == NULL) /* no argument */
|
if (argument == NULL) /* no argument */
|
||||||
log_error_file_ptr= const_cast<char*>("");
|
log_error_file_ptr= const_cast<char*>("");
|
||||||
break;
|
break;
|
||||||
case OPT_AUTOCOMMIT:
|
|
||||||
const ulonglong turn_bit_on= (argument && (atoi(argument) == 0)) ?
|
|
||||||
OPTION_NOT_AUTOCOMMIT : OPTION_AUTOCOMMIT;
|
|
||||||
global_system_variables.option_bits=
|
|
||||||
(global_system_variables.option_bits &
|
|
||||||
~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -7268,10 +7263,12 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
|
|||||||
else
|
else
|
||||||
global_system_variables.option_bits&= ~OPTION_BIG_SELECTS;
|
global_system_variables.option_bits&= ~OPTION_BIG_SELECTS;
|
||||||
|
|
||||||
if (global_system_variables.option_bits & OPTION_AUTOCOMMIT)
|
// Synchronize @@global.autocommit on --autocommit
|
||||||
global_system_variables.option_bits&= ~OPTION_NOT_AUTOCOMMIT;
|
const ulonglong turn_bit_on= opt_autocommit ?
|
||||||
else
|
OPTION_AUTOCOMMIT : OPTION_NOT_AUTOCOMMIT;
|
||||||
global_system_variables.option_bits|= OPTION_NOT_AUTOCOMMIT;
|
global_system_variables.option_bits=
|
||||||
|
(global_system_variables.option_bits &
|
||||||
|
~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on;
|
||||||
|
|
||||||
global_system_variables.sql_mode=
|
global_system_variables.sql_mode=
|
||||||
expand_sql_mode(global_system_variables.sql_mode);
|
expand_sql_mode(global_system_variables.sql_mode);
|
||||||
|
@ -394,8 +394,7 @@ enum options_mysqld
|
|||||||
OPT_UPDATE_LOG,
|
OPT_UPDATE_LOG,
|
||||||
OPT_WANT_CORE,
|
OPT_WANT_CORE,
|
||||||
OPT_ENGINE_CONDITION_PUSHDOWN,
|
OPT_ENGINE_CONDITION_PUSHDOWN,
|
||||||
OPT_LOG_ERROR,
|
OPT_LOG_ERROR
|
||||||
OPT_AUTOCOMMIT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user