Debian Codegraph @

mysql-test/suite/innodb_gis/t/multi_pk.test

raw
1 # WL#6745 InnoDB R-tree support
2 # This test case will test R-tree split.
3
4 --source include/have_debug.inc
5 --source include/big_test.inc
6 --source include/not_valgrind.inc
7
8 # Create table with R-tree index.
9 create table t1 (c1 int, c2 varchar(255), c3 geometry not null SRID 0, primary key(c1, c2), spatial index (c3))engine=innodb charset latin1;
10
11 # Insert enough values to let R-tree split.
12 delimiter |;
13
14 create function rand_string(str_length tinyint unsigned, str_type tinyint unsigned) returns varchar(255) charset latin1
15 begin
16 declare counter int unsigned default 0;
17 declare const_chars varchar(64) charset latin1 default '0123456789';
18 declare result varchar(255) charset latin1 default '';
19
20 if str_type = 1 then
21 set const_chars = '0123456789';
22 elseif str_type = 2 then
23 set const_chars = 'abcdefghijklmnopqrstuvwxyz';
24 elseif str_type = 3 then
25 set const_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
26 elseif str_type = 4 then
27 set const_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
28 elseif str_type = 5 then
29 set const_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
30 else
31 set const_chars = '0123456789';
32 end if;
33
34 while counter < str_length do
35 set result = concat(result,substr(const_chars,ceil(rand()*(length(const_chars)-1)),1));
36 set counter = counter + 1;
37 end while;
38
39 return result;
40 end|
41
42 create procedure insert_t1(IN total int)
43 begin
44 declare i int default 1;
45 declare i2 int default 1;
46 declare str varchar(100) charset latin1 default '';
47 declare dup_key int default 1;
48 while i <= total DO
49 set i2 = floor(0+(rand()*100));
50 set str = rand_string(i2, 5);
51 select count(*) into dup_key from t1 where c2 = str and c1 = i;
52 while dup_key <> 0 do
53 set i2 = floor(0+(rand()*100));
54 set str = rand_string(i2, 5);
55 select count(*) into dup_key from t1 where c2 = str and c1 = i;
56 end while;
57 insert into t1 values (i, str, Point(i, i));
58 set i = i + 1;
59 end while;
60 end|
61
62 delimiter ;|
63
64 CALL insert_t1(10000);
65 check table t1;
66
67 start transaction;
68 CALL insert_t1(30000);
69 rollback;
70 check table t1;
71
72 # Clean up.
73 drop procedure insert_t1;
74 drop function rand_string;
75 drop table t1;
76