@@ -310,8 +310,9 @@ do_test rekey-delete-and-query-2 {
310310 PRAGMA key = 'test123';
311311 PRAGMA rekey = 'test321';
312312 SELECT count(*) > 1 FROM t1;
313+ PRAGMA integrity_check;
313314 }
314- } {1}
315+ } {1 ok }
315316db close
316317
317318do_test rekey-delete-and-query-3 {
@@ -364,8 +365,9 @@ do_test rekey-delete-and-query-wal-2 {
364365 PRAGMA journal_mode = WAL;
365366 PRAGMA rekey = 'test321';
366367 SELECT count(*) > 1 FROM t1;
368+ PRAGMA integrity_check;
367369 }
368- } {wal 1}
370+ } {wal 1 ok }
369371db close
370372
371373do_test rekey-delete-and-query-wal-3 {
@@ -1395,4 +1397,70 @@ do_test verify-pragma-cipher-version {
13951397db close
13961398file delete -force test.db
13971399
1400+ # create a new database, insert some data
1401+ # and delete some data with
1402+ # auto_vacuum on
1403+ do_test auto-vacuum-full {
1404+ sqlite_orig db test.db
1405+
1406+ execsql {
1407+ PRAGMA key = 'test123';
1408+ PRAGMA auto_vacuum = FULL;
1409+ CREATE TABLE t1(a,b);
1410+ BEGIN;
1411+ }
1412+
1413+ for {set i 1} {$i<10000} {incr i} {
1414+ set r [expr {int(rand()*32767)}]
1415+ set r1 [expr {int(rand()*32767)}]
1416+ execsql "INSERT INTO t1 VALUES($r,$r1);"
1417+ }
1418+ set r [expr {int(rand()*32767)}]
1419+ execsql "DELETE FROM t1 WHERE a < $r;"
1420+
1421+ execsql {
1422+ COMMIT;
1423+ PRAGMA integrity_check;
1424+ PRAGMA freelist_count;
1425+ SELECT (count(*) > 0) FROM t1;
1426+ }
1427+ } {ok 0 1}
1428+ db close
1429+ file delete -force test.db
1430+
1431+ # create a new database, insert some data
1432+ # and delete some data with
1433+ # auto_vacuum incremental
1434+ do_test auto-vacuum-incremental {
1435+ sqlite_orig db test.db
1436+
1437+ execsql {
1438+ PRAGMA key = 'test123';
1439+ PRAGMA auto_vacuum = INCREMENTAL;
1440+ CREATE TABLE t1(a,b);
1441+ BEGIN;
1442+ }
1443+
1444+ for {set i 1} {$i<10000} {incr i} {
1445+ set r [expr {int(rand()*32767)}]
1446+ set r1 [expr {int(rand()*32767)}]
1447+ execsql "INSERT INTO t1 VALUES($r,$r1);"
1448+ }
1449+ set r [expr {int(rand()*32767)}]
1450+ execsql "DELETE FROM t1 WHERE a < $r;"
1451+
1452+ execsql {
1453+ COMMIT;
1454+ PRAGMA incremental_vacuum;
1455+ PRAGMA freelist_count;
1456+ PRAGMA integrity_check;
1457+ SELECT (count(*) > 0) FROM t1;
1458+ }
1459+ } {0 ok 1}
1460+ db close
1461+ file delete -force test.db
1462+
1463+
1464+
1465+
13981466finish_test
0 commit comments