~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/binary.test

merge with latest from the trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
drop table if exists t1,t2;
6
6
--enable_warnings
7
7
 
8
 
create table t1 (name char(20) not null, primary key (name));
9
 
create table t2 (name char(20) binary not null, primary key (name));
10
 
insert into t1 values ("�");
11
 
insert into t1 values ("�");
12
 
insert into t1 values ("�");
13
 
insert into t2 select * from t1;
14
 
 
15
 
select * from t1 order by name;
16
 
select concat("*",name,"*") from t1 order by 1;
17
 
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
18
 
select * from t2 order by name;
19
 
select concat("*",name,"*") from t2 order by 1;
20
 
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
21
 
select name from t1 where name between '�' and '�';
22
 
select name from t2 where name between '�' and '�';
23
 
select name from t2 where name between '�' and '�';
24
 
 
25
 
drop table t1,t2;
 
8
# Conflicts between � and �. Bug#308841
 
9
#create table t1 (name char(20) not null, primary key (name));
 
10
#create table t2 (name char(20) binary not null, primary key (name));
 
11
#insert into t1 values ("�");
 
12
#insert into t1 values ("�");
 
13
#insert into t1 values ("�");
 
14
#insert into t2 select * from t1;
 
15
#
 
16
#select * from t1 order by name;
 
17
#select concat("*",name,"*") from t1 order by 1;
 
18
#select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
 
19
#select * from t2 order by name;
 
20
#select concat("*",name,"*") from t2 order by 1;
 
21
#select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
 
22
#select name from t1 where name between '�' and '�';
 
23
#select name from t2 where name between '�' and '�';
 
24
#select name from t2 where name between '�' and '�';
 
25
#
 
26
#drop table t1,t2;
26
27
 
27
28
#
28
29
# Test of binary and normal strings
56
57
#
57
58
# Test of binary and upper/lower
58
59
#
59
 
create table t1 (a char(3) binary, b binary(3));
 
60
create table t1 (a char(3) binary, b varbinary(3));
60
61
insert into t1 values ('aaa','bbb'),('AAA','BBB');
61
62
select upper(a),upper(b) from t1;
62
63
select lower(a),lower(b) from t1;
64
65
select * from t1 where lower(a)='aaa';
65
66
select * from t1 where upper(b)='BBB';
66
67
select * from t1 where lower(b)='bbb';
67
 
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
68
68
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
69
69
drop table t1;
70
70
 
84
84
#
85
85
# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
86
86
#
87
 
create table t1 (a binary);
 
87
create table t1 (a char);
88
88
show create table t1;
89
89
drop table t1;
 
90
--error 1064
 
91
create table t2 (a varbinary);
90
92
 
91
93
# End of 4.1 tests
92
94
 
93
95
#
94
96
# Bug#16857
95
97
#
96
 
create table t1 (col1 binary(4));
 
98
create table t1 (col1 char(4));
97
99
insert into t1 values ('a'),('a ');
98
100
select hex(col1) from t1;
99
 
alter table t1 modify col1 binary(10);
 
101
alter table t1 modify col1 char(10);
100
102
select hex(col1) from t1;
101
103
insert into t1 values ('b'),('b ');
102
104
select hex(col1) from t1;
108
110
#
109
111
 
110
112
CREATE TABLE t1 (
111
 
  a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', 
 
113
  a varbinary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', 
112
114
  index idx(a)
113
115
);
114
116
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');