~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/r/type_varbinary.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
create table t1 (s1 varbinary(2), s2 varbinary(2));
 
2
insert into t1 values (0x4100,0x4100);
 
3
select length(concat('*',s1,'*',s2,'*')) from t1;
 
4
length(concat('*',s1,'*',s2,'*'))
 
5
7
 
6
delete from t1;
 
7
insert into t1 values (0x4120,0x4120);
 
8
select length(concat('*',s1,'*',s2,'*')) from t1;
 
9
length(concat('*',s1,'*',s2,'*'))
 
10
7
 
11
drop table t1;
 
12
create table t1 (s1 varbinary(20), s2 varbinary(20));
 
13
show create table t1;
 
14
Table   Create Table
 
15
t1      CREATE TABLE `t1` (
 
16
  `s1` varbinary(20) DEFAULT NULL,
 
17
  `s2` varbinary(20) DEFAULT NULL
 
18
) ENGINE=DEFAULT
 
19
insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120);
 
20
select hex(s1), hex(s2) from t1;
 
21
hex(s1) hex(s2)
 
22
41      4100
 
23
41      4120
 
24
4100    4120
 
25
select count(*) from t1 where s1 < s2;
 
26
count(*)
 
27
3
 
28
drop table t1;
 
29
create table t1 (s1 varbinary(2), s2 varchar(1));
 
30
insert into t1 values (0x41,'a'), (0x4100,'b'), (0x41,'c'), (0x4100,'d');
 
31
select hex(s1),s2 from t1 order by s1,s2;
 
32
hex(s1) s2
 
33
41      a
 
34
41      c
 
35
4100    b
 
36
4100    d
 
37
drop table t1;
 
38
create table t1 (s1 varbinary(2) primary key);
 
39
insert into t1 values (0x01);
 
40
insert into t1 values (0x0120);
 
41
insert into t1 values (0x0100);
 
42
select hex(s1) from t1 order by s1;
 
43
hex(s1)
 
44
01
 
45
0100
 
46
0120
 
47
select hex(s1) from t1 where s1=0x01;
 
48
hex(s1)
 
49
01
 
50
select hex(s1) from t1 where s1=0x0120;
 
51
hex(s1)
 
52
0120
 
53
select hex(s1) from t1 where s1=0x0100;
 
54
hex(s1)
 
55
0100
 
56
select count(distinct s1) from t1;
 
57
count(distinct s1)
 
58
3
 
59
alter table t1 drop primary key;
 
60
select hex(s1) from t1 where s1=0x01;
 
61
hex(s1)
 
62
01
 
63
select hex(s1) from t1 where s1=0x0120;
 
64
hex(s1)
 
65
0120
 
66
select hex(s1) from t1 where s1=0x0100;
 
67
hex(s1)
 
68
0100
 
69
select count(distinct s1) from t1;
 
70
count(distinct s1)
 
71
3
 
72
drop table t1;
 
73
select hex(cast(0x10 as binary(2)));
 
74
hex(cast(0x10 as binary(2)))
 
75
1000
 
76
create table t1 (b varbinary(2), vb varbinary(2));
 
77
insert into t1 values(0x4120, 0x4120);
 
78
insert into t1 values(0x412020, 0x412020);
 
79
ERROR 22001: Data too long for column 'b' at row 1
 
80
drop table t1;
 
81
create table t1 (c char(2), vc varchar(2));
 
82
insert into t1 values(0x4120, 0x4120);
 
83
insert into t1 values(0x412020, 0x412020);
 
84
Warnings:
 
85
Note    1265    Data truncated for column 'c' at row 1
 
86
Note    1265    Data truncated for column 'vc' at row 1
 
87
drop table t1;
 
88
create table t1 (b varbinary(2), vb varbinary(2));
 
89
insert into t1 values(0x4120, 0x4120);
 
90
insert into t1 values(0x412020, NULL);
 
91
ERROR 22001: Data too long for column 'b' at row 1
 
92
insert into t1 values(NULL, 0x412020);
 
93
ERROR 22001: Data too long for column 'vb' at row 1
 
94
drop table t1;
 
95
End of 5.0 tests