You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# create a database with many hundred tables such that the schema
1466
+
# will overflow the first several pages of the database. verify the schema
1467
+
# is intact on open.
1468
+
do_test multipage-schema {
1469
+
sqlite_orig db test.db
1470
+
execsql {
1471
+
PRAGMA key = 'testkey';
1472
+
BEGIN EXCLUSIVE;
1473
+
} db
1474
+
1475
+
for {set i 1} {$i<=300} {incr i} {
1476
+
execsql "CREATE TABLE tab$i (a TEXT, b TEXT, c TEXT, d TEXT, e TEXT, f TEXT, g TEXT, h TEXT, i TEXT, j TEXT, k, TEXT, l, m TEXT, n TEXT, o TEXT, p TEXT);" db
1477
+
}
1478
+
1479
+
execsql {
1480
+
COMMIT;
1481
+
} db
1482
+
1483
+
db close
1484
+
sqlite_orig db test.db
1464
1485
1486
+
execsql {
1487
+
PRAGMA key = 'testkey';
1488
+
SELECT count(*) FROM sqlite_master where type = 'table';
1489
+
} db
1490
+
1491
+
} {300}
1492
+
db close
1493
+
file delete -force test.db
1494
+
1495
+
# create a database with many hundred tables such that the schema
1496
+
# will overflow the first several pages of the database. this time, enable
1497
+
# autovacuum on the database, which will cause sqlite to do some "short reads"
1498
+
# after the end of the main database file. verify that there are no HMAC errors
1499
+
# resulting from the short reads, and that the schema is intact when
1500
+
# the database is reopened
1501
+
do_test multipage-schema-autovacuum-shortread {
1502
+
sqlite_orig db test.db
1503
+
execsql {
1504
+
PRAGMA key = 'testkey';
1505
+
PRAGMA auto_vacuum = FULL;
1506
+
BEGIN EXCLUSIVE;
1507
+
} db
1508
+
1509
+
for {set i 1} {$i<=300} {incr i} {
1510
+
execsql "CREATE TABLE tab$i (a TEXT, b TEXT, c TEXT, d TEXT, e TEXT, f TEXT, g TEXT, h TEXT, i TEXT, j TEXT, k, TEXT, l, m TEXT, n TEXT, o TEXT, p TEXT);" db
1511
+
}
1512
+
1513
+
execsql {
1514
+
COMMIT;
1515
+
} db
1516
+
1517
+
db close
1518
+
sqlite_orig db test.db
1519
+
1520
+
execsql {
1521
+
PRAGMA key = 'testkey';
1522
+
SELECT count(*) FROM sqlite_master where type = 'table';
1523
+
} db
1524
+
1525
+
} {300}
1526
+
db close
1527
+
file delete -force test.db
1528
+
1529
+
# same as multi-page-schema-autovacuum-shortread, except
execsql "CREATE TABLE tab$i (a TEXT, b TEXT, c TEXT, d TEXT, e TEXT, f TEXT, g TEXT, h TEXT, i TEXT, j TEXT, k, TEXT, l, m TEXT, n TEXT, o TEXT, p TEXT);" db
1542
+
}
1543
+
1544
+
execsql {
1545
+
COMMIT;
1546
+
} db
1547
+
1548
+
db close
1549
+
sqlite_orig db test.db
1550
+
1551
+
execsql {
1552
+
PRAGMA key = 'testkey';
1553
+
SELECT count(*) FROM sqlite_master where type = 'table';
0 commit comments