| 1 |
create table t1 (a int key) engine ndb; |
| 2 |
insert into t1 values (1); |
| 3 |
insert into t1 select a+1 from t1; |
| 4 |
insert into t1 select a+2 from t1; |
| 5 |
insert into t1 select a+4 from t1; |
| 6 |
insert into t1 select a+8 from t1; |
| 7 |
insert into t1 select a+16 from t1; |
| 8 |
insert into t1 select a+32 from t1; |
| 9 |
insert into t1 select a+64 from t1; |
| 10 |
insert into t1 select a+128 from t1; |
| 11 |
select count(*) from t1; |
| 12 |
count(*) |
| 13 |
256 |
| 14 |
|
| 15 |
# test: simple delete of multiple pk's |
| 16 |
# expected result 1 roundtrips |
| 17 |
# 0 - info call |
| 18 |
# 0 - read the rows (with read before delete, this is 1) |
| 19 |
# 0 - delete the rows (without bulk update this is 5 + 1 for execute no commit) |
| 20 |
# 1 - delete the row + commit the transaction |
| 21 |
|
| 22 |
delete from t1 where a in (1,7, 90, 100, 130); |
| 23 |
affected rows: 5 |
| 24 |
ndb_execute_count |
| 25 |
1 |
| 26 |
affected rows: 1 |
| 27 |
# expected result 1 roundtrips |
| 28 |
# 0 - info call |
| 29 |
# 0 - read the rows |
| 30 |
# 0 - delete the rows |
| 31 |
# 1 - commit |
| 32 |
# affected = 0 |
| 33 |
|
| 34 |
delete from t1 where a=1000; |
| 35 |
affected rows: 0 |
| 36 |
ndb_execute_count |
| 37 |
1 |
| 38 |
affected rows: 1 |
| 39 |
# expected result 1 roundtrips |
| 40 |
# 0 - info call |
| 41 |
# 0 - read the rows |
| 42 |
# 0 - delete the rows |
| 43 |
# 1 - commit |
| 44 |
# affected = 0 |
| 45 |
|
| 46 |
delete from t1 where a in (1000, 1001, 1002, 1003, 1004); |
| 47 |
affected rows: 0 |
| 48 |
ndb_execute_count |
| 49 |
1 |
| 50 |
affected rows: 1 |
| 51 |
select count(*) as "0(was deleted)" from t1 where a in (1,7, 90, 100, 130); |
| 52 |
0(was deleted) |
| 53 |
0 |
| 54 |
select count(*) as "0(never existed)" from t1 where a=1000; |
| 55 |
0(never existed) |
| 56 |
0 |
| 57 |
select count(*) as "0(never existed)" from t1 |
| 58 |
where a in (1000, 1001, 1002, 1003, 1004); |
| 59 |
0(never existed) |
| 60 |
0 |
| 61 |
select count(*) as "251(remaining)" from t1; |
| 62 |
251(remaining) |
| 63 |
251 |
| 64 |
select count(*) as "5(not deleted)" from t1 where a in (2, 3, 4, 5, 6); |
| 65 |
5(not deleted) |
| 66 |
5 |
| 67 |
drop table t1; |
| 68 |
create table t2 ( |
| 69 |
a int primary key, |
| 70 |
b varchar(256) character set latin1) |
| 71 |
engine ndb; |
| 72 |
Has loaded 2000 rows |
| 73 |
2000 |
| 74 |
Should be 1500 rows left now |
| 75 |
1500 |
| 76 |
drop table t2, t3; |