federated.test 61.4 KB
Newer Older
1
source include/federated.inc;
2 3

connection slave;
4
DROP TABLE IF EXISTS federated.t1;
5 6 7 8 9 10 11
CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  DEFAULT CHARSET=latin1;

connection master;
12
DROP TABLE IF EXISTS federated.t1;
13
# test too many items (malformed) in the comment string url
14 15
--error 1432
CREATE TABLE federated.t1 (
16 17 18 19
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
20
  CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
21 22

# test not enough items (malformed) in the comment string url
23 24
--error 1432 
CREATE TABLE federated.t1 (
25 26 27 28
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
29
  CONNECTION='mysql://root@127.0.0.1';
30 31 32

# test non-existant table
--replace_result $SLAVE_MYPORT SLAVE_PORT
33
--error 1434
34 35 36 37 38
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
39
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3';
40 41 42

# test bad user/password 
--replace_result $SLAVE_MYPORT SLAVE_PORT
43
--error 1429
44 45 46 47 48
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
49
  CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1';
50 51 52 53 54 55 56 57 58

DROP TABLE IF EXISTS federated.t1;
# # correct connection, same named tables
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
59
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');

SELECT * FROM federated.t1;
DELETE FROM federated.t1;
DROP TABLE federated.t1;

# correct connection, differently named tables
DROP TABLE IF EXISTS federated.t2;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t2 (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
76
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
77

78 79
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval SHOW CREATE TABLE federated.t2;
80

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');

SELECT * FROM federated.t2;
DROP TABLE federated.t2;

connection slave;
DROP TABLE IF EXISTS federated.t1;

DROP TABLE IF EXISTS federated.`t1%`;
CREATE TABLE federated.`t1%` (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  DEFAULT CHARSET=latin1;

connection master; 
DROP TABLE IF EXISTS federated.t1;

--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
106
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
107 108 109 110 111 112 113 114

INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');

SELECT * FROM federated.t1;
DELETE FROM federated.t1;
DROP TABLE IF EXISTS federated.t1;

115
--replace_result $SLAVE_MYPORT SLAVE_PORT
116 117 118 119 120
eval CREATE TABLE federated.`t1%` (
    `id` int(20) NOT NULL,
    `name` varchar(32) NOT NULL default ''
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
121
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
122 123 124 125 126 127 128 129 130 131 132

INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');

SELECT * FROM federated.`t1%`;
DELETE FROM federated.`t1%`;
DROP TABLE IF EXISTS federated.`t1%`;

connection slave;
DROP TABLE IF EXISTS federated.`t1%`;

133
# I wanted to use timestamp, but results will fail if so!!!
134
DROP TABLE IF EXISTS federated.t1;
unknown's avatar
unknown committed
135 136 137 138 139
CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32) NOT NULL default '',
    `other` int(20) NOT NULL default '0',
    `created` datetime default '2004-04-04 04:04:04',
140
    PRIMARY KEY  (`id`))
unknown's avatar
unknown committed
141
  DEFAULT CHARSET=latin1;
142

143
connection master;
unknown's avatar
unknown committed
144 145 146 147 148 149
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32) NOT NULL default '',
    `other` int(20) NOT NULL default '0',
    `created` datetime default '2004-04-04 04:04:04',
150
    PRIMARY KEY  (`id`))
unknown's avatar
unknown committed
151
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
152
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
153 154 155 156 157 158 159 160 161 162 163

INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222);
INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333);
INSERT INTO federated.t1 (name, other) VALUES ('Fourth Name', 44444);
INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555);
INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666);
INSERT INTO federated.t1 (name, other) VALUES ('Seventh Name', 77777);
INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888);
INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999);
INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010);
164 165

# basic select
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
SELECT * FROM federated.t1;
# with PRIMARY KEY index_read_idx
SELECT * FROM federated.t1 WHERE id = 5;
SELECT * FROM federated.t1 WHERE name = 'Sixth Name';
SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name';
SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444;
SELECT * FROM federated.t1 WHERE name like '%th%';
UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
SELECT * FROM federated.t1 WHERE name = '3rd name';
UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name';
SELECT * FROM federated.t1 WHERE name = 'Third name';
# rnd_post, ::position
SELECT * FROM federated.t1 ORDER BY id DESC;
SELECT * FROM federated.t1 ORDER BY name;
SELECT * FROM federated.t1 ORDER BY name DESC;
SELECT * FROM federated.t1 ORDER BY name ASC;
SELECT * FROM federated.t1 GROUP BY other;

# ::delete_row
DELETE FROM federated.t1 WHERE id = 5; 
SELECT * FROM federated.t1 WHERE id = 5;

# ::delete_all_rows
DELETE FROM federated.t1;
SELECT * FROM federated.t1 WHERE id = 5;

# previous test, but this time with indexes
connection slave;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32) NOT NULL default '',
    `other` int(20) NOT NULL default '0',
    `created` datetime NOT NULL,
    PRIMARY KEY  (`id`),
    key name(`name`),
    key other(`other`),
    key created(`created`))
  DEFAULT CHARSET=latin1;

connection master;
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32) NOT NULL default '',
    `other` int(20) NOT NULL default '0',
    `created` datetime NOT NULL,
    PRIMARY KEY  (`id`),
    key name(`name`),
    key other(`other`),
    key created(`created`))
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
219
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242

INSERT INTO federated.t1 (name, other, created)
  VALUES ('First Name', 11111, '2004-01-01 01:01:01');
INSERT INTO federated.t1 (name, other, created)
  VALUES ('Second Name', 22222, '2004-01-23 02:43:00');
INSERT INTO federated.t1 (name, other, created)
  VALUES ('Third Name', 33333, '2004-02-14 02:14:00');
INSERT INTO federated.t1 (name, other, created)
  VALUES ('Fourth Name', 44444, '2003-04-05 00:00:00');
INSERT INTO federated.t1 (name, other, created) 
  VALUES ('Fifth Name', 55555, '2001-02-02 02:02:02');
INSERT INTO federated.t1 (name, other, created) 
  VALUES ('Sixth Name', 66666, '2005-06-06 15:30:00');
INSERT INTO federated.t1 (name, other, created) 
  VALUES ('Seventh Name', 77777, '2003-12-12 18:32:00');
INSERT INTO federated.t1 (name, other, created) 
  VALUES ('Eigth Name', 88888, '2005-03-12 11:00:00');
INSERT INTO federated.t1 (name, other, created) 
  VALUES ('Ninth Name', 99999, '2005-03-12 11:00:01');
INSERT INTO federated.t1 (name, other, created) 
  VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01');

# basic select
unknown's avatar
unknown committed
243 244 245
SELECT * FROM federated.t1;
# with PRIMARY KEY index_read_idx
SELECT * FROM federated.t1 WHERE id = 5;
246
# with regular key index_read -> index_read_idx
unknown's avatar
unknown committed
247 248
# regular and PRIMARY KEY index_read_idx
SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name';
249
# with regular key index_read -> index_read_idx
unknown's avatar
unknown committed
250 251
SELECT * FROM federated.t1 WHERE other = 44444;
SELECT * FROM federated.t1 WHERE name like '%th%';
252
# update - update_row, index_read_idx
unknown's avatar
unknown committed
253 254
UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
SELECT * FROM federated.t1 WHERE name = '3rd name';
255
# update - update_row, index_read -> index_read_idx
unknown's avatar
unknown committed
256 257
UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name';
SELECT * FROM federated.t1 WHERE name = 'Third name';
258
# rnd_post, ::position
unknown's avatar
unknown committed
259 260 261 262 263
SELECT * FROM federated.t1 ORDER BY id DESC;
SELECT * FROM federated.t1 ORDER BY name;
SELECT * FROM federated.t1 ORDER BY name DESC;
SELECT * FROM federated.t1 ORDER BY name ASC;
SELECT * FROM federated.t1 GROUP BY other;
264 265

# ::delete_row
unknown's avatar
unknown committed
266 267
DELETE FROM federated.t1 WHERE id = 5; 
SELECT * FROM federated.t1 WHERE id = 5;
268 269

# ::delete_all_rows
unknown's avatar
unknown committed
270 271
DELETE FROM federated.t1;
SELECT * FROM federated.t1 WHERE id = 5;
272
connection slave;
unknown's avatar
unknown committed
273 274 275 276 277 278
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 ( 
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32),
    `other` varchar(20),
    PRIMARY KEY  (`id`) );
279 280

connection master;
unknown's avatar
unknown committed
281 282 283 284 285 286 287 288 289
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32), 
    `other` varchar(20),
    PRIMARY KEY  (`id`) )
  ENGINE="FEDERATED"
  DEFAULT CHARSET=latin1
290
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312

INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL);
INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333);
INSERT INTO federated.t1 (name, other) VALUES (NULL, NULL);
INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555);
INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666);
INSERT INTO federated.t1 (name) VALUES ('Seventh Name');
INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888);
INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999);
INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum');

SELECT * FROM federated.t1 WHERE other IS NULL;
SELECT * FROM federated.t1 WHERE name IS NULL;
SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL;
SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL;

UPDATE federated.t1
SET name = 'Fourth Name', other = 'four four four'
WHERE name IS NULL AND other IS NULL;

UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name';
313
UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%';
unknown's avatar
unknown committed
314 315 316
UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%';
SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ;
SELECT * FROM federated.t1;
317

318
# test multi-keys
319
connection slave;
unknown's avatar
unknown committed
320 321 322 323 324 325 326
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32) NOT NULL DEFAULT '',
    `other` varchar(20) NOT NULL DEFAULT '',
    PRIMARY KEY  (`id`),
    KEY nameoth (name, other) );
327 328

connection master;
unknown's avatar
unknown committed
329 330 331 332 333 334 335 336 337 338
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `name` varchar(32) NOT NULL DEFAULT '',
    `other` varchar(20) NOT NULL DEFAULT '',
    PRIMARY KEY  (`id`),
    KEY nameoth (name, other))
  ENGINE="FEDERATED" DEFAULT
  CHARSET=latin1
339
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
340 341 342 343 344 345 346 347

INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111');
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222');
INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333');
SELECT * FROM federated.t1 WHERE name = 'Second Name';
SELECT * FROM federated.t1 WHERE other = '2222';
SELECT * FROM federated.t1 WHERE name = 'Third Name';
SELECT * FROM federated.t1 WHERE name = 'Third Name' AND other = '3333';
348 349

connection slave;
unknown's avatar
unknown committed
350 351 352 353
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `id` int NOT NULL auto_increment,
    `name` char(32) NOT NULL DEFAULT '',
354
    `bincol` binary(1) NOT NULL,
unknown's avatar
unknown committed
355 356 357 358 359 360
    `floatval` decimal(5,2) NOT NULL DEFAULT 0.0,
    `other` int NOT NULL DEFAULT 0,
    PRIMARY KEY (id),
    KEY nameoth(name, other),
    KEY bincol(bincol),
    KEY floatval(floatval));
361 362 363

# test other types of indexes
connection master;
unknown's avatar
unknown committed
364 365 366 367 368
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int NOT NULL auto_increment,
    `name` char(32) NOT NULL DEFAULT '',
369
    `bincol` binary(1) NOT NULL,
unknown's avatar
unknown committed
370 371 372 373 374 375 376 377
    `floatval` decimal(5,2) NOT NULL DEFAULT 0.0,
    `other` int NOT NULL DEFAULT 0,
    PRIMARY KEY (id),
    KEY nameoth(name,other),
    KEY bincol(bincol),
    KEY floatval(floatval))
  ENGINE="FEDERATED"
  DEFAULT CHARSET=latin1
378
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395

INSERT INTO federated.t1 (name, bincol, floatval, other) 
  VALUES ('first', 0x65, 11.11, 1111);
INSERT INTO federated.t1 (name, bincol, floatval, other)
  VALUES ('second', 0x66, 22.22, 2222);
INSERT INTO federated.t1 (name, bincol, floatval, other)
  VALUES ('third', 'g', 22.22, 2222);
SELECT * FROM federated.t1;
SELECT * FROM federated.t1 WHERE name = 'second';
SELECT * FROM federated.t1 WHERE bincol= 'f';
SELECT * FROM federated.t1 WHERE bincol= 0x66;
SELECT * FROM federated.t1 WHERE bincol= 0x67;
SELECT * FROM federated.t1 WHERE bincol= 'g';
SELECT * FROM federated.t1 WHERE floatval=11.11;
SELECT * FROM federated.t1 WHERE name='third';
SELECT * FROM federated.t1 WHERE other=2222;
SELECT * FROM federated.t1 WHERE name='third' and other=2222;
396

397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
# more multi-column indexes, in the primary key
connection slave;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
  `id` int NOT NULL auto_increment,
  `col1` int(10) NOT NULL DEFAULT 0,
  `col2` varchar(64) NOT NULL DEFAULT '',
  `col3` int(20) NOT NULL,
  `col4` int(40) NOT NULL,
  primary key (`id`, `col1`, `col2`, `col3`, `col4`),
  key col1(col1),
  key col2(col2),
  key col3(col3),
  key col4(col4));

connection master;
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
  `id` int NOT NULL auto_increment,
  `col1` int(10) NOT NULL DEFAULT 0,
  `col2` varchar(64) NOT NULL DEFAULT '',
  `col3` int(20) NOT NULL,
  `col4` int(40) NOT NULL,
  primary key (`id`, `col1`, `col2`, `col3`, `col4`),
  key col1(col1),
  key col2(col2),
  key col3(col3),
  key col4(col4))
  ENGINE="FEDERATED"
427
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520

INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (1, 'one One', 11, 1111);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (2, 'Two two', 22, 2222);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (3, 'three Three', 33, 33333);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (4, 'fourfourfour', 444, 4444444);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (5, 'five 5 five five 5', 5, 55555);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (6, 'six six Sixsix', 6666, 6);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (7, 'seven Sevenseven', 77777, 7777);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (8, 'eight eight eight', 88888, 88);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (9, 'nine Nine', 999999, 999999);
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES (10, 'Tenth ten TEN', 1010101, 1010);

SELECT * FROM federated.t1 WHERE col2 = 'two two'; 
SELECT * FROM federated.t1 WHERE col2 = 'two Two'; 
SELECT * FROM federated.t1 WHERE id = 3; 
SELECT * FROM federated.t1 WHERE id = 3 AND col1 = 3; 
SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'Two two'; 
SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'fourfourfour'; 
SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' 
  AND col3 = 5; 
SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' 
  AND col3 = 5
  AND col4 = 55555;
SELECT * FROM federated.t1 WHERE id = 5 
  AND col2 = 'Two two' AND col3 = 22
  AND col4 = 33;
SELECT * FROM federated.t1 WHERE id = 5 
  AND col2 = 'five 5 five five 5' AND col3 = 5 
  AND col4 = 55555;
SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5')
  OR (col2 = 'three Three' AND col3 = 33);
SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two')
  OR (col2 = 444 AND col3 = 4444444);
SELECT * FROM federated.t1 WHERE id = 1 
  OR col1 = 10
  OR col2 = 'Two two' 
  OR col3 = 33
  OR col4 = 4444444;
SELECT * FROM federated.t1 WHERE id > 5; 
SELECT * FROM federated.t1 WHERE id >= 5; 
SELECT * FROM federated.t1 WHERE id < 5; 
SELECT * FROM federated.t1 WHERE id <= 5; 
SELECT * FROM federated.t1 WHERE id != 5; 
SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; 
SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; 
SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; 
SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; 
SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; 
SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; 
SELECT * FROM federated.t1 WHERE col2 = 'three Three'; 
SELECT * FROM federated.t1 WHERE col2 > 'one'; 
SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; 
SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; 
SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; 
SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; 
SELECT * FROM federated.t1 WHERE col2 <> 'one One'; 

# more multi-column indexes, in the primary key
connection slave;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
  `col1` varchar(8) NOT NULL DEFAULT '',
  `col2` varchar(128) NOT NULL DEFAULT '',
  `col3` varchar(20) NOT NULL DEFAULT '',
  `col4` varchar(40) NOT NULL DEFAULT '',
  primary key (`col1`, `col2`, `col3`, `col4`),
  key 3key(`col2`,`col3`,`col4`),
  key 2key (`col3`,`col4`),
  key col4(col4));

connection master;
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
  `col1` varchar(8) NOT NULL DEFAULT '',
  `col2` varchar(128) NOT NULL DEFAULT '',
  `col3` varchar(20) NOT NULL DEFAULT '',
  `col4` varchar(40) NOT NULL DEFAULT '',
  primary key (`col1`, `col2`, `col3`, `col4`),
  key 3key(`col2`,`col3`,`col4`),
  key 2key (`col3`,`col4`),
  key col4(col4))
  ENGINE="FEDERATED"
521
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572

INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('bbbb', 'bbbbbbbbbbbbbbbbbbb', 'bababababa', 'bcbcbcbcbcbcbcbc');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('cccc', 'ccccccccccccccccccc', 'cacacacaca', 'cbcbcbcbcbcbcbcb');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('dddd', 'ddddddddddddddddddd', 'dadadadada', 'dcdcdcdcdcdcdcdc');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('eeee', 'eeeeeeeeeeeeeeeeeee', 'eaeaeaeaea', 'ecececececececec');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('ffff', 'fffffffffffffffffff', 'fafafafafa', 'fcfcfcfcfcfcfcfc');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('gggg', 'ggggggggggggggggggg', 'gagagagaga', 'gcgcgcgcgcgcgcgc');
INSERT INTO federated.t1 (col1, col2, col3, col4) 
  VALUES ('hhhh', 'hhhhhhhhhhhhhhhhhhh', 'hahahahaha', 'hchchchchchchchc');

SELECT * FROM federated.t1 WHERE col1 = 'cccc'; 
SELECT * FROM federated.t1 WHERE col2 = 'eeeeeeeeeeeeeeeeeee'; 
SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; 
SELECT * FROM federated.t1 WHERE col1 =  'gggg' AND col2 = 'ggggggggggggggggggg'; 
SELECT * FROM federated.t1 WHERE col1 =  'gggg' AND col3 = 'gagagagaga'; 
SELECT * FROM federated.t1 WHERE col1 =  'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; 
SELECT * FROM federated.t1 WHERE col1 >  'bbbb';
SELECT * FROM federated.t1 WHERE col1 >=  'bbbb';
SELECT * FROM federated.t1 WHERE col1 <  'bbbb';
SELECT * FROM federated.t1 WHERE col1 <=  'bbbb';
SELECT * FROM federated.t1 WHERE col1 <>  'bbbb';
SELECT * FROM federated.t1 WHERE col1 LIKE  'b%';
SELECT * FROM federated.t1 WHERE col4 LIKE  '%b%';
SELECT * FROM federated.t1 WHERE col1 NOT LIKE  'c%';
SELECT * FROM federated.t1 WHERE col4 NOT LIKE  '%c%';
connection slave;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
  `col1` varchar(8) NOT NULL DEFAULT '',
  `col2` int(8) NOT NULL DEFAULT 0,
  `col3` varchar(8) NOT NULL DEFAULT '',
  primary key (`col1`, `col2`, `col3`));

connection master;
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
  `col1` varchar(8) NOT NULL DEFAULT '',
  `col2` varchar(8) NOT NULL DEFAULT '',
  `col3` varchar(8) NOT NULL DEFAULT '',
  primary key (`col1`, `col2`, `col3`))
  ENGINE="FEDERATED"
  DEFAULT CHARSET=latin1
573
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591

INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0');
INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc');
INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy');
INSERT INTO federated.t1 VALUES ('ccc', '111', 'zzz');
INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz');

# let's see what the foreign database says 
connection slave;
SELECT col3 FROM federated.t1 WHERE  (
(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND 
(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); 

connection master;
SELECT col3 FROM federated.t1 WHERE  (
(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND 
(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); 

592
# test NULLs
593
connection slave;
unknown's avatar
unknown committed
594 595 596 597 598 599 600
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `id` int,
    `name` varchar(32),
    `floatval` float,
    `other` int)
DEFAULT CHARSET=latin1;
601 602

connection master;
unknown's avatar
unknown committed
603 604 605 606 607 608 609 610 611
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int,
    `name` varchar(32),
    `floatval` float,
    `other` int)
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
612
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
613

614
# these both should be the same
unknown's avatar
unknown committed
615 616 617 618 619 620 621 622 623 624 625 626 627
INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL);
INSERT INTO federated.t1 values ();
INSERT INTO federated.t1 (id) VALUES (1);
INSERT INTO federated.t1 (name, floatval, other)
  VALUES ('foo', 33.33333332, NULL);
INSERT INTO federated.t1 (name, floatval, other)
  VALUES (0, 00.3333, NULL);
SELECT * FROM federated.t1;
SELECT count(*) FROM federated.t1 
WHERE id IS NULL 
AND name IS NULL 
AND floatval IS NULL
AND other IS NULL;
628 629

connection slave;
unknown's avatar
unknown committed
630 631 632 633 634 635
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `blurb_id` int NOT NULL DEFAULT 0,
    `blurb` text default '',
    PRIMARY KEY (blurb_id))
  DEFAULT CHARSET=latin1; 
636 637

connection master;
unknown's avatar
unknown committed
638 639 640 641 642 643 644 645
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `blurb_id` int NOT NULL DEFAULT 0,
    `blurb` text default '',
    PRIMARY KEY (blurb_id))
  ENGINE="FEDERATED"
  DEFAULT CHARSET=latin1
646
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; 
647 648 649 650 651

INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types.  This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements.  The overview is intentionally brief.  The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
INSERT INTO federated.t1 VALUES (3, " A floating-point number.  p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following.  FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined.  ");
INSERT INTO federated.t1 VALUES(4, "Die bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung.  Zumindest fr jemanden, der seine Zielsprache ernst nimmt:");
unknown's avatar
unknown committed
652
SELECT * FROM federated.t1;
653 654

connection slave;
unknown's avatar
unknown committed
655 656 657 658 659 660
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `a` int NOT NULL,
    `b` int NOT NULL,
    `c` int NOT NULL,
    PRIMARY KEY (a),key(b));
661 662

connection master;
unknown's avatar
unknown committed
663 664 665 666 667 668 669 670 671 672
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `a` int NOT NULL,
    `b` int NOT NULL,
    `c` int NOT NULL,
    PRIMARY KEY (a),
    KEY (b))
  ENGINE="FEDERATED"
  DEFAULT CHARSET=latin1
673
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
674 675

INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4);
676 677

connection slave;
unknown's avatar
unknown committed
678 679
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
unknown's avatar
unknown committed
803
int, i999 int, i1000 int, b varchar(256)) row_format=dynamic;
804 805

connection master;
unknown's avatar
unknown committed
806 807 808 809 810 811
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 
(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, 
i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
unknown's avatar
unknown committed
933
int, i999 int, i1000 int, b varchar(256))
unknown's avatar
unknown committed
934 935 936
row_format=dynamic
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
937
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
938 939 940

INSERT INTO federated.t1
values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "PatrickG");
unknown's avatar
unknown committed
979 980 981 982 983 984 985 986 987
UPDATE federated.t1 SET b=repeat('a',256);
UPDATE federated.t1 SET i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0, i10=0;
SELECT * FROM federated.t1 WHERE i9=0 and i10=0;
UPDATE federated.t1 SET i50=20;
SELECT * FROM federated.t1;
DELETE FROM federated.t1 WHERE i51=20;
SELECT * FROM federated.t1;
DELETE FROM federated.t1 WHERE i50=20;
SELECT * FROM federated.t1;
988 989

connection slave;
unknown's avatar
unknown committed
990 991
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', PRIMARY KEY(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1;
992 993

connection master;
unknown's avatar
unknown committed
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    id int NOT NULL auto_increment,
    code char(20) NOT NULL,
    fileguts blob NOT NULL,
    creation_date datetime,
    entered_time datetime default '2004-04-04 04:04:04',
    PRIMARY KEY(id),
    index(code),
    index(fileguts(10)))
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1006
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; 
unknown's avatar
unknown committed
1007 1008 1009 1010
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03');
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04');
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04');
SELECT * FROM federated.t1;
1011
# test blob indexes
unknown's avatar
unknown committed
1012
SELECT * FROM federated.t1 WHERE fileguts = 'jimbob';
unknown's avatar
unknown committed
1013 1014 1015

# test blob with binary
connection slave;
unknown's avatar
unknown committed
1016 1017
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (`a` BLOB);
unknown's avatar
unknown committed
1018 1019

connection master;
unknown's avatar
unknown committed
1020 1021 1022 1023 1024
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
  `a` BLOB)
ENGINE="FEDERATED"
1025
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
1026

unknown's avatar
unknown committed
1027 1028 1029 1030 1031
INSERT INTO federated.t1 VALUES (0x00);
INSERT INTO federated.t1 VALUES (0x0001);
INSERT INTO federated.t1 VALUES (0x0100);
SELECT HEX(a) FROM federated.t1;

1032 1033 1034 1035 1036
# # simple tests for cyrillic, given to me by 
# DROP TABLE IF EXISTS federated.t1;
# --replace_result $SLAVE_MYPORT SLAVE_PORT
# eval CREATE TABLE federated.t1
#  (a char(20)) charset=cp1251
1037
#  ENGINE="FEDERATED" CONNECTION="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1";
1038 1039
# # 
#  connection slave;
unknown's avatar
unknown committed
1040 1041
# DROP TABLE IF EXISTS federated.t1;
# CREATE TABLE federated.t1 (a char(20)) charset=cp1251;
1042 1043
# # 
#  connection master;
unknown's avatar
unknown committed
1044 1045
# INSERT INTO federated.t1 values (_cp1251'--1');
# INSERT INTO federated.t1 values (_cp1251'--2');
1046
# SELECT * FROM federated.t1;
unknown's avatar
unknown committed
1047 1048 1049 1050
# SET names cp1251;
# INSERT INTO federated.t1 values ('--3');
# INSERT INTO federated.t1 values ('-Ũ-4');
# SELECT * FROM federated.t1;
1051 1052 1053
# SELECT hex(a) from federated.t1;
# SELECT hex(a) from federated.t1 ORDER BY a desc;
# UPDATE federated.t1 SET a='--1' WHERE a='--1';
unknown's avatar
unknown committed
1054 1055 1056 1057 1058 1059
# SELECT * FROM federated.t1;
# DELETE FROM federated.t1 WHERE a='-Ũ-4';
# SELECT * FROM federated.t1;
# DELETE FROM federated.t1 WHERE a>'-';
# SELECT * FROM federated.t1;
# SET names default;
1060 1061
# DROP TABLE IF EXISTS federated.t1;

1062
# 
unknown's avatar
unknown committed
1063
# DROP TABLE IF EXISTS federated.t1;
1064 1065
# 

1066
# test joins with non-federated table
1067
connection slave;
unknown's avatar
unknown committed
1068 1069 1070 1071 1072 1073 1074 1075
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `country_id` int(20) NOT NULL DEFAULT 0,
    `name` varchar(32),
    `other` varchar(20),
    PRIMARY KEY  (`id`),
    key (country_id));
1076 1077

connection master;
unknown's avatar
unknown committed
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
DROP TABLE IF EXISTS federated.countries;
CREATE TABLE federated.countries (
    `id` int(20) NOT NULL auto_increment,
    `country` varchar(32),
    PRIMARY KEY (id));
INSERT INTO federated.countries (country) VALUES ('India');
INSERT INTO federated.countries (country) VALUES ('Germany');
INSERT INTO federated.countries (country) VALUES ('Italy');
INSERT INTO federated.countries (country) VALUES ('Finland');
INSERT INTO federated.countries (country) VALUES ('Ukraine');

DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    `country_id` int(20) NOT NULL DEFAULT 0,
    `name` varchar(32),
    `other` varchar(20),
    PRIMARY KEY  (`id`),
    KEY (country_id) )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1099
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
unknown's avatar
unknown committed
1100 1101 1102 1103 1104 1105 1106

INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);

1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124
#inner join
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country 
FROM federated.t1, federated.countries WHERE
federated.t1.country_id = federated.countries.id;

SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1 INNER JOIN federated.countries ON
federated.t1.country_id = federated.countries.id;

SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
federated.t1.other AS other, federated.countries.country AS country
FROM federated.t1 INNER JOIN federated.countries ON
federated.t1.country_id = federated.countries.id
WHERE federated.t1.name = 'Monty';

#left join
unknown's avatar
unknown committed
1125
SELECT federated.t1.*, federated.countries.country 
1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139
FROM federated.t1 LEFT JOIN federated.countries 
ON federated.t1.country_id = federated.countries.id
ORDER BY federated.countries.id;

SELECT federated.t1.*, federated.countries.country 
FROM federated.t1 LEFT JOIN federated.countries 
ON federated.t1.country_id = federated.countries.id
ORDER BY federated.countries.country;

#right join
SELECT federated.t1.*, federated.countries.country 
FROM federated.t1 RIGHT JOIN federated.countries 
ON federated.t1.country_id = federated.countries.id 
ORDER BY federated.t1.country_id;
unknown's avatar
unknown committed
1140 1141

DROP TABLE federated.countries;
1142

1143
#BEGIN optimize and repair tests
1144 1145 1146 1147 1148
OPTIMIZE TABLE federated.t1;
REPAIR TABLE federated.t1;
REPAIR TABLE federated.t1 QUICK;
REPAIR TABLE federated.t1 EXTENDED;
REPAIR TABLE federated.t1 USE_FRM;
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190
#END optimize and repair tests


# BEGIN ALTER TEST
connection slave;
--disable_warnings
DROP TABLE IF EXISTS federated.normal_table;
--enable_warnings

CREATE TABLE federated.normal_table (
  `id` int(4) NOT NULL,
  `name` varchar(10) default NULL
  ) DEFAULT CHARSET=latin1;

connection master;
--disable_warnings
DROP TABLE IF EXISTS federated.alter_me;
--enable_warnings

--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.alter_me (
  `id` int(4) NOT NULL,
  `name` varchar(10) default NULL,
  PRIMARY KEY (`id`)
  ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/normal_table';

INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty');
INSERT INTO federated.alter_me (id, name) VALUES (2, 'David');

SELECT * FROM federated.alter_me;

--error 1031
ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;

SELECT * FROM federated.alter_me;

DROP TABLE federated.alter_me;
connection slave;
DROP TABLE federated.normal_table;
# END ALTER TEST

unknown's avatar
unknown committed
1191
#
unknown's avatar
unknown committed
1192 1193
# Test BUG #14532 - bit columns broken in federated
# storage engine
unknown's avatar
unknown committed
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
#
--disable_warnings
DROP TABLE IF EXISTS federated.t1;
--enable_warnings
CREATE TABLE federated.t1 (
  `bitty` bit(3)
) DEFAULT CHARSET=latin1;

connection master;

--disable_warnings
DROP TABLE IF EXISTS federated.t1;
--enable_warnings

--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
 `bitty` bit(3)
) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';

INSERT INTO federated.t1 VALUES (b'001');
INSERT INTO federated.t1 VALUES (b'010');
INSERT INTO federated.t1 VALUES (b'011');
INSERT INTO federated.t1 VALUES (b'100');
INSERT INTO federated.t1 VALUES (b'101');
INSERT INTO federated.t1 VALUES (b'110');
INSERT INTO federated.t1 VALUES (b'111');
select * FROM federated.t1;
drop table federated.t1;

connection slave;
drop table federated.t1;
1226

unknown's avatar
unknown committed
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237
#
# BUG# 14768 test auto_increment last_insert_id()
#
connection slave;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    PRIMARY KEY  (`id`));

connection master;
DROP TABLE IF EXISTS federated.t1;
1238
--replace_result $SLAVE_MYPORT SLAVE_PORT
unknown's avatar
unknown committed
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
eval CREATE TABLE federated.t1 (
    `id` int(20) NOT NULL auto_increment,
    PRIMARY KEY  (`id`)
    )
  ENGINE="FEDERATED" DEFAULT CHARSET=latin1
  CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';

INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
SELECT * FROM federated.t1;
unknown's avatar
unknown committed
1257 1258 1259 1260
DROP TABLE federated.t1;

connection slave;
DROP TABLE federated.t1;
unknown's avatar
unknown committed
1261

1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315
#
# Bug#17377 Federated Engine returns wrong Data, always the rows
#           with the highest ID
#

connection slave;

--disable_warnings
DROP TABLE IF EXISTS federated.bug_17377_table;
--enable_warnings

CREATE TABLE federated.bug_17377_table (
`fld_cid` bigint(20) NOT NULL auto_increment,
`fld_name` varchar(255) NOT NULL default '',
`fld_parentid` bigint(20) NOT NULL default '0',
`fld_delt` int(1) NOT NULL default '0',
PRIMARY KEY (`fld_cid`),
KEY `fld_parentid` (`fld_parentid`),
KEY `fld_delt` (`fld_delt`),
KEY `fld_cid` (`fld_cid`)
) ENGINE=MyISAM;

# Insert some test-data
insert into federated.bug_17377_table( fld_name )
values
("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel");

connection master;
--disable_warnings
DROP TABLE IF EXISTS federated.t1;
--enable_warnings

--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
`fld_cid` bigint(20) NOT NULL auto_increment,
`fld_name` varchar(255) NOT NULL default '',
`fld_parentid` bigint(20) NOT NULL default '0',
`fld_delt` int(1) NOT NULL default '0',
PRIMARY KEY (`fld_cid`),
KEY `fld_parentid` (`fld_parentid`),
KEY `fld_delt` (`fld_delt`),
KEY `fld_cid` (`fld_cid`)
) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_17377_table';

select * from federated.t1 where fld_parentid=0 and fld_delt=0
order by fld_name;

select * from federated.t1 where fld_parentid=0 and fld_delt=0;

DROP TABLE federated.t1;
connection slave;
DROP TABLE federated.bug_17377_table;

unknown's avatar
unknown committed
1316 1317 1318 1319 1320 1321 1322 1323 1324
#
# BUG 19773 Crash when using multi-table updates, deletes
# with federated tables
#
connection slave;
create table federated.t1 (i1 int, i2 int, i3 int);
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));

connection master;
unknown's avatar
unknown committed
1325
--replace_result $SLAVE_MYPORT SLAVE_PORT
unknown's avatar
unknown committed
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347
eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
select * from federated.t2;
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
delete   federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
drop table federated.t1, federated.t2;
connection slave;
drop table federated.t1, federated.t2;

# Test multi updates and deletes with keys
connection slave;
create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));

connection master;
unknown's avatar
unknown committed
1348
--replace_result $SLAVE_MYPORT SLAVE_PORT
unknown's avatar
unknown committed
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364
eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
select * from federated.t2 order by id;
drop table federated.t1, federated.t2;

connection slave;
drop table federated.t1, federated.t2;
1365

1366
source include/federated_cleanup.inc;