~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/binary.result

  • Committer: Monty Taylor
  • Date: 2008-12-17 04:51:36 UTC
  • mto: (685.1.38 devel) (713.1.1 devel)
  • mto: This revision was merged to the branch mainline in revision 713.
  • Revision ID: monty@inaugust.com-20081217045136-3k9rkedxl9u7g7ev
Fixed binary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1,t2;
2
 
create table t1 (name char(20) not null, primary key (name));
3
 
create table t2 (name char(20) binary not null, primary key (name));
4
 
insert into t1 values ("�");
5
 
insert into t1 values ("�");
6
 
insert into t1 values ("�");
7
 
insert into t2 select * from t1;
8
 
select * from t1 order by name;
9
 
name
10
 
11
 
12
 
13
 
select concat("*",name,"*") from t1 order by 1;
14
 
concat("*",name,"*")
15
 
*�*
16
 
*�*
17
 
*�*
18
 
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
19
 
min(name)       min(concat("*",name,"*"))       max(name)       max(concat("*",name,"*"))
20
 
�       *�*     �       *�*
21
 
select * from t2 order by name;
22
 
name
23
 
24
 
25
 
26
 
select concat("*",name,"*") from t2 order by 1;
27
 
concat("*",name,"*")
28
 
*�*
29
 
*�*
30
 
*�*
31
 
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
32
 
min(name)       min(concat("*",name,"*"))       max(name)       max(concat("*",name,"*"))
33
 
�       *�*     �       *�*
34
 
select name from t1 where name between '�' and '�';
35
 
name
36
 
37
 
38
 
select name from t2 where name between '�' and '�';
39
 
name
40
 
41
 
42
 
43
 
select name from t2 where name between '�' and '�';
44
 
name
45
 
drop table t1,t2;
46
2
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
47
3
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
48
4
select concat("-",a,"-",b,"-") from t1 where a="hello";
49
5
concat("-",a,"-",b,"-")
50
 
-hello-hello-
 
6
-hello -hello -
51
7
select concat("-",a,"-",b,"-") from t1 where a="hello ";
52
8
concat("-",a,"-",b,"-")
53
 
-hello-hello-
 
9
-hello -hello -
54
10
select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
55
11
concat("-",a,"-",b,"-")
56
 
-hello-hello-
 
12
-hello -hello -
57
13
select concat("-",a,"-",b,"-") from t1 where b="hello";
58
14
concat("-",a,"-",b,"-")
59
 
-hello-hello-
 
15
-hello -hello -
60
16
select concat("-",a,"-",b,"-") from t1 where b="hello ";
61
17
concat("-",a,"-",b,"-")
62
 
-hello-hello-
 
18
-hello -hello -
63
19
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
64
20
concat("-",a,"-",b,"-")
65
 
-hello-hello-
 
21
-hello -hello -
66
22
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
67
23
select concat("-",a,"-",b,"-") from t1;
68
24
concat("-",a,"-",b,"-")
69
 
-hello-hello-
70
 
-hello2-hello2-
 
25
-hello -hello -
 
26
-hello2 -hello2 -
71
27
select concat("-",a,"-",b,"-") from t1 where b="hello ";
72
28
concat("-",a,"-",b,"-")
73
 
-hello-hello-
 
29
-hello -hello -
74
30
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
75
31
concat("-",a,"-",b,"-")
76
 
-hello-hello-
 
32
-hello -hello -
77
33
drop table t1;
78
34
create table t1 (b char(8));
79
35
insert into t1 values(NULL);
85
41
select b from t1 having binary b like '';
86
42
b
87
43
drop table t1;
88
 
create table t1 (a char(3) binary, b binary(3));
 
44
create table t1 (a char(3) binary, b varbinary(3));
89
45
insert into t1 values ('aaa','bbb'),('AAA','BBB');
90
46
select upper(a),upper(b) from t1;
91
47
upper(a)        upper(b)
109
65
select * from t1 where lower(b)='bbb';
110
66
a       b
111
67
aaa     bbb
112
 
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
113
 
charset(a)      charset(b)      charset(binary 'ccc')
114
 
latin1  binary  binary
115
68
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
116
69
collation(a)    collation(b)    collation(binary 'ccc')
117
 
latin1_bin      binary  binary
 
70
utf8_bin        binary  binary
118
71
drop table t1;
119
72
create table t1( firstname char(20), lastname char(20));
120
73
insert into t1 values ("john","doe"),("John","Doe");
134
87
firstname       lastname
135
88
John    Doe
136
89
drop table t1;
137
 
create table t1 (a binary);
 
90
create table t1 (a char);
138
91
show create table t1;
139
92
Table   Create Table
140
 
t1      CREATE TABLE "t1" (
141
 
  "a" binary(1)
142
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
93
t1      CREATE TABLE `t1` (
 
94
  `a` varchar(1)
 
95
) ENGINE=InnoDB
143
96
drop table t1;
144
 
create table t1 (col1 binary(4));
 
97
create table t2 (a varbinary);
 
98
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ')' at line 1
 
99
create table t1 (col1 char(4));
145
100
insert into t1 values ('a'),('a ');
146
101
select hex(col1) from t1;
147
102
hex(col1)
148
 
61000000
149
 
61200000
150
 
alter table t1 modify col1 binary(10);
 
103
61
 
104
6120
 
105
alter table t1 modify col1 char(10);
151
106
select hex(col1) from t1;
152
107
hex(col1)
153
 
61000000000000000000
154
 
61200000000000000000
 
108
61
 
109
6120
155
110
insert into t1 values ('b'),('b ');
156
111
select hex(col1) from t1;
157
112
hex(col1)
158
 
61000000000000000000
159
 
61200000000000000000
160
 
62000000000000000000
161
 
62200000000000000000
 
113
61
 
114
6120
 
115
62
 
116
6220
162
117
drop table t1;
163
118
CREATE TABLE t1 (
164
 
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', 
 
119
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', 
165
120
index idx(a)
166
121
);
167
122
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
174
129
1F9480179366F2BF567E1C4B964C1EF029087575
175
130
EXPLAIN SELECT hex(a) FROM t1 order by a;
176
131
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
177
 
1       SIMPLE  t1      index   NULL    idx     20      NULL    3       Using index
 
132
1       SIMPLE  t1      index   NULL    idx     22      NULL    3       Using index
178
133
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
179
134
hex(a)
180
135
1F9480179366F2BF567E1C4B964C1EF029082020
181
136
EXPLAIN
182
137
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
183
138
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
184
 
1       SIMPLE  t1      ref     idx     idx     20      const   1       Using where; Using index
 
139
1       SIMPLE  t1      ref     idx     idx     22      const   1       Using where; Using index
185
140
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
186
141
hex(a)
187
142
DROP TABLE t1;