~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/ndb/t/ndb_bitfield.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_ndb.inc
 
2
-- source include/not_embedded.inc
 
3
 
 
4
--disable_warnings
 
5
drop table if exists t1;
 
6
--enable_warnings
 
7
 
 
8
create table t1 (
 
9
  pk1 int not null primary key,
 
10
  b bit(64)
 
11
) engine=ndbcluster;
 
12
 
 
13
show create table t1;
 
14
insert into t1 values 
 
15
(0,b'1111111111111111111111111111111111111111111111111111111111111111'),
 
16
(1,b'1000000000000000000000000000000000000000000000000000000000000000'),
 
17
(2,b'0000000000000000000000000000000000000000000000000000000000000001'),
 
18
(3,b'1010101010101010101010101010101010101010101010101010101010101010'),
 
19
(4,b'0101010101010101010101010101010101010101010101010101010101010101');
 
20
select hex(b) from t1 order by pk1;
 
21
drop table t1;
 
22
 
 
23
create table t1 (
 
24
  pk1 int not null primary key,
 
25
  b bit(9)
 
26
) engine=ndbcluster;
 
27
insert into t1 values 
 
28
(0,b'000000000'),
 
29
(1,b'000000001'),
 
30
(2,b'000000010'),
 
31
(3,b'000000011'),
 
32
(4,b'000000100');
 
33
select hex(b) from t1 order by pk1;
 
34
update t1 set b = b + b'101010101';
 
35
select hex(b) from t1 order by pk1;
 
36
drop table t1;
 
37
 
 
38
create table t1 (a bit(7), b bit(9)) engine = ndbcluster;
 
39
insert into t1 values 
 
40
(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),    
 
41
(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),   
 
42
(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),    
 
43
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
 
44
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),   
 
45
(44, 307), (68, 454), (57, 135);
 
46
select a+0 from t1 order by a;
 
47
select b+0 from t1 order by b;
 
48
drop table t1;
 
49
 
 
50
create table t1 (
 
51
                dummyKey INTEGER NOT NULL,
 
52
                a001 TINYINT,
 
53
                a010 TINYINT,
 
54
                a012 TINYINT,
 
55
                a015 TINYINT,
 
56
                a016 TINYINT,
 
57
                a017 TINYINT,
 
58
                a019 TINYINT,
 
59
                a029 TINYINT,
 
60
                a030 TINYINT,
 
61
                a031 TINYINT,
 
62
                a032 TINYINT,
 
63
                a042 TINYINT,
 
64
                a043 TINYINT,
 
65
                a044 TINYINT,
 
66
                a3001 TINYINT,
 
67
                a3002 TINYINT,
 
68
                a3003 TINYINT,
 
69
                a3004 TINYINT,
 
70
                a3005 TINYINT,
 
71
                a3021 TINYINT,
 
72
                a3022 TINYINT,
 
73
                a BIT(6),
 
74
                b BIT(6),
 
75
                c BIT(6),
 
76
                d TINYINT,
 
77
                e TINYINT,
 
78
                f TINYINT,
 
79
                g TINYINT,
 
80
                h TINYINT,
 
81
                i TINYINT,
 
82
                j TINYINT,
 
83
                k TINYINT,
 
84
                l TINYINT,
 
85
                m TINYINT,
 
86
                n TINYINT,
 
87
                o TINYINT,
 
88
                a034 TINYINT,
 
89
PRIMARY KEY USING HASH (dummyKey) ) engine=ndb;
 
90
INSERT INTO `t1` VALUES
 
91
(1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
92
(2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
93
(3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
94
(4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
95
(5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
96
(6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
97
(7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 
98
(8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
 
99
--exec $MYSQL_DUMP --hex-blob --compact --order-by-primary --skip-extended-insert --no-create-info test t1
 
100
drop table t1;
 
101
 
 
102
--error 1005
 
103
create table t1 (
 
104
  pk1 bit(9) not null primary key,
 
105
  b int
 
106
) engine=ndbcluster;
 
107
show warnings;
 
108
 
 
109
--error 1005
 
110
create table t1 (
 
111
  pk1 int not null primary key,
 
112
  b bit(9),
 
113
  key(b)
 
114
) engine=ndbcluster;
 
115
show warnings;
 
116
 
 
117
# bug#16125
 
118
create table t1 (
 
119
  pk1 int primary key,
 
120
  b bit(32) not null
 
121
) engine=ndbcluster;
 
122
 
 
123
insert into t1 values (1,1);
 
124
drop table t1;