mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / r / type_binary.result
blob432c58272a238aa5b98c029d1b036f18d53c5697
1 create table t1 (s1 binary(3));
2 insert into t1 values (0x61), (0x6120), (0x612020);
3 select hex(s1) from t1;
4 hex(s1)
5 610000
6 612000
7 612020
8 drop table t1;
9 create table t1 (s1 binary(2), s2 varbinary(2));
10 insert into t1 values (0x4100,0x4100);
11 select length(concat('*',s1,'*',s2,'*')) from t1;
12 length(concat('*',s1,'*',s2,'*'))
14 delete from t1;
15 insert into t1 values (0x4120,0x4120);
16 select length(concat('*',s1,'*',s2,'*')) from t1;
17 length(concat('*',s1,'*',s2,'*'))
19 drop table t1;
20 create table t1 (s1 varbinary(20), s2 varbinary(20));
21 show create table t1;
22 Table   Create Table
23 t1      CREATE TABLE `t1` (
24   `s1` varbinary(20) DEFAULT NULL,
25   `s2` varbinary(20) DEFAULT NULL
26 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
27 insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120);
28 select hex(s1), hex(s2) from t1;
29 hex(s1) hex(s2)
30 41      4100
31 41      4120
32 4100    4120
33 select count(*) from t1 where s1 < s2;
34 count(*)
36 drop table t1;
37 create table t1 (s1 varbinary(2), s2 varchar(1));
38 insert into t1 values (0x41,'a'), (0x4100,'b'), (0x41,'c'), (0x4100,'d');
39 select hex(s1),s2 from t1 order by s1,s2;
40 hex(s1) s2
41 41      a
42 41      c
43 4100    b
44 4100    d
45 drop table t1;
46 create table t1 (s1 binary(2) primary key);
47 insert into t1 values (0x01);
48 insert into t1 values (0x0120);
49 insert into t1 values (0x0100);
50 ERROR 23000: Duplicate entry '\x01' for key 'PRIMARY'
51 select hex(s1) from t1 order by s1;
52 hex(s1)
53 0100
54 0120
55 select hex(s1) from t1 where s1=0x01;
56 hex(s1)
57 select hex(s1) from t1 where s1=0x0120;
58 hex(s1)
59 0120
60 select hex(s1) from t1 where s1=0x0100;
61 hex(s1)
62 0100
63 select count(distinct s1) from t1;
64 count(distinct s1)
66 alter table t1 drop primary key;
67 select hex(s1) from t1 where s1=0x01;
68 hex(s1)
69 select hex(s1) from t1 where s1=0x0120;
70 hex(s1)
71 0120
72 select hex(s1) from t1 where s1=0x0100;
73 hex(s1)
74 0100
75 select count(distinct s1) from t1;
76 count(distinct s1)
78 drop table t1;
79 create table t1 (s1 varbinary(2) primary key);
80 insert into t1 values (0x01);
81 insert into t1 values (0x0120);
82 insert into t1 values (0x0100);
83 select hex(s1) from t1 order by s1;
84 hex(s1)
86 0100
87 0120
88 select hex(s1) from t1 where s1=0x01;
89 hex(s1)
91 select hex(s1) from t1 where s1=0x0120;
92 hex(s1)
93 0120
94 select hex(s1) from t1 where s1=0x0100;
95 hex(s1)
96 0100
97 select count(distinct s1) from t1;
98 count(distinct s1)
100 alter table t1 drop primary key;
101 select hex(s1) from t1 where s1=0x01;
102 hex(s1)
104 select hex(s1) from t1 where s1=0x0120;
105 hex(s1)
106 0120
107 select hex(s1) from t1 where s1=0x0100;
108 hex(s1)
109 0100
110 select count(distinct s1) from t1;
111 count(distinct s1)
113 drop table t1;
114 select hex(cast(0x10 as binary(2)));
115 hex(cast(0x10 as binary(2)))
116 1000
117 create table t1 (b binary(2), vb varbinary(2));
118 insert into t1 values(0x4120, 0x4120);
119 insert into t1 values(0x412020, 0x412020);
120 Warnings:
121 Warning 1265    Data truncated for column 'b' at row 1
122 Warning 1265    Data truncated for column 'vb' at row 1
123 drop table t1;
124 create table t1 (c char(2), vc varchar(2));
125 insert into t1 values(0x4120, 0x4120);
126 insert into t1 values(0x412020, 0x412020);
127 Warnings:
128 Note    1265    Data truncated for column 'vc' at row 1
129 drop table t1;
130 set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
131 create table t1 (b binary(2), vb varbinary(2));
132 insert into t1 values(0x4120, 0x4120);
133 insert into t1 values(0x412020, NULL);
134 ERROR 22001: Data too long for column 'b' at row 1
135 insert into t1 values(NULL, 0x412020);
136 ERROR 22001: Data too long for column 'vb' at row 1
137 drop table t1;
138 set @@sql_mode= @old_sql_mode;
139 create table t1(f1 int, f2 binary(2) not null, f3 char(2) not null);
140 insert into t1 set f1=1;
141 Warnings:
142 Warning 1364    Field 'f2' doesn't have a default value
143 Warning 1364    Field 'f3' doesn't have a default value
144 select hex(f2), hex(f3) from t1;
145 hex(f2) hex(f3)
146 0000    
147 drop table t1;
148 End of 5.0 tests