~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/archive.test

  • Committer: Stewart Smith
  • Date: 2008-11-21 16:06:07 UTC
  • mto: This revision was merged to the branch mainline in revision 593.
  • Revision ID: stewart@flamingspork.com-20081121160607-n6gdlt013spuo54r
remove mysql_frm_type
and fix engines to return correct value from delete_table when table doesn't exist.
(it should be ENOENT).

Also fix up some tests that manipulated frm files by hand. These tests are no longer valid and will need to be rewritten in the not too distant future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# Simple test for archive example
3
3
# Taken FROM the select test
4
4
#
 
5
-- source include/have_archive.inc
 
6
-- source include/have_binlog_format_mixed_or_statement.inc
5
7
 
6
8
--disable_warnings
7
9
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
41
43
#
42
44
 
43
45
--disable_query_log
44
 
begin;
45
46
INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
46
47
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
47
48
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
1241
1242
INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
1242
1243
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
1243
1244
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
1244
 
commit;
1245
1245
--enable_query_log
1246
1246
 
1247
1247
#
1317
1317
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
1318
1318
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
1319
1319
SELECT * FROM t2;
1320
 
ALTER TABLE t2 ENGINE=ARCHIVE;
 
1320
OPTIMIZE TABLE t2;
1321
1321
SELECT * FROM t2;
1322
1322
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
1323
1323
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
1324
1324
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
1325
 
ALTER TABLE t2 ENGINE=ARCHIVE;
 
1325
OPTIMIZE TABLE t2;
 
1326
SELECT * FROM t2;
 
1327
REPAIR TABLE t2;
1326
1328
SELECT * FROM t2;
1327
1329
 
1328
1330
#
1333
1335
#
1334
1336
# For bug #12836
1335
1337
# Delete was allowing all rows to be removed
1336
 
--error ER_ILLEGAL_HA
 
1338
--error 1031
1337
1339
DELETE FROM t2;
1338
1340
SELECT * FROM t2;
1339
1341
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
1340
1342
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
1341
1343
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
1342
1344
SELECT * FROM t2;
1343
 
--error ER_ILLEGAL_HA
 
1345
--error 1031
1344
1346
TRUNCATE TABLE t2;
1345
1347
SELECT * FROM t2;
1346
1348
 
1349
1351
SELECT * FROM t2;
1350
1352
 
1351
1353
 
 
1354
# Test INSERT DELAYED and wait until the table has one more record
 
1355
SELECT COUNT(auto) FROM t2;
 
1356
INSERT DELAYED INTO t2 VALUES (99999,011403,37,'the','delayed','insert','');
 
1357
 
 
1358
# Insert another record since in Archive delayed values are only
 
1359
# guaranteed to materialize based on either:
 
1360
# 1) A new row showing up from a normal insert
 
1361
# 2) A flush table  has occurred.
 
1362
INSERT INTO t2 VALUES (100000,000001,00,'after','delayed','insert','');
 
1363
 
 
1364
# Wait for the delayed insert to appear
 
1365
while (`SELECT COUNT(auto)!=1215 FROM t2`)
 
1366
{
 
1367
  sleep 0.1;
 
1368
}
 
1369
SELECT COUNT(auto) FROM t2;
 
1370
 
1352
1371
# Adding test for ALTER TABLE
1353
1372
ALTER TABLE t2 DROP COLUMN fld6; 
1354
1373
SHOW CREATE TABLE t2;
1362
1381
`a` int NOT NULL auto_increment,
1363
1382
b char(12),
1364
1383
PRIMARY KEY  (`a`)
1365
 
);
 
1384
)  DEFAULT CHARSET=latin1;
1366
1385
 
1367
1386
INSERT INTO t5 VALUES (NULL, "foo");
1368
1387
INSERT INTO t5 VALUES (NULL, "foo");
1370
1389
INSERT INTO t5 VALUES (NULL, "foo");
1371
1390
INSERT INTO t5 VALUES (NULL, "foo");
1372
1391
INSERT INTO t5 VALUES (32, "foo");
1373
 
--error ER_DUP_KEY
 
1392
--error 1022
1374
1393
INSERT INTO t5 VALUES (23, "foo");
1375
1394
INSERT INTO t5 VALUES (NULL, "foo");
1376
1395
INSERT INTO t5 VALUES (NULL, "foo");
1377
 
--error ER_DUP_KEY
 
1396
--error 1022
1378
1397
INSERT INTO t5 VALUES (3, "foo");
1379
1398
INSERT INTO t5 VALUES (NULL, "foo");
1380
1399
SELECT * FROM t5;
1387
1406
`a` int NOT NULL auto_increment,
1388
1407
b char(12),
1389
1408
KEY  (`a`)
1390
 
) AUTO_INCREMENT=5;
 
1409
)  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;
1391
1410
 
1392
1411
INSERT INTO t5 VALUES (NULL, "foo");
1393
1412
INSERT INTO t5 VALUES (NULL, "foo");
1401
1420
INSERT INTO t5 VALUES (3, "foo");
1402
1421
INSERT INTO t5 VALUES (NULL, "foo");
1403
1422
SELECT * FROM t5;
1404
 
ALTER TABLE t5 ENGINE=ARCHIVE;
 
1423
OPTIMIZE TABLE t5;
1405
1424
SELECT * FROM t5;
1406
1425
 
1407
1426
SELECT * FROM t5 WHERE a=32;
1411
1430
 
1412
1431
CREATE TABLE `t5` (
1413
1432
`a` int NOT NULL auto_increment,
1414
 
b blob,
 
1433
b blob(12),
1415
1434
KEY  (`a`)
1416
 
);
 
1435
)  DEFAULT CHARSET=latin1;
1417
1436
 
1418
1437
INSERT INTO t5 VALUES (NULL, "foo");
1419
1438
INSERT INTO t5 VALUES (NULL, "We the people");
1438
1457
 
1439
1458
CREATE TABLE `t5` (
1440
1459
`a` int NOT NULL auto_increment,
1441
 
b blob,
1442
 
c blob,
 
1460
b blob(12),
 
1461
c blob(12),
1443
1462
KEY  (`a`)
1444
 
);
 
1463
)  DEFAULT CHARSET=latin1;
1445
1464
 
1446
1465
INSERT INTO t5 VALUES (NULL, "foo", "grok this!");
1447
1466
INSERT INTO t5 VALUES (NULL, "We the people", NULL);
1486
1505
b varchar(250),
1487
1506
c varchar(800),
1488
1507
KEY  (`a`)
1489
 
);
 
1508
)  DEFAULT CHARSET=latin1;
1490
1509
 
1491
1510
INSERT INTO t5 VALUES (NULL, "foo", "grok this!");
1492
1511
INSERT INTO t5 VALUES (NULL, "We the people", NULL);
1495
1514
INSERT INTO t5 VALUES (32, "ensure domestic tranquility", NULL);
1496
1515
INSERT INTO t5 VALUES (23, "provide for the common defense", "posterity");
1497
1516
INSERT INTO t5 VALUES (NULL, "promote the general welfare", "do ordain");
1498
 
INSERT INTO t5 VALUES (NULL, "abcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyz", "do ordain");
 
1517
INSERT INTO t5 VALUES (NULL, "abcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabcdeghijklmnopqrstuvwxyzabc", "do ordain");
1499
1518
 
1500
1519
SELECT * FROM t5;
1501
1520
 
1502
1521
CREATE TABLE `t6` (
1503
1522
`a` int NOT NULL auto_increment,
1504
 
b blob,
 
1523
b blob(12),
1505
1524
c int,
1506
1525
KEY  (`a`)
1507
 
);
 
1526
)  DEFAULT CHARSET=latin1;
1508
1527
SELECT * FROM t6;
1509
1528
INSERT INTO t6 VALUES (NULL, "foo", NULL);
1510
1529
INSERT INTO t6 VALUES (NULL, "We the people", 5);
1533
1552
--enable_warnings
1534
1553
 
1535
1554
#
 
1555
# BUG#26138 - REPAIR TABLE with option USE_FRM erases all records in ARCHIVE
 
1556
#             table
 
1557
#
 
1558
create table t1 (i int) engine=archive;
 
1559
insert into t1 values (1);
 
1560
repair table t1 use_frm;
 
1561
select * from t1;
 
1562
drop table t1;
 
1563
 
 
1564
#
1536
1565
# BUG#29207 - archive table reported as corrupt by check table
1537
1566
#
1538
 
create table t1(a blob) engine=archive;
 
1567
create table t1(a longblob) engine=archive;
1539
1568
insert into t1 set a='';
1540
1569
insert into t1 set a='a';
1541
 
check table t1;
 
1570
check table t1 extended;
1542
1571
drop table t1;
1543
1572
 
1544
1573
#
1549
1578
 
1550
1579
let $bug31036=41;
1551
1580
--disable_query_log
1552
 
begin;
1553
1581
while($bug31036)
1554
1582
{
1555
1583
  INSERT INTO t1(a) VALUES (REPEAT('a', 510));
1556
1584
  dec $bug31036;
1557
1585
}
1558
 
commit;
1559
1586
--enable_query_log
1560
1587
INSERT INTO t1(a) VALUES ('');
1561
1588
 
1573
1600
INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
1574
1601
FLUSH TABLE t1;
1575
1602
SELECT * FROM t1 ORDER BY a;
1576
 
DROP TABLE t1;