~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/r/type_binary.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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,'*'))
 
13
7
 
14
delete from t1;
 
15
insert into t1 values (0x4120,0x4120);
 
16
select length(concat('*',s1,'*',s2,'*')) from t1;
 
17
length(concat('*',s1,'*',s2,'*'))
 
18
7
 
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(*)
 
35
3
 
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 '' 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)
 
65
2
 
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)
 
77
2
 
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)
 
85
01
 
86
0100
 
87
0120
 
88
select hex(s1) from t1 where s1=0x01;
 
89
hex(s1)
 
90
01
 
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)
 
99
3
 
100
alter table t1 drop primary key;
 
101
select hex(s1) from t1 where s1=0x01;
 
102
hex(s1)
 
103
01
 
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)
 
112
3
 
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 'c' at row 1
 
129
Note    1265    Data truncated for column 'vc' at row 1
 
130
drop table t1;
 
131
set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
 
132
create table t1 (b binary(2), vb varbinary(2));
 
133
insert into t1 values(0x4120, 0x4120);
 
134
insert into t1 values(0x412020, NULL);
 
135
ERROR 22001: Data too long for column 'b' at row 1
 
136
insert into t1 values(NULL, 0x412020);
 
137
ERROR 22001: Data too long for column 'vb' at row 1
 
138
drop table t1;
 
139
set @@sql_mode= @old_sql_mode;
 
140
create table t1(f1 int, f2 binary(2) not null, f3 char(2) not null);
 
141
insert into t1 set f1=1;
 
142
Warnings:
 
143
Warning 1364    Field 'f2' doesn't have a default value
 
144
Warning 1364    Field 'f3' doesn't have a default value
 
145
select hex(f2), hex(f3) from t1;
 
146
hex(f2) hex(f3)
 
147
0000    
 
148
drop table t1;
 
149
End of 5.0 tests