You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

88 lines
1.6 KiB

drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
begin;
select * from t1 where id < 5 for update;
id
1
2
3
4
update t1 set id = 8 where id = 5;
update t1 set id = 8 where id = 4;
show processlist;
Id User Host db Command Time State Info Progress
x root x test Query x NULL show processlist 0.000
x root x test Query x Searching rows for update update t1 set id = 8 where id = 4 0.000
commit;
select * from t1;
id
1
2
3
8
8
drop table if exists t1;
create table t1 (id int) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
begin;
select * from t1 where id > 10 for update;
id
update t1 set id = 8;
commit;
select * from t1;
id
8
8
8
8
8
drop table if exists t1;
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
begin;
select * from t1 where id = 5 for update;
id
5
update t1 set id = 8 where id < 4;
update t1 set id = 8 where id = 5;
show processlist;
Id User Host db Command Time State Info Progress
x root x test Query x NULL show processlist 0.000
x root x test Query x Searching rows for update update t1 set id = 8 where id = 5 0.000
commit;
select * from t1;
id
4
8
8
8
8
drop table if exists t1;
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
select * from t1 for update;
id
1
2
3
4
5
update t1 set id = 8;
drop table if exists t1;
create table t1 (id int, index (id)) engine = pbxt;
insert into t1 values (1), (2), (3), (4), (5);
create procedure p1 ()
begin
select * from t1 for update;
end|
call p1 ();
id
1
2
3
4
5
update t1 set id = 8;