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

« back to all changes in this revision

Viewing changes to mysql-test/suite/ndb/t/ndb_restore_print.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/ndb_default_cluster.inc
 
3
-- source include/not_embedded.inc
 
4
 
 
5
--disable_warnings
 
6
use test;
 
7
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
 
8
--enable_warnings
 
9
 
 
10
# basic datatypes
 
11
create table t1
 
12
 (pk int key
 
13
  ,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
 
14
  ,b1 TINYINT, b2 TINYINT UNSIGNED
 
15
  ,c1 SMALLINT, c2 SMALLINT UNSIGNED
 
16
  ,d1 INT, d2 INT UNSIGNED
 
17
  ,e1 BIGINT, e2 BIGINT UNSIGNED
 
18
  ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
 
19
  ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
 
20
  ,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
 
21
  ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
 
22
 ) engine myisam;
 
23
 
 
24
# max values
 
25
insert into t1 values
 
26
 (1
 
27
  ,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
 
28
  ,127, 255
 
29
  ,32767, 65535
 
30
  ,2147483647, 4294967295
 
31
  ,9223372036854775807, 18446744073709551615
 
32
  ,'1','12345678901234567890123456789012','123456789'
 
33
  ,'1','12345678901234567890123456789012','123456789'
 
34
  ,0x12,0x123456789abcdef0, 0x012345
 
35
  ,0x12,0x123456789abcdef0, 0x00123450
 
36
 );
 
37
 
 
38
# min values
 
39
insert into t1 values
 
40
 (2
 
41
  ,0, 0, 0, 0, 0
 
42
  ,-128, 0
 
43
  ,-32768, 0
 
44
  ,-2147483648, 0
 
45
  ,-9223372036854775808, 0
 
46
  ,'','',''
 
47
  ,'','',''
 
48
  ,0x0,0x0,0x0
 
49
  ,0x0,0x0,0x0
 
50
 );
 
51
 
 
52
# null values
 
53
insert into t1 values
 
54
 (3
 
55
  ,NULL,NULL,NULL,NULL,NULL
 
56
  ,NULL,NULL
 
57
  ,NULL,NULL
 
58
  ,NULL,NULL
 
59
  ,NULL,NULL
 
60
  ,NULL,NULL,NULL
 
61
  ,NULL,NULL,NULL
 
62
  ,NULL,NULL,NULL
 
63
  ,NULL,NULL,NULL
 
64
 );
 
65
 
 
66
--vertical_results
 
67
select pk
 
68
  ,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
 
69
  ,b1, b2
 
70
  ,c1 , c2
 
71
  ,d1 , d2
 
72
  ,e1 , e2 
 
73
  ,f1 , f2, f3
 
74
  ,g1 , g2, g3
 
75
  ,hex(h1), hex(h2), hex(h3)
 
76
  ,hex(i1), hex(i2), hex(i3)
 
77
 from t1 order by pk;
 
78
 
 
79
alter table t1 engine ndb;
 
80
 
 
81
select pk
 
82
  ,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
 
83
  ,b1, b2
 
84
  ,c1 , c2
 
85
  ,d1 , d2
 
86
  ,e1 , e2 
 
87
  ,f1 , f2, f3
 
88
  ,g1 , g2, g3
 
89
  ,hex(h1), hex(h2), hex(h3)
 
90
  ,hex(i1), hex(i2), hex(i3)
 
91
 from t1 order by pk;
 
92
--horizontal_results
 
93
 
 
94
--source include/ndb_backup.inc
 
95
 
 
96
--let ndb_restore_filter=test t1
 
97
--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
 
98
--source include/ndb_backup_print.inc
 
99
 
 
100
--let ndb_restore_filter=test t1
 
101
--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by="," --fields-optionally-enclosed-by="'"
 
102
--source include/ndb_backup_print.inc
 
103
 
 
104
 
 
105
drop table t1;
 
106
 
 
107
# some binary char tests with trailing spaces
 
108
create table t1
 
109
 (pk int key
 
110
  ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
 
111
  ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
 
112
  ,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
 
113
  ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
 
114
 ) engine ndb;
 
115
 
 
116
insert into t1 values
 
117
 (1
 
118
  ,'1','12345678901234567890123456789012','123456789 '
 
119
  ,'1   ','12345678901234567890123456789012  ','123456789 '
 
120
  ,0x20,0x123456789abcdef020, 0x012345000020
 
121
  ,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
 
122
 );
 
123
 
 
124
create table t2 (pk int key, a int) engine ndb;
 
125
create table t3 (pk int key, a int) engine ndb;
 
126
create table t4 (pk int key, a int) engine ndb;
 
127
 
 
128
insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
 
129
insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
 
130
insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
 
131
 
 
132
--source include/ndb_backup.inc
 
133
--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-enclosed-by="'" --fields-optionally-enclosed-by="X"
 
134
--let ndb_restore_filter=test t1
 
135
--source include/ndb_backup_print.inc
 
136
 
 
137
--error 0,1
 
138
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
 
139
--error 0,1
 
140
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
 
141
--error 0,1
 
142
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
 
143
--error 0,1
 
144
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
 
145
 
 
146
--let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append
 
147
--let ndb_restore_filter=test
 
148
--source include/ndb_backup_print.inc
 
149
 
 
150
--let $message= t1
 
151
--source include/show_msg.inc
 
152
--exec sort $MYSQLTEST_VARDIR/tmp/t1.txt
 
153
--let $message= t2
 
154
--source include/show_msg.inc
 
155
--exec sort $MYSQLTEST_VARDIR/tmp/t2.txt
 
156
--let $message= t3
 
157
--source include/show_msg.inc
 
158
--exec sort $MYSQLTEST_VARDIR/tmp/t3.txt
 
159
--let $message= t4
 
160
--source include/show_msg.inc
 
161
--exec sort $MYSQLTEST_VARDIR/tmp/t4.txt
 
162
 
 
163
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
 
164
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
 
165
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
 
166
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
 
167
 
 
168
# now test some other datatypes
 
169
drop table t1;
 
170
create table t1
 
171
 (pk int key
 
172
  ,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
 
173
 ) engine ndb;
 
174
 
 
175
# max values
 
176
insert into t1 values(1, 8388607, 16777215);
 
177
# min values
 
178
insert into t1 values(2, -8388608, 0);
 
179
# small values
 
180
insert into t1 values(3, -1, 1);
 
181
 
 
182
# backup and print
 
183
--source include/ndb_backup.inc
 
184
 
 
185
--let ndb_restore_filter=test t1
 
186
--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
 
187
--source include/ndb_backup_print.inc
 
188
 
 
189
# clean up
 
190
drop table t1;
 
191
drop table t2;
 
192
drop table t3;
 
193
drop table t4;