~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# check that 0x00 is not stripped in val_str
642.1.45 by Lee
enable type_binary test
2
create table t1 (s1 varbinary(2), s2 varbinary(2));
1 by brian
clean slate
3
insert into t1 values (0x4100,0x4100);
4
select length(concat('*',s1,'*',s2,'*')) from t1;
5
delete from t1;
6
insert into t1 values (0x4120,0x4120);
7
select length(concat('*',s1,'*',s2,'*')) from t1;
8
drop table t1;
9
10
# check that trailing 0x00 and 0x20 do matter on comparison
11
create table t1 (s1 varbinary(20), s2 varbinary(20));
942.3.1 by Vladimir Kolesnikov
test generalizations
12
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
13
show create table t1;
14
insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120);
15
select hex(s1), hex(s2) from t1;
16
select count(*) from t1 where s1 < s2;
17
drop table t1;
18
19
# check that trailing 0x00 do matter on filesort
20
create table t1 (s1 varbinary(2), s2 varchar(1));
21
insert into t1 values (0x41,'a'), (0x4100,'b'), (0x41,'c'), (0x4100,'d');
22
select hex(s1),s2 from t1 order by s1,s2;
23
drop table t1;
24
25
# check that 0x01 is not padded, and all three values are unique
26
create table t1 (s1 varbinary(2) primary key);
27
insert into t1 values (0x01);
28
insert into t1 values (0x0120);
29
insert into t1 values (0x0100);
30
select hex(s1) from t1 order by s1;
31
# check index search
32
select hex(s1) from t1 where s1=0x01;
33
select hex(s1) from t1 where s1=0x0120;
34
select hex(s1) from t1 where s1=0x0100;
35
select count(distinct s1) from t1;
36
alter table t1 drop primary key;
37
# check non-indexed search
38
select hex(s1) from t1 where s1=0x01;
39
select hex(s1) from t1 where s1=0x0120;
40
select hex(s1) from t1 where s1=0x0100;
41
select count(distinct s1) from t1;
42
drop table t1;
43
44
# check that cast appends trailing zeros
45
select hex(cast(0x10 as binary(2)));
46
47
#
48
# Bug #14299: BINARY space truncation should cause warning or error
49
# 
642.1.45 by Lee
enable type_binary test
50
create table t1 (b varbinary(2), vb varbinary(2));
1 by brian
clean slate
51
insert into t1 values(0x4120, 0x4120);
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
52
--error ER_DATA_TOO_LONG data too longer for column b
1 by brian
clean slate
53
insert into t1 values(0x412020, 0x412020);
54
drop table t1;
55
create table t1 (c char(2), vc varchar(2));
56
insert into t1 values(0x4120, 0x4120);
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
57
--error ER_DATA_TOO_LONG
1 by brian
clean slate
58
insert into t1 values(0x412020, 0x412020);
59
drop table t1;
60
642.1.45 by Lee
enable type_binary test
61
#set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
62
create table t1 (b varbinary(2), vb varbinary(2));
1 by brian
clean slate
63
insert into t1 values(0x4120, 0x4120);
64
--error ER_DATA_TOO_LONG
65
insert into t1 values(0x412020, NULL);
66
--error ER_DATA_TOO_LONG
67
insert into t1 values(NULL, 0x412020);
68
drop table t1;
642.1.45 by Lee
enable type_binary test
69
#set @@sql_mode= @old_sql_mode;
1 by brian
clean slate
70
71
--echo End of 5.0 tests