Commit d65bc829 authored by Aleksey Midenkov's avatar Aleksey Midenkov

Tests: (0.4) TRANSACTION support in queries (#27)

parent 6d89a4a4
......@@ -42,15 +42,30 @@ insert into t1 (x, y) values
(8, 108),
(9, 109);
set @t0= now(6);
if engine = 'innodb' then
select sys_start from t1 limit 1 into @x0;
end if;
delete from t1 where x = 3;
delete from t1 where x > 7;
insert into t1(x, y) values(3, 33);
set @str= concat('select ', fields, ' from t1 where x = 3 and y = 33 into @t1');
prepare stmt from @str; execute stmt; drop prepare stmt;
select sys_start from t1 where x = 3 and y = 33 into @t1;
if engine = 'innodb' then
set @x1= @t1;
select commit_ts(@x1) into @t1;
end if;
select x, y from t1;
select x as AS_OF_x, y from t1 for system_time as of timestamp @t0;
select x as FROM_TO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWEEN_AND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
select x as FROMTO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transaction @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction 0 and transaction @x1;
select x as FROMTO2_ext_x, y from t1 for system_time transaction from 0 to @x1;
select x as BETWAND2_ext_x, y from t1 for system_time transaction between 0 and @x1;
end if;
drop table t1;
end~~
create or replace procedure test_02(
......@@ -97,7 +112,29 @@ x y
6 106
7 107
3 33
AS_OF_x y
ASOF_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
FROMTO_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
BETWAND_x y
0 100
1 101
2 102
......@@ -108,7 +145,8 @@ AS_OF_x y
7 107
8 108
9 109
FROM_TO_x y
3 33
FROMTO_ext_x y
0 100
1 101
2 102
......@@ -119,7 +157,7 @@ FROM_TO_x y
7 107
8 108
9 109
BETWEEN_AND_x y
BETWAND_ext_x y
0 100
1 101
2 102
......@@ -141,7 +179,29 @@ x y
6 106
7 107
3 33
AS_OF_x y
ASOF_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
FROMTO_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
BETWAND_x y
0 100
1 101
2 102
......@@ -152,7 +212,65 @@ AS_OF_x y
7 107
8 108
9 109
FROM_TO_x y
3 33
FROMTO_ext_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
BETWAND_ext_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
ASOF2_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
FROMTO2_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
BETWAND2_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
FROMTO2_ext_x y
0 100
1 101
2 102
......@@ -163,7 +281,7 @@ FROM_TO_x y
7 107
8 108
9 109
BETWEEN_AND_x y
BETWAND2_ext_x y
0 100
1 101
2 102
......
......@@ -28,16 +28,34 @@ begin
(8, 108),
(9, 109);
set @t0= now(6);
if engine = 'innodb' then
select sys_start from t1 limit 1 into @x0;
end if;
delete from t1 where x = 3;
delete from t1 where x > 7;
insert into t1(x, y) values(3, 33);
set @str= concat('select ', fields, ' from t1 where x = 3 and y = 33 into @t1');
prepare stmt from @str; execute stmt; drop prepare stmt;
select sys_start from t1 where x = 3 and y = 33 into @t1;
if engine = 'innodb' then
set @x1= @t1;
select commit_ts(@x1) into @t1;
end if;
select x, y from t1;
select x as AS_OF_x, y from t1 for system_time as of timestamp @t0;
select x as FROM_TO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWEEN_AND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
select x as FROMTO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transaction @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction 0 and transaction @x1;
select x as FROMTO2_ext_x, y from t1 for system_time transaction from 0 to @x1;
select x as BETWAND2_ext_x, y from t1 for system_time transaction between 0 and @x1;
end if;
drop table t1;
end~~
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment