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

« back to all changes in this revision

Viewing changes to mysql-test/t/type_bit_innodb.test

  • 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
--source include/have_innodb.inc
 
2
#
 
3
# testing of the BIT column type
 
4
#
 
5
 
 
6
select 0 + b'1';
 
7
select 0 + b'0';
 
8
select 0 + b'000001';
 
9
select 0 + b'000011';
 
10
select 0 + b'000101';
 
11
select 0 + b'000000';
 
12
select 0 + b'10000000';
 
13
select 0 + b'11111111';
 
14
select 0 + b'10000001';
 
15
select 0 + b'1000000000000000';
 
16
select 0 + b'1111111111111111';
 
17
select 0 + b'1000000000000001';
 
18
 
 
19
--disable_warnings
 
20
drop table if exists t1;
 
21
--enable_warnings
 
22
 
 
23
--error 1439
 
24
create table t1 (a bit(65)) engine=innodb;
 
25
 
 
26
create table t1 (a bit(0)) engine=innodb;
 
27
show create table t1;
 
28
drop table t1;
 
29
 
 
30
create table t1 (a bit(64)) engine=innodb;
 
31
insert into t1 values 
 
32
(b'1111111111111111111111111111111111111111111111111111111111111111'),
 
33
(b'1000000000000000000000000000000000000000000000000000000000000000'),
 
34
(b'0000000000000000000000000000000000000000000000000000000000000001'),
 
35
(b'1010101010101010101010101010101010101010101010101010101010101010'),
 
36
(b'0101010101010101010101010101010101010101010101010101010101010101');
 
37
select hex(a) from t1;
 
38
drop table t1;
 
39
 
 
40
create table t1 (a bit) engine=innodb;
 
41
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
 
42
select hex(a) from t1;
 
43
--error ER_DUP_ENTRY
 
44
alter table t1 add unique (a);
 
45
drop table t1;
 
46
 
 
47
create table t1 (a bit(2)) engine=innodb;
 
48
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
 
49
select a+0 from t1;
 
50
alter table t1 add key (a);
 
51
explain select a+0 from t1;
 
52
select a+0 from t1;
 
53
drop table t1;
 
54
 
 
55
create table t1 (a bit(7), b bit(9), key(a, b)) engine=innodb;
 
56
insert into t1 values 
 
57
(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),    
 
58
(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),   
 
59
(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),    
 
60
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
 
61
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),   
 
62
(44, 307), (68, 454), (57, 135);
 
63
explain select a+0 from t1;
 
64
select a+0 from t1;
 
65
explain select b+0 from t1;
 
66
select b+0 from t1;
 
67
explain select a+0, b+0 from t1;
 
68
select a+0, b+0 from t1;
 
69
explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
 
70
select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
 
71
explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 
72
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 
73
set @@max_length_for_sort_data=0;
 
74
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 
75
select hex(min(a)) from t1;
 
76
select hex(min(b)) from t1;
 
77
select hex(min(a)), hex(max(a)), hex(min(b)), hex(max(b)) from t1;
 
78
drop table t1;
 
79
 
 
80
create table t1 (a int not null, b bit, c bit(9), key(a, b, c)) engine=innodb;
 
81
insert into t1 values
 
82
(4, NULL, 1), (4, 0, 3), (2, 1, 4), (1, 1, 100), (4, 0, 23), (4, 0, 54),
 
83
(56, 0, 22), (4, 1, 100), (23, 0, 1), (4, 0, 34);
 
84
select a+0, b+0, c+0 from t1;
 
85
select hex(min(b)) from t1 where a = 4;
 
86
select hex(min(c)) from t1 where a = 4 and b = 0;
 
87
select hex(max(b)) from t1;
 
88
select a+0, b+0, c+0 from t1 where a = 4 and b = 0 limit 2;
 
89
select a+0, b+0, c+0 from t1 where a = 4 and b = 1;
 
90
select a+0, b+0, c+0 from t1 where a = 4 and b = 1 and c=100;
 
91
select a+0, b+0, c+0 from t1 order by b desc;
 
92
select a+0, b+0, c+0 from t1 order by c;
 
93
drop table t1;
 
94
 
 
95
create table t1(a bit(2), b bit(2)) engine=innodb;
 
96
insert into t1 (a) values (0x01), (0x03), (0x02);
 
97
update t1 set b= concat(a);
 
98
select a+0, b+0 from t1;
 
99
drop table t1;
 
100
 
 
101
# Some magic numbers
 
102
 
 
103
create table t1 (a bit(7), key(a)) engine=innodb;
 
104
insert into t1 values (44), (57);
 
105
select a+0 from t1;
 
106
drop table t1;
 
107
 
 
108
#
 
109
# Test conversion to and from strings
 
110
#
 
111
create table t1 (a bit(3), b bit(12)) engine=innodb;
 
112
insert into t1 values (7,(1<<12)-2), (0x01,0x01ff);
 
113
select hex(a),hex(b) from t1;
 
114
select hex(concat(a)),hex(concat(b)) from t1;
 
115
drop table t1;
 
116
 
 
117
#
 
118
# Bug #9571: problem with primary key creation
 
119
#
 
120
 
 
121
create table t1(a int, b bit not null) engine=innodb;
 
122
alter table t1 add primary key (a);
 
123
drop table t1;
 
124
 
 
125
#
 
126
# altering tables
 
127
#
 
128
 
 
129
create table t1 (a bit, b bit(10)) engine=innodb;
 
130
show create table t1;
 
131
alter table t1 engine=heap;
 
132
show create table t1;
 
133
alter table t1 engine=innodb;
 
134
show create table t1;
 
135
drop table t1;
 
136
 
 
137
#
 
138
# Bug #13601: Wrong field length reported for BIT fields
 
139
#
 
140
create table t1 (a bit(7)) engine=innodb;
 
141
insert into t1 values (0x60);
 
142
--enable_metadata
 
143
select * from t1;
 
144
--disable_metadata
 
145
drop table t1;
 
146
 
 
147
--echo End of 5.0 tests