Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f80d13e5
Commit
f80d13e5
authored
Nov 05, 2010
by
Guilhem Bichot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for BUG#57316 "It is not clear how to disable autocommit"
add boolean command-line option --autocommit.
parent
373be0d5
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
141 additions
and
6 deletions
+141
-6
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+1
-2
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-notwin.result
+1
-0
mysql-test/r/mysqld--help-win.result
mysql-test/r/mysqld--help-win.result
+1
-0
mysql-test/suite/sys_vars/inc/autocommit_func2.inc
mysql-test/suite/sys_vars/inc/autocommit_func2.inc
+29
-0
mysql-test/suite/sys_vars/r/autocommit_func2.result
mysql-test/suite/sys_vars/r/autocommit_func2.result
+46
-0
mysql-test/suite/sys_vars/r/autocommit_func3.result
mysql-test/suite/sys_vars/r/autocommit_func3.result
+42
-0
mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
+1
-0
mysql-test/suite/sys_vars/t/autocommit_func2.test
mysql-test/suite/sys_vars/t/autocommit_func2.test
+1
-0
mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
+1
-0
mysql-test/suite/sys_vars/t/autocommit_func3.test
mysql-test/suite/sys_vars/t/autocommit_func3.test
+1
-0
sql/mysqld.cc
sql/mysqld.cc
+13
-0
sql/mysqld.h
sql/mysqld.h
+2
-1
sql/sql_partition.cc
sql/sql_partition.cc
+2
-3
No files found.
mysql-test/mysql-test-run.pl
View file @
f80d13e5
...
@@ -5317,8 +5317,7 @@ sub gdb_arguments {
...
@@ -5317,8 +5317,7 @@ sub gdb_arguments {
"
break mysql_parse
\n
"
.
"
break mysql_parse
\n
"
.
"
commands 1
\n
"
.
"
commands 1
\n
"
.
"
disable 1
\n
"
.
"
disable 1
\n
"
.
"
end
\n
"
.
"
end
\n
");
"
run
");
}
}
if
(
$opt_manual_gdb
)
if
(
$opt_manual_gdb
)
...
...
mysql-test/r/mysqld--help-notwin.result
View file @
f80d13e5
...
@@ -19,6 +19,7 @@ The following options may be given as the first argument:
...
@@ -19,6 +19,7 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
--auto-increment-offset[=#]
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)
--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.)
...
...
mysql-test/r/mysqld--help-win.result
View file @
f80d13e5
...
@@ -19,6 +19,7 @@ The following options may be given as the first argument:
...
@@ -19,6 +19,7 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
--auto-increment-offset[=#]
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)
--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.)
...
...
mysql-test/suite/sys_vars/inc/autocommit_func2.inc
0 → 100644
View file @
f80d13e5
--
source
include
/
have_innodb
.
inc
CREATE
TABLE
t1
(
id
INT
NOT
NULL
auto_increment
,
PRIMARY
KEY
(
id
),
name
varchar
(
30
)
)
ENGINE
=
INNODB
;
SELECT
@@
global
.
autocommit
;
SELECT
@@
autocommit
;
INSERT
into
t1
(
name
)
values
(
'Record_1'
);
INSERT
into
t1
(
name
)
values
(
'Record_2'
);
SELECT
*
from
t1
;
ROLLBACK
;
SELECT
*
from
t1
;
set
@@
global
.
autocommit
=
1
-@@
global
.
autocommit
;
set
@@
autocommit
=
1
-@@
autocommit
;
SELECT
@@
global
.
autocommit
;
SELECT
@@
autocommit
;
INSERT
into
t1
(
name
)
values
(
'Record_1'
);
INSERT
into
t1
(
name
)
values
(
'Record_2'
);
SELECT
*
from
t1
;
ROLLBACK
;
SELECT
*
from
t1
;
DROP
TABLE
t1
;
set
@@
global
.
autocommit
=
1
-@@
global
.
autocommit
;
mysql-test/suite/sys_vars/r/autocommit_func2.result
0 → 100644
View file @
f80d13e5
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;
mysql-test/suite/sys_vars/r/autocommit_func3.result
0 → 100644
View file @
f80d13e5
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;
mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
0 → 100644
View file @
f80d13e5
--autocommit=1
mysql-test/suite/sys_vars/t/autocommit_func2.test
0 → 100644
View file @
f80d13e5
--
source
suite
/
sys_vars
/
inc
/
autocommit_func2
.
inc
mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
0 → 100644
View file @
f80d13e5
--autocommit=0
mysql-test/suite/sys_vars/t/autocommit_func3.test
0 → 100644
View file @
f80d13e5
--
source
suite
/
sys_vars
/
inc
/
autocommit_func2
.
inc
sql/mysqld.cc
View file @
f80d13e5
...
@@ -5662,6 +5662,12 @@ struct my_option my_long_options[]=
...
@@ -5662,6 +5662,12 @@ struct my_option my_long_options[]=
{
"ansi"
,
'a'
,
"Use ANSI SQL syntax instead of MySQL syntax. This mode "
{
"ansi"
,
'a'
,
"Use ANSI SQL syntax instead of MySQL syntax. This mode "
"will also set transaction isolation level 'serializable'."
,
0
,
0
,
0
,
"will also set transaction isolation level 'serializable'."
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
/*
Because Sys_var_bit does not support command-line options, we need to
explicitely add one for --autocommit
*/
{
"autocommit"
,
OPT_AUTOCOMMIT
,
"Set default value for autocommit (0 or 1)"
,
NULL
,
NULL
,
0
,
GET_BOOL
,
OPT_ARG
,
0
,
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
},
...
@@ -7114,6 +7120,13 @@ mysqld_get_one_option(int optid,
...
@@ -7114,6 +7120,13 @@ 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
;
}
}
...
...
sql/mysqld.h
View file @
f80d13e5
...
@@ -391,7 +391,8 @@ enum options_mysqld
...
@@ -391,7 +391,8 @@ 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
};
};
...
...
sql/sql_partition.cc
View file @
f80d13e5
...
@@ -1997,7 +1997,7 @@ static int add_part_field_list(File fptr, List<char> field_list)
...
@@ -1997,7 +1997,7 @@ static int add_part_field_list(File fptr, List<char> field_list)
String
field_string
(
""
,
0
,
system_charset_info
);
String
field_string
(
""
,
0
,
system_charset_info
);
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
ulonglong
save_options
=
thd
->
variables
.
option_bits
;
ulonglong
save_options
=
thd
->
variables
.
option_bits
;
thd
->
variables
.
option_bits
=
0
;
thd
->
variables
.
option_bits
&=
~
OPTION_QUOTE_SHOW_CREATE
;
append_identifier
(
thd
,
&
field_string
,
field_str
,
append_identifier
(
thd
,
&
field_string
,
field_str
,
strlen
(
field_str
));
strlen
(
field_str
));
thd
->
variables
.
option_bits
=
save_options
;
thd
->
variables
.
option_bits
=
save_options
;
...
@@ -2016,8 +2016,7 @@ static int add_name_string(File fptr, const char *name)
...
@@ -2016,8 +2016,7 @@ static int add_name_string(File fptr, const char *name)
String
name_string
(
""
,
0
,
system_charset_info
);
String
name_string
(
""
,
0
,
system_charset_info
);
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
ulonglong
save_options
=
thd
->
variables
.
option_bits
;
ulonglong
save_options
=
thd
->
variables
.
option_bits
;
thd
->
variables
.
option_bits
&=
~
OPTION_QUOTE_SHOW_CREATE
;
thd
->
variables
.
option_bits
=
0
;
append_identifier
(
thd
,
&
name_string
,
name
,
append_identifier
(
thd
,
&
name_string
,
name
,
strlen
(
name
));
strlen
(
name
));
thd
->
variables
.
option_bits
=
save_options
;
thd
->
variables
.
option_bits
=
save_options
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment