~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/pbxt/binary.result

  • Committer: Devananda
  • Date: 2009-07-04 01:55:13 UTC
  • mto: (1086.10.1 length-plugin)
  • mto: This revision was merged to the branch mainline in revision 1095.
  • Revision ID: deva@myst-20090704015513-gtqliazxtfm7sdvf
refactored function/length into plugin/length

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1,t2;
2
 
create table t1 (a char(10) not null, b char(10) not null,key (a), key(b));
3
 
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
4
 
select concat("-",a,"-",b,"-") from t1 where a="hello";
5
 
concat("-",a,"-",b,"-")
6
 
-hello -hello -
7
 
select concat("-",a,"-",b,"-") from t1 where a="hello ";
8
 
concat("-",a,"-",b,"-")
9
 
-hello -hello -
10
 
select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
11
 
concat("-",a,"-",b,"-")
12
 
-hello -hello -
13
 
select concat("-",a,"-",b,"-") from t1 where b="hello";
14
 
concat("-",a,"-",b,"-")
15
 
-hello -hello -
16
 
select concat("-",a,"-",b,"-") from t1 where b="hello ";
17
 
concat("-",a,"-",b,"-")
18
 
-hello -hello -
19
 
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
20
 
concat("-",a,"-",b,"-")
21
 
-hello -hello -
22
 
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
23
 
select concat("-",a,"-",b,"-") from t1;
24
 
concat("-",a,"-",b,"-")
25
 
-hello -hello -
26
 
-hello2 -hello2 -
27
 
select concat("-",a,"-",b,"-") from t1 where b="hello ";
28
 
concat("-",a,"-",b,"-")
29
 
-hello -hello -
30
 
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
31
 
concat("-",a,"-",b,"-")
32
 
-hello -hello -
33
 
drop table t1;
34
 
create table t1 (b char(8));
35
 
insert into t1 values(NULL);
36
 
select b from t1 where binary b like '';
37
 
b
38
 
select b from t1 group by binary b like '';
39
 
b
40
 
NULL
41
 
select b from t1 having binary b like '';
42
 
b
43
 
drop table t1;
44
 
create table t1 (a char(3), b varbinary(3));
45
 
insert into t1 values ('aaa','bbb'),('AAA','BBB');
46
 
select upper(a),upper(b) from t1;
47
 
upper(a)        upper(b)
48
 
AAA     bbb
49
 
AAA     BBB
50
 
select lower(a),lower(b) from t1;
51
 
lower(a)        lower(b)
52
 
aaa     bbb
53
 
aaa     BBB
54
 
select * from t1 where upper(a)='AAA';
55
 
a       b
56
 
aaa     bbb
57
 
AAA     BBB
58
 
select * from t1 where lower(a)='aaa';
59
 
a       b
60
 
aaa     bbb
61
 
AAA     BBB
62
 
select * from t1 where upper(b)='BBB';
63
 
a       b
64
 
AAA     BBB
65
 
select * from t1 where lower(b)='bbb';
66
 
a       b
67
 
aaa     bbb
68
 
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
69
 
collation(a)    collation(b)    collation(binary 'ccc')
70
 
utf8_general_ci binary  binary
71
 
drop table t1;
72
 
create table t1( firstname char(20), lastname char(20));
73
 
insert into t1 values ("john","doe"),("John","Doe");
74
 
select * from t1 where firstname='john' and firstname like binary 'john';
75
 
firstname       lastname
76
 
john    doe
77
 
select * from t1 where firstname='john' and binary 'john' = firstname;
78
 
firstname       lastname
79
 
john    doe
80
 
select * from t1 where firstname='john' and firstname = binary 'john';
81
 
firstname       lastname
82
 
john    doe
83
 
select * from t1 where firstname='John' and firstname like binary 'john';
84
 
firstname       lastname
85
 
john    doe
86
 
select * from t1 where firstname='john' and firstname like binary 'John';
87
 
firstname       lastname
88
 
John    Doe
89
 
drop table t1;
90
 
create table t1 (a char);
91
 
show create table t1;
92
 
Table   Create Table
93
 
t1      CREATE TABLE `t1` (
94
 
  `a` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL
95
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
96
 
drop table t1;
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));
100
 
insert into t1 values ('a'),('a ');
101
 
select hex(col1) from t1;
102
 
hex(col1)
103
 
61
104
 
6120
105
 
alter table t1 modify col1 char(10);
106
 
select hex(col1) from t1;
107
 
hex(col1)
108
 
61
109
 
6120
110
 
insert into t1 values ('b'),('b ');
111
 
select hex(col1) from t1;
112
 
hex(col1)
113
 
61
114
 
6120
115
 
62
116
 
6220
117
 
drop table t1;
118
 
CREATE TABLE t1 (
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', 
120
 
index idx(a)
121
 
);
122
 
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
123
 
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
124
 
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707');
125
 
SELECT hex(a) FROM t1 order by a;
126
 
hex(a)
127
 
1F9480179366F2BF567E1C4B964C1EF029080707
128
 
1F9480179366F2BF567E1C4B964C1EF029082020
129
 
1F9480179366F2BF567E1C4B964C1EF029087575
130
 
EXPLAIN SELECT hex(a) FROM t1 order by a;
131
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
132
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    3       Using filesort
133
 
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
134
 
hex(a)
135
 
1F9480179366F2BF567E1C4B964C1EF029082020
136
 
EXPLAIN
137
 
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
138
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
139
 
1       SIMPLE  t1      ref     idx     idx     22      const   1       Using where
140
 
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
141
 
hex(a)
142
 
DROP TABLE t1;
143
 
CREATE TABLE t1 (
144
 
id numeric(20) NOT NULL,
145
 
lang varchar(8) NOT NULL,
146
 
msg varchar(32) NOT NULL,
147
 
PRIMARY KEY (id,lang)
148
 
);
149
 
INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz');
150
 
INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx');
151
 
INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy');
152
 
SELECT * FROM t1 WHERE id=32;
153
 
id      lang    msg
154
 
32      en      yyyyyyy
155
 
DROP TABLE t1;