diff --git a/test/cases/transaction/autocommit_1.sql b/test/cases/transaction/autocommit_1.sql new file mode 100644 index 0000000000000000000000000000000000000000..7fbd9ca3e9c913bb712afc441385e1dc979dfd84 --- /dev/null +++ b/test/cases/transaction/autocommit_1.sql @@ -0,0 +1,473 @@ +-- @suit + +-- @case +-- @desc:Test echo autocommit +-- @label:bvt + +-- @bvt:issue#4626 +SELECT @@session.autocommit; +-- @bvt:issue + +SET @@session.autocommit=1; +SELECT @@session.autocommit; + +SET @@session.autocommit= 0; +SELECT @@session.autocommit; + +-- echo Uncommitted transaction exists. Please commit or rollback first. +SET @@session.autocommit=OFF; +SELECT @@session.autocommit; + +-- echo Uncommitted transaction exists. Please commit or rollback first. +SET @@session.autocommit=ON; +SELECT @@session.autocommit; + +--error You have an error in your SQL syntax; +SET @@session.autocommit=foo; +SELECT @@session.autocommit; +commit; + +SET @@session.autocommit=OFF; +SELECT @@session.autocommit; +commit; + +SET @@session.autocommit=ON; +SELECT @@session.autocommit; +commit; + +-- convert to the system variable bool type failed +SET @@session.autocommit=foo; +SELECT @@session.autocommit; +commit; + + +-- @case +-- @desc:Test implicit transaction commit (commit;,rollback;) +-- @label:bvt + +set autocommit=0; +select @@autocommit; +commit; + +-- Test implicit transaction rollback +drop database if exists db; +create database db; +show databases like 'db'; +use db; +create table tab1(a int, b int); +create index index_tab1 on tab1(a); +create view view_tab1 as select * from tab1; +insert into tab1 values (2000, 3000); +rollback; + + +-- Test implicit transaction commit +drop database if exists db; +create database db; +show databases like 'db'; +use db; +create table tab1(a int, b int); + +-- not support error +create index index_tab1 on tab1(a); + +-- test table tab1 DML and commit; rollback; +insert into tab1 values (2000, 3000); +insert into tab1 values (10, 10); +commit; +select * from tab1; +update tab1 set a=100000 where b=3000; +select * from tab1; +rollback; +select * from tab1; +update tab1 set a=100000 where b=3000; +commit; +select * from tab1; +delete from tab1 where a=10; +rollback; +select * from tab1; +delete from tab1 where a=10; +commit; +select * from tab1; + + +-- test view view_tab1 DML and commit; rollback; +create view view_tab1 as select * from tab1; +select * from view_tab1; + +-- @bvt:issue#4598 +insert into view_tab1 values (200, 300); +insert into view_tab1 values (10, 10); +commit; +select * from view_tab1; +update view_tab1 set a=100000 where b=3000; +select * from view_tab1; +rollback; +select * from view_tab1; +update view_tab1 set a=100000 where b=3000; +commit; +select * from view_tab1; +delete from view_tab1 where a=10; +rollback; +select * from view_tab1; +delete from view_tab1 where a=10; +-- @bvt:issue +commit; +select * from view_tab1; +commit; + +drop database db; + +use autocommit_1; +commit; + +-- test rollback +drop table if exists t1; +create table t1(col1 varchar(255)); +insert into t1 values ('helloworld'); +rollback; +-- echo error +select * from t1; +commit; + +-- test commit +drop table if exists t2; +create table t2 (a varchar(255)); +insert into t2 values ('hello'); +commit; +select * from t2; +commit; +drop table t2; + + +-- @case +-- @desc:Test implicit transaction uncommitted, modify AUTOCOMMIT value, mo throw exception +-- @label:bvt + +drop table if exists t3; +create table t3(a int); +insert into t3 values (10),(20),(30); + +-- echo mo throw exception +set @@autocommit=ON; +select @@autocommit; + +-- echo mo throw exception +set @@autocommit=OFF; +select @@autocommit; + +-- echo mo throw exception +set @@autocommit=1; +select @@autocommit; + +-- echo mo throw exception +set @@autocommit=0; +select @@autocommit; + +rollback; + + +drop table if exists tab3; +create table tab3 (a int, b varchar(25)); +insert into tab3 values (10, 'aa'),(20, 'bb'),(30, 'cc'); +-- echo mo throw exception +set @@autocommit=ON; +select @@autocommit; + +-- echo mo throw exception +set @@autocommit=OFF; +select @@autocommit; + +-- echo mo throw exception +set @@autocommit=1; +select @@autocommit; + +-- echo mo throw exception +set @@autocommit=0; +commit; + +select * from tab3; +update tab3 set a=1000 where b='aa'; +select * from tab3; +rollback; +delete from tab3 where b='cc'; +select * from tab3; +commit; +select * from tab3; +commit; + +drop table tab3; + +-- test An implicit transaction has uncommitted content. +-- Turning on an explicit transaction forces the previously uncommitted content to be committed + +drop table if exists t4; +create table t4(a varchar(225), b int); +insert into t4 values ('aa', 1000),('bb', 2000); + +begin; +select * from t4; +update t4 set a='xxxx' where b=1000; +select * from t4; +rollback; + +select * from t4; +update t4 set a='xxxx' where b=1000; +select * from t4; +commit; +select * from t4; + +create view view_t4 as select * from t4; + +begin; +select * from view_t4; +delete from t4 where a='bb'; +rollback; + +select * from t4; +select * from view_t4; +commit; + + +-- @case +-- @desc:Test explicit transaction commit (commit;rollback;) +-- @label:bvt + +set autocommit=1; +select @@autocommit; + +drop database if exists test_xx; +begin; +create database test_xx; + +-- echo Uncommitted transaction exists. Please commit or rollback first. +SET @@session.autocommit=1; +SELECT @@session.autocommit; + +-- echo Uncommitted transaction exists. Please commit or rollback first. +SET @@session.autocommit= 0; +SELECT @@session.autocommit; + +-- echo Uncommitted transaction exists. Please commit or rollback first. +SET @@session.autocommit=OFF; +SELECT @@session.autocommit; + +-- echo Uncommitted transaction exists. Please commit or rollback first. +SET @@session.autocommit=ON; +SELECT @@session.autocommit; +commit; + +show databases like 'test_xx'; + + +-- Test explicit transaction rollback; +drop database if exists db; +begin; +create database db; +show databases like 'db'; +use db; + +create table table3(a int, b int); +create index index_table3 on tab1(a); +insert into table3 values (2000, 3000); +create view view_table3 as select * from table3; +select * from table3; +select * from view_table3; +rollback; + +-- echo error +select * from table3; +select * from view_table3; + + +-- Test explicit transaction commit; + +drop database if exists db; +begin; +create database db; +show databases like 'db'; +use db; +create table table3(a int, b int); + +-- not support error +create index index_table3 on table3(a); + +-- test table table3 DML and commit; rollback; +insert into table3 values (2000, 3000); +insert into table3 values (10, 10); +commit; +select * from table3; + +begin; +update table3 set a=100000 where b=3000; +select * from table3; +rollback; +select * from table3; + +begin; +update table3 set a=100000 where b=3000; +commit; +select * from table3; + +begin; +delete from table3 where a=10; +rollback; +select * from table3; + +begin; +delete from table3 where a=10; +commit; +select * from table3; + +-- Test start transaction;rollback;commit; + +drop table if exists t3; +start transaction; +create table t3 (b varchar(255)); +insert into t3 values ('helloworld'); +rollback ; +select * from t3; + +drop table if exists t4; +start transaction; +create table t4 (a int); +insert into t4 values (10),(20); +commit; +select * from t4; +drop table t4; + + +-- Test explicit transactions are nested, Uncommitted content is forced to be submitted +drop table if exists t5; +start transaction; + +create table t5(a int); +insert into t5 values(10),(20),(30); +-- execute error +drop table t5; + +start transaction; +insert into t5 values(100),(2000),(3000); +-- execute error +set @autocommit=0; +begin; +select * from t5; + +insert into t5 values(1),(2),(3); +rollback; + +select * from t5; + +begin; +select * from t5; +insert into t5 values(100),(2000),(3000); +delete from t5; + +begin; +select * from t5; +rollback; + +select * from t5; + +drop table t5 + + + +-- Test explicit transactions include set command; +start transaction; +-- execute error +set @@a=0; +rollback; + +set @@b=0; +-- execute error +commit; +-- execute error +select @@b; + + +-- Test AUTOCOMMIT=1 Each DML statement is a separate transaction + +drop database if exists db; +create database db; +show databases like 'db'; +use db; +create table t6(a int, b int); + +-- not support error +create index index_t6 on t6(a); + +-- test table t6 DML and commit; rollback; +insert into t6 values (2000, 3000); +insert into t6 values (10, 10); + +select * from t6; +update t6 set a=100000 where b=3000; +select * from t6; +delete from t6 where a=10; + +select * from t6; + + +-- test view view_t6 DML and commit; rollback; +create view view_t6 as select * from t6; +select * from view_t6; + +-- @bvt:issue#4598 +insert into view_t6 values (200, 300); +insert into view_t6 values (10, 10); + + +select * from view_t6; +update view_t6 set a=100000 where b=3000; +select * from view_t6; +delete from view_t6 where a=10; +select * from view_t6; +-- @bvt:issue#4598 + +drop database db; + +use autocommit_1; + + + +-- @case +-- @desc:Test Nested explicit transactions within implicit transactions +-- @label:bvt + +set @@autocommit=0; +select @@autocommit; + +create table t7(a int); +insert into t7 values (500); +commit; + + +begin; +insert into t7 values (1000); +commit; +insert into t7 values (2000); +rollback; +select * from t7; +drop table t7; +commit; +drop table t7; + +create table t8(a int); +insert into t8 values (500); +rollback; + + +begin; +insert into t8 values (1000); +create table t9 (a char(25)); +commit; + +insert into t9 values ('hello'); +rollback; +select * from t9; +commit; +drop table t9; + +set @@autocommit=on; + diff --git a/test/cases/transaction/autocommit_atomicity.sql b/test/cases/transaction/autocommit_atomicity.sql new file mode 100644 index 0000000000000000000000000000000000000000..d88bfab94eb1bf8ba7bb67f69e81a7bd1e1fc937 --- /dev/null +++ b/test/cases/transaction/autocommit_atomicity.sql @@ -0,0 +1,86 @@ +drop table if exists test_11; +create table test_11 (c int primary key,d int); + +set @@autocommit=0; +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Rollback; +set @@autocommit=1; +select * from test_11 ; + +set @@autocommit=0; +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +commit; +set @@autocommit=1; +select * from test_11 ; + +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +set @@autocommit=0; +delete from test_11 where c < 3; +update test_11 set d = c + 1 where c >= 3; +rollback; +set @@autocommit=1; +select * from test_11 ; + +set @@autocommit=0; +delete from test_11 where c <3; +update test_11 set d = c + 1 where c >= 3; +commit; +set @@autocommit=1; +select * from test_11 ; + +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +rollback; +set @@autocommit=1; +select * from test_11 ; + +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +delete from test_11 where c <3; +update test_11 set d = c + 1 where c >= 3; +commit; +set @@autocommit=1; +select * from test_11; + +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +drop table if exists test_11; +rollback; +set @@autocommit=1; +select * from test_11; + +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +drop table if exists test_11; +commit; +set @@autocommit=1; +select * from test_11 ; + + + diff --git a/test/cases/transaction/autocommit_isolation.sql b/test/cases/transaction/autocommit_isolation.sql new file mode 100644 index 0000000000000000000000000000000000000000..85709f30402333ce13b463600849411b4fd10d3b --- /dev/null +++ b/test/cases/transaction/autocommit_isolation.sql @@ -0,0 +1,351 @@ +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; + +-- @session:id=1{ +use autocommit_isolation; +select * from test_11; +-- @session} +commit; +set @@autocommit=1; + +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; + +-- @session:id=1{ +select * from test_11; +-- @session} + +delete from test_11 where c =1; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +update test_11 set d = c +1 where c > 2; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +commit; +set @@autocommit=1; + +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; + +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +commit; +set @@autocommit=1; + +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; + +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +delete from test_11 where c = 1; +select * from test_11; +-- @session} +Insert into test_11 values(1,1); +select * from test_11; + +commit; +set @@autocommit=1; + +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +-- @session:id=1{ +select * from test_11; +Insert into test_11 values(5,4); +select * from test_11; +-- @session} +select * from test_11; +Insert into test_11 values(50,50); +-- @session:id=1{ +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; +commit; +set @@autocommit=1; + +-- @session:id=1{ +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +select * from test_11; +-- @session:id=1{ +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} + +Insert into test_11 values(50,50); +select * from test_11; +commit; +set @@autocommit=1; +-- @session:id=1{ +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +delete from test_11 where c = 50; +select * from test_11; +-- @session} +select * from test_11; + +commit; +set @@autocommit=1; + +-- @session:id=1{ +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +update test_11 set c = 100 where d = 50; +select * from test_11; +-- @session} +select * from test_11; +Insert into test_11 values(100,50); + +commit; +set @@autocommit=1; + +-- @session:id=1{ +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +update test_11 set c = 100 where d = 50; +select * from test_11; +-- @session} +select * from test_11; +update test_11 set c = 101 where c = 50; + +commit; +set @@autocommit=1; + +-- @session:id=1{ +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set @@autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +update test_11 set c = 100 where d = 50; +select * from test_11; +-- @session} +select * from test_11; +update test_11 set c = 100 where d = 50; + +commit; +set @@autocommit=1; +-- @session:id=1{ +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +set @@autocommit=0; + +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +commit; +set @@autocommit=1; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +set @@autocommit=0; +drop table test_11; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +commit; +set @@autocommit=1; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +-- drop table test_11; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} +commit; +set @@autocommit=1; + +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +drop table if exists test_11; diff --git a/test/cases/transaction/autocommit_isolation_1.sql b/test/cases/transaction/autocommit_isolation_1.sql new file mode 100644 index 0000000000000000000000000000000000000000..b38f836ffa37f6b86679d3ff33e10f1d04b07293 --- /dev/null +++ b/test/cases/transaction/autocommit_isolation_1.sql @@ -0,0 +1,373 @@ +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); + +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; + +-- @session:id=1{ +use autocommit_isolation_1; +set autocommit=0; +select * from test_11; +-- @session} +commit; +set autocommit=1; + +select * from test_11; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; + +-- @session:id=1{ +set autocommit=0; +select * from test_11; +-- @session} + +delete from test_11 where c =1; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +update test_11 set d = c +1 where c > 2; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +commit; +set autocommit=1; +select * from test_11; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +set autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +-- @session} + +commit; +set autocommit=1; +select * from test_11; + +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; + +-- @session:id=1{ +set autocommit=0; +select * from test_11; +Insert into test_11 values(5,4); +select * from test_11; +-- @session} + +select * from test_11; +Insert into test_11 values(50,50); + +-- @session:id=1{ +Insert into test_11 values(51,50); +select * from test_11; +-- @session} + +select * from test_11; +commit; +set autocommit=1; + +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; + +-- @session:id=1{ +set autocommit=0; +select * from test_11; +Insert into test_11 values(5,4); +select * from test_11; +-- @session} + +select * from test_11; +Insert into test_11 values(50,50); + +-- @session:id=1{ +Insert into test_11 values(50,50); +select * from test_11; +-- @session} + +select * from test_11; +commit; +set autocommit=1; + +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +delete from test_11 where c = 50; +select * from test_11; +-- @session} +select * from test_11; + +commit; +set autocommit=1; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +update test_11 set c = 100 where d = 50; +select * from test_11; +-- @session} +select * from test_11; +Insert into test_11 values(100,50); + +commit; +set autocommit=1; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +update test_11 set c = 100 where d = 50; +select * from test_11; +-- @session} +select * from test_11; +update test_11 set c = 101 where c = 50; + +commit; +set autocommit=1; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} +select * from test_11; + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +Insert into test_11 values(50,50); +select * from test_11; +-- @session} +select * from test_11; + +-- @session:id=1{ +select * from test_11; +update test_11 set c = 100 where d = 50; +select * from test_11; +-- @session} +select * from test_11; +update test_11 set c = 100 where d = 50; + +commit; +set autocommit=1; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} +select * from test_11; + + +-- ------------------------------------------------------- +drop table if exists test_11; +set autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +-- @session} + +commit; +set autocommit=1; +select * from test_11; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +-- @session} + +set autocommit=0; +drop table test_11; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} + +commit; +set autocommit=1; +select * from test_11; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +-- ------------------------------------------------------- +drop table if exists test_11; +set autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +-- @session:id=1{ +set autocommit=0; +select * from test_11; +-- @session} + +-- drop table test_11; +select * from test_11; +-- @session:id=1{ +select * from test_11; +-- @session} +commit; +set autocommit=1; + +select * from test_11; +-- @session:id=1{ +commit; +set autocommit=1; +select * from test_11; +-- @session} + +drop table if exists test_11; + + + + + diff --git a/test/result/transaction/autocommit_1.result b/test/result/transaction/autocommit_1.result new file mode 100644 index 0000000000000000000000000000000000000000..7bc7a3000c4fc5466e8977964aebf323325613a7 --- /dev/null +++ b/test/result/transaction/autocommit_1.result @@ -0,0 +1,531 @@ +SELECT @@session.autocommit; +@@autocommit +on +SET @@session.autocommit=1; +SELECT @@session.autocommit; +@@autocommit +1 +SET @@session.autocommit= 0; +SELECT @@session.autocommit; +@@autocommit +0 +SET @@session.autocommit=OFF; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +0 +SET @@session.autocommit=ON; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +0 +SET @@session.autocommit=foo; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +0 +commit; +SET @@session.autocommit=OFF; +SELECT @@session.autocommit; +@@autocommit +0 +commit; +SET @@session.autocommit=ON; +SELECT @@session.autocommit; +@@autocommit +1 +commit; +SET @@session.autocommit=foo; +convert to the system variable bool type failed +SELECT @@session.autocommit; +@@autocommit +1 +commit; +set autocommit=0; +select @@autocommit; +@@autocommit +0 +commit; +drop database if exists db; +create database db; +show databases like 'db'; +Database +db +use db; +create table tab1(a int, b int); +create index index_tab1 on tab1(a); +unexpected statement: 'create index index_tab1 on tab1 (a)' +create view view_tab1 as select * from tab1; +insert into tab1 values (2000, 3000); +rollback; +drop database if exists db; +create database db; +show databases like 'db'; +Database +db +use db; +create table tab1(a int, b int); +create index index_tab1 on tab1(a); +unexpected statement: 'create index index_tab1 on tab1 (a)' +insert into tab1 values (2000, 3000); +insert into tab1 values (10, 10); +commit; +select * from tab1; +a b +2000 3000 +10 10 +update tab1 set a=100000 where b=3000; +select * from tab1; +a b +100000 3000 +10 10 +rollback; +select * from tab1; +a b +2000 3000 +10 10 +update tab1 set a=100000 where b=3000; +commit; +select * from tab1; +a b +10 10 +100000 3000 +delete from tab1 where a=10; +rollback; +select * from tab1; +a b +10 10 +100000 3000 +delete from tab1 where a=10; +commit; +select * from tab1; +a b +100000 3000 +create view view_tab1 as select * from tab1; +select * from view_tab1; +a b +100000 3000 +insert into view_tab1 values (200, 300); +insert into view_tab1 values (10, 10); +commit; +select * from view_tab1; +a b +100000 3000 +update view_tab1 set a=100000 where b=3000; +missing FROM-clause entry for table "view_tab1" +select * from view_tab1; +a b +100000 3000 +rollback; +select * from view_tab1; +a b +100000 3000 +update view_tab1 set a=100000 where b=3000; +missing FROM-clause entry for table "view_tab1" +commit; +select * from view_tab1; +a b +100000 3000 +delete from view_tab1 where a=10; +missing FROM-clause entry for table "view_tab1" +rollback; +select * from view_tab1; +a b +100000 3000 +delete from view_tab1 where a=10; +missing FROM-clause entry for table "view_tab1" +commit; +select * from view_tab1; +a b +100000 3000 +commit; +drop database db; +use autocommit_1; +commit; +drop table if exists t1; +create table t1(col1 varchar(255)); +insert into t1 values ('helloworld'); +rollback; +select * from t1; +table "t1" does not exist +commit; +drop table if exists t2; +create table t2 (a varchar(255)); +insert into t2 values ('hello'); +commit; +select * from t2; +a +hello +commit; +drop table t2; +drop table if exists t3; +create table t3(a int); +insert into t3 values (10),(20),(30); +set @@autocommit=ON; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +set @@autocommit=OFF; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +set @@autocommit=1; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +set @@autocommit=0; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +rollback; +drop table if exists tab3; +create table tab3 (a int, b varchar(25)); +insert into tab3 values (10, 'aa'),(20, 'bb'),(30, 'cc'); +set @@autocommit=ON; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +set @@autocommit=OFF; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +set @@autocommit=1; +Uncommitted transaction exists. Please commit or rollback first. +select @@autocommit; +@@autocommit +0 +set @@autocommit=0; +Uncommitted transaction exists. Please commit or rollback first. +commit; +select * from tab3; +a b +10 aa +20 bb +30 cc +update tab3 set a=1000 where b='aa'; +select * from tab3; +a b +20 bb +30 cc +1000 aa +rollback; +delete from tab3 where b='cc'; +select * from tab3; +a b +10 aa +20 bb +commit; +select * from tab3; +a b +10 aa +20 bb +commit; +drop table tab3; +drop table if exists t4; +create table t4(a varchar(225), b int); +insert into t4 values ('aa', 1000),('bb', 2000); +begin; +select * from t4; +a b +aa 1000 +bb 2000 +update t4 set a='xxxx' where b=1000; +select * from t4; +a b +xxxx 1000 +bb 2000 +rollback; +select * from t4; +a b +aa 1000 +bb 2000 +update t4 set a='xxxx' where b=1000; +select * from t4; +a b +bb 2000 +xxxx 1000 +commit; +select * from t4; +a b +bb 2000 +xxxx 1000 +create view view_t4 as select * from t4; +begin; +select * from view_t4; +a b +bb 2000 +xxxx 1000 +delete from t4 where a='bb'; +rollback; +select * from t4; +a b +bb 2000 +xxxx 1000 +select * from view_t4; +a b +bb 2000 +xxxx 1000 +commit; +set autocommit=1; +select @@autocommit; +@@autocommit +1 +drop database if exists test_xx; +begin; +create database test_xx; +SET @@session.autocommit=1; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +1 +SET @@session.autocommit= 0; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +1 +SET @@session.autocommit=OFF; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +1 +SET @@session.autocommit=ON; +Uncommitted transaction exists. Please commit or rollback first. +SELECT @@session.autocommit; +@@autocommit +1 +commit; +show databases like 'test_xx'; +Database +test_xx +drop database if exists db; +begin; +create database db; +show databases like 'db'; +Database +db +use db; +create table table3(a int, b int); +create index index_table3 on tab1(a); +unexpected statement: 'create index index_table3 on tab1 (a)' +insert into table3 values (2000, 3000); +create view view_table3 as select * from table3; +select * from table3; +a b +2000 3000 +select * from view_table3; +a b +2000 3000 +rollback; +select * from table3; +table "table3" does not exist +select * from view_table3; +table "view_table3" does not exist +drop database if exists db; +begin; +create database db; +show databases like 'db'; +Database +db +use db; +create table table3(a int, b int); +create index index_table3 on table3(a); +unexpected statement: 'create index index_table3 on table3 (a)' +insert into table3 values (2000, 3000); +insert into table3 values (10, 10); +commit; +select * from table3; +a b +2000 3000 +10 10 +begin; +update table3 set a=100000 where b=3000; +select * from table3; +a b +10 10 +100000 3000 +rollback; +select * from table3; +a b +2000 3000 +10 10 +begin; +update table3 set a=100000 where b=3000; +commit; +select * from table3; +a b +10 10 +100000 3000 +begin; +delete from table3 where a=10; +rollback; +select * from table3; +a b +10 10 +100000 3000 +begin; +delete from table3 where a=10; +commit; +select * from table3; +a b +100000 3000 +drop table if exists t3; +start transaction; +create table t3 (b varchar(255)); +insert into t3 values ('helloworld'); +rollback ; +select * from t3; +table "t3" does not exist +drop table if exists t4; +start transaction; +create table t4 (a int); +insert into t4 values (10),(20); +commit; +select * from t4; +a +10 +20 +drop table t4; +drop table if exists t5; +start transaction; +create table t5(a int); +insert into t5 values(10),(20),(30); +drop table t5; +Only CREATE of DDL is supported in transactions +start transaction; +insert into t5 values(100),(2000),(3000); +set @autocommit=0; +Uncommitted transaction exists. Please commit or rollback first. +begin; +select * from t5; +a +10 +20 +30 +100 +2000 +3000 +insert into t5 values(1),(2),(3); +rollback; +select * from t5; +a +10 +20 +30 +100 +2000 +3000 +begin; +select * from t5; +a +10 +20 +30 +100 +2000 +3000 +insert into t5 values(100),(2000),(3000); +delete from t5; +begin; +select * from t5; +a +rollback; +select * from t5; +a +drop table t5 +start transaction; +You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at position 20 near 'start'; +set @@a=0; +the system variable does not exist +rollback; +set @@b=0; +the system variable does not exist +commit; +select @@b; +the system variable does not exist +drop database if exists db; +create database db; +show databases like 'db'; +Database +db +use db; +create table t6(a int, b int); +create index index_t6 on t6(a); +unexpected statement: 'create index index_t6 on t6 (a)' +insert into t6 values (2000, 3000); +insert into t6 values (10, 10); +select * from t6; +a b +2000 3000 +10 10 +update t6 set a=100000 where b=3000; +select * from t6; +a b +10 10 +100000 3000 +delete from t6 where a=10; +select * from t6; +a b +100000 3000 +create view view_t6 as select * from t6; +select * from view_t6; +a b +100000 3000 +insert into view_t6 values (200, 300); +insert into view_t6 values (10, 10); +select * from view_t6; +a b +100000 3000 +update view_t6 set a=100000 where b=3000; +missing FROM-clause entry for table "view_t6" +select * from view_t6; +a b +100000 3000 +delete from view_t6 where a=10; +missing FROM-clause entry for table "view_t6" +select * from view_t6; +a b +100000 3000 +drop database db; +use autocommit_1; +set @@autocommit=0; +select @@autocommit; +@@autocommit +0 +create table t7(a int); +insert into t7 values (500); +commit; +begin; +insert into t7 values (1000); +commit; +insert into t7 values (2000); +rollback; +select * from t7; +a +500 +1000 +drop table t7; +Only CREATE of DDL is supported in transactions +commit; +drop table t7; +create table t8(a int); +insert into t8 values (500); +rollback; +begin; +insert into t8 values (1000); +Invalid table name: t8 +create table t9 (a char(25)); +commit; +insert into t9 values ('hello'); +rollback; +select * from t9; +a +commit; +drop table t9; +set @@autocommit=on; + diff --git a/test/result/transaction/autocommit_atomicity.result b/test/result/transaction/autocommit_atomicity.result new file mode 100644 index 0000000000000000000000000000000000000000..88dde962e8d3707c0b3b455be5cec095ff98fe15 --- /dev/null +++ b/test/result/transaction/autocommit_atomicity.result @@ -0,0 +1,101 @@ +drop table if exists test_11; +create table test_11 (c int primary key,d int); +set @@autocommit=0; +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Rollback; +set @@autocommit=1; +select * from test_11 ; +c d +set @@autocommit=0; +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +commit; +set @@autocommit=1; +select * from test_11 ; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +set @@autocommit=0; +delete from test_11 where c < 3; +update test_11 set d = c + 1 where c >= 3; +rollback; +set @@autocommit=1; +select * from test_11 ; +c d +1 1 +2 2 +3 1 +4 2 +set @@autocommit=0; +delete from test_11 where c <3; +update test_11 set d = c + 1 where c >= 3; +commit; +set @@autocommit=1; +select * from test_11 ; +c d +3 4 +4 5 +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +rollback; +set @@autocommit=1; +select * from test_11 ; +table "test_11" does not exist +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +delete from test_11 where c <3; +update test_11 set d = c + 1 where c >= 3; +commit; +set @@autocommit=1; +select * from test_11; +c d +3 4 +4 5 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +drop table if exists test_11; +Only CREATE of DDL is supported in transactions +rollback; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +drop table if exists test_11; +Only CREATE of DDL is supported in transactions +commit; +set @@autocommit=1; +select * from test_11 ; +c d +1 1 +2 2 +3 1 +4 2 diff --git a/test/result/transaction/autocommit_isolation.result b/test/result/transaction/autocommit_isolation.result new file mode 100644 index 0000000000000000000000000000000000000000..72901004112a58ea3471e3579b05d5a05e197da3 --- /dev/null +++ b/test/result/transaction/autocommit_isolation.result @@ -0,0 +1,539 @@ +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +3 1 +4 2 +1 1 +2 2 +use autocommit_isolation; +select * from test_11; +c d +1 1 +2 2 +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +3 1 +4 2 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +delete from test_11 where c =1; +select * from test_11; +c d +3 1 +4 2 +2 2 +select * from test_11; +c d +1 1 +2 2 +update test_11 set d = c +1 where c > 2; +select * from test_11; +c d +2 2 +3 4 +4 5 +select * from test_11; +c d +1 1 +2 2 +commit; +set @@autocommit=1; +select * from test_11; +c d +2 2 +3 4 +4 5 +select * from test_11; +c d +2 2 +3 4 +4 5 +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +table "test_11" does not exist +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +delete from test_11 where c = 1; +cannot find delete table +select * from test_11; +table "test_11" does not exist +Insert into test_11 values(1,1); +tae data: duplicate +select * from test_11; +c d +1 1 +2 2 +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +3 1 +4 2 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(5,4); +select * from test_11; +c d +1 1 +2 2 +5 4 +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +Insert into test_11 values(50,50); +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +5 4 +50 50 +select * from test_11; +c d +3 1 +4 2 +50 50 +1 1 +2 2 +commit; +tae data: duplicate +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +5 4 +50 50 +select * from test_11; +c d +1 1 +2 2 +5 4 +50 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +Insert into test_11 values(50,50); +tae data: duplicate +select * from test_11; +c d +1 1 +2 2 +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +delete from test_11 where c = 50; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +50 50 +commit; +tae txn: w-w conflict error +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +50 50 +update test_11 set c = 100 where d = 50; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +Insert into test_11 values(100,50); +tae data: duplicate +commit; +tae txn: w-w conflict error +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +1 1 +2 2 +100 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +update test_11 set c = 100 where d = 50; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +50 50 +1 1 +2 2 +update test_11 set c = 101 where c = 50; +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +100 50 +101 50 +select * from test_11; +c d +1 1 +2 2 +100 50 +101 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set @@autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +50 50 +update test_11 set c = 100 where d = 50; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +update test_11 set c = 100 where d = 50; +tae data: duplicate +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +1 1 +2 2 +100 50 +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +table "test_11" does not exist +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +set @@autocommit=0; +drop table test_11; +select * from test_11; +table "test_11" does not exist +select * from test_11; +table "test_11" does not exist +commit; +set @@autocommit=1; +select * from test_11; +table "test_11" does not exist +select * from test_11; +table "test_11" does not exist +drop table if exists test_11; +set @@autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +table "test_11" does not exist +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +table "test_11" does not exist +commit; +set @@autocommit=1; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; + diff --git a/test/result/transaction/autocommit_isolation_1.result b/test/result/transaction/autocommit_isolation_1.result new file mode 100644 index 0000000000000000000000000000000000000000..64c93a66f26598ee45458b92e4c3a8590b468287 --- /dev/null +++ b/test/result/transaction/autocommit_isolation_1.result @@ -0,0 +1,574 @@ +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +3 1 +4 2 +1 1 +2 2 +use autocommit_isolation_1; +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +delete from test_11 where c =1; +select * from test_11; +c d +3 1 +4 2 +2 2 +select * from test_11; +c d +1 1 +2 2 +update test_11 set d = c +1 where c > 2; +select * from test_11; +c d +3 4 +4 5 +2 2 +select * from test_11; +c d +1 1 +2 2 +commit; +set autocommit=1; +select * from test_11; +c d +2 2 +3 4 +4 5 +commit; +set autocommit=1; +select * from test_11; +c d +2 2 +3 4 +4 5 +drop table if exists test_11; +set autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +set autocommit=0; +select * from test_11; +table "test_11" does not exist +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(5,4); +select * from test_11; +c d +5 4 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +Insert into test_11 values(50,50); +Insert into test_11 values(51,50); +select * from test_11; +c d +1 1 +2 2 +5 4 +51 50 +select * from test_11; +c d +3 1 +4 2 +50 50 +1 1 +2 2 +commit; +set autocommit=1; +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +50 50 +5 4 +51 50 +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +50 50 +5 4 +51 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +Insert into test_11 values(3,1); +Insert into test_11 values(4,2); +select * from test_11; +c d +3 1 +4 2 +1 1 +2 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(5,4); +select * from test_11; +c d +5 4 +1 1 +2 2 +select * from test_11; +c d +3 1 +4 2 +1 1 +2 2 +Insert into test_11 values(50,50); +Insert into test_11 values(50,50); +select * from test_11; +c d +5 4 +50 50 +1 1 +2 2 +select * from test_11; +c d +3 1 +4 2 +50 50 +1 1 +2 2 +commit; +set autocommit=1; +commit; +tae data: duplicate +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +3 1 +4 2 +50 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +delete from test_11 where c = 50; +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +commit; +set autocommit=1; +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +50 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +update test_11 set c = 100 where d = 50; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +Insert into test_11 values(100,50); +commit; +set autocommit=1; +commit; +tae data: duplicate +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +50 50 +100 50 +select * from test_11; +c d +1 1 +2 2 +50 50 +100 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +update test_11 set c = 100 where d = 50; +select * from test_11; +c d +100 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +update test_11 set c = 101 where c = 50; +commit; +set autocommit=1; +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +101 50 +100 50 +select * from test_11; +c d +1 1 +2 2 +101 50 +100 50 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +Insert into test_11 values(50,50); +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +select * from test_11; +c d +50 50 +1 1 +2 2 +update test_11 set c = 100 where d = 50; +select * from test_11; +c d +100 50 +1 1 +2 2 +select * from test_11; +c d +1 1 +2 2 +50 50 +update test_11 set c = 100 where d = 50; +commit; +set autocommit=1; +commit; +tae data: duplicate +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +100 50 +select * from test_11; +c d +1 1 +2 2 +100 50 +drop table if exists test_11; +set autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +set autocommit=0; +select * from test_11; +table "test_11" does not exist +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +set autocommit=0; +select * from test_11; +c d +1 1 +2 2 +set autocommit=0; +drop table test_11; +select * from test_11; +table "test_11" does not exist +select * from test_11; +c d +1 1 +2 2 +commit; +set autocommit=1; +select * from test_11; +table "test_11" does not exist +commit; +set autocommit=1; +select * from test_11; +table "test_11" does not exist +drop table if exists test_11; +set autocommit=0; +create table test_11 (c int primary key,d int); +Insert into test_11 values(1,1); +Insert into test_11 values(2,2); +select * from test_11; +c d +1 1 +2 2 +set autocommit=0; +select * from test_11; +table "test_11" does not exist +select * from test_11; +c d +1 1 +2 2 +select * from test_11; +table "test_11" does not exist +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +commit; +set autocommit=1; +select * from test_11; +c d +1 1 +2 2 +drop table if exists test_11; +