~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/heap_var.test

Cleanup around SAFEMALLOC

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Test MEMORY tables with variable-sized records.
3
 
#
4
 
 
5
 
--disable_warnings
6
 
drop table if exists t1;
7
 
--enable_warnings
8
 
 
9
 
set @@session.max_heap_table_size=16*1024*1024;
10
 
 
11
 
--error 1234
12
 
create temporary table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=MEMORY comment="testing heaps" block_size=128;
13
 
 
14
 
--error 1234
15
 
create temporary table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=MEMORY comment="testing heaps" block_size=4;
16
 
 
17
 
create temporary table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=MEMORY comment="testing heaps" block_size=24;
18
 
 
19
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
20
 
show table status like "t1";
21
 
 
22
 
insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
23
 
select * from t1;
24
 
 
25
 
delete from t1 where a = 3;
26
 
select * from t1;
27
 
 
28
 
insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
29
 
select * from t1;
30
 
 
31
 
update t1 set c = '012345678901234567890123456789' where a = 2;
32
 
select * from t1;
33
 
 
34
 
update t1 set c = '0123456789' where a = 2;
35
 
select * from t1;
36
 
 
37
 
insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
38
 
select * from t1;
39
 
 
40
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
41
 
show table status like "t1";
42
 
alter table t1 block_size = 0;
43
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
44
 
show table status like "t1";
45
 
alter table t1 row_format = dynamic;
46
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
47
 
show table status like "t1";
48
 
alter table t1 block_size = 128;
49
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
50
 
show table status like "t1";
51
 
 
52
 
select * from t1;
53
 
 
54
 
delete from t1;
55
 
select * from t1;
56
 
 
 
1
#
 
2
# Test heap tables with variable-sized records.
 
3
#
 
4
 
 
5
--disable_warnings
 
6
drop table if exists t1;
 
7
--enable_warnings
 
8
 
 
9
set @@session.max_heap_table_size=16*1024*1024;
 
10
 
 
11
--error 1234
 
12
create table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" block_size=128;
 
13
 
 
14
--error 1234
 
15
create table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" block_size=4;
 
16
 
 
17
create table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" block_size=24;
 
18
 
 
19
#show table status like "t1";
 
20
 
 
21
insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
 
22
select * from t1;
 
23
 
 
24
delete from t1 where a = 3;
 
25
select * from t1;
 
26
 
 
27
insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
 
28
select * from t1;
 
29
 
 
30
update t1 set c = '012345678901234567890123456789' where a = 2;
 
31
select * from t1;
 
32
 
 
33
update t1 set c = '0123456789' where a = 2;
 
34
select * from t1;
 
35
 
 
36
insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
 
37
select * from t1;
 
38
 
 
39
#show table status like "t1";
 
40
alter table t1 block_size = 0;
 
41
#show table status like "t1";
 
42
alter table t1 row_format = dynamic;
 
43
#show table status like "t1";
 
44
alter table t1 block_size = 128, max_rows = 10001;
 
45
#show table status like "t1";
 
46
 
 
47
select * from t1;
 
48
 
 
49
delete from t1;
 
50
select * from t1;
 
51
 
57
52
let $1=10001;
 
53
 
 
54
disable_query_log;
58
55
 
59
 
disable_query_log;
60
 
begin;
61
56
while ($1) 
62
57
{
63
 
 
 
58
 
64
59
  eval insert into t1 values ($1,$1,$1,$1);
65
 
 
 
60
 
66
61
  dec $1;
67
 
 
68
 
}
69
 
commit;
70
 
enable_query_log;
71
 
 
72
 
select count(*) from t1;
73
 
 
74
 
--error 1062
75
 
insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
76
 
 
77
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
78
 
show table status like "t1";
79
 
select count(*) from t1;
80
 
 
81
 
set @@session.max_heap_table_size=default;
82
 
 
83
 
drop table t1;
84
 
 
85
 
# End of 5.0 tests
 
62
 
 
63
}
 
64
enable_query_log;
 
65
 
 
66
select count(*) from t1;
 
67
 
 
68
--error 1114
 
69
insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
 
70
 
 
71
#show table status like "t1";
 
72
select count(*) from t1;
 
73
 
 
74
set @@session.max_heap_table_size=default;
 
75
 
 
76
drop table t1;
 
77
 
 
78
# End of 5.0 tests