3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the sqlite3_backup_XXX API.
14 # $Id: backup.test,v 1.11 2009/06/05 17:09:12 drh Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
21 #---------------------------------------------------------------------
24 # backup-1.*: Warm-body tests.
26 # backup-2.*: Test backup under various conditions. To and from in-memory
27 # databases. To and from empty/populated databases. etc.
29 # backup-3.*: Verify that the locking-page (pending byte page) is handled.
31 # backup-4.*: Test various error conditions.
33 # backup-5.*: Test the source database being modified during a backup.
35 # backup-6.*: Test the backup_remaining() and backup_pagecount() APIs.
37 # backup-7.*: Test SQLITE_BUSY and SQLITE_LOCKED errors.
39 # backup-8.*: Test multiple simultaneous backup operations.
41 # backup-9.*: Test that passing a negative argument to backup_step() is
42 # interpreted as "copy the whole file".
44 # backup-10.*: Test writing the source database mid backup.
47 proc data_checksum {db file} { $db one "SELECT md5sum(a, b) FROM ${file}.t1" }
48 proc test_contents {name db1 file1 db2 file2} {
49 $db2 eval {select * from sqlite_master}
50 $db1 eval {select * from sqlite_master}
51 set checksum [data_checksum $db2 $file2]
52 uplevel [list do_test $name [list data_checksum $db1 $file1] $checksum]
58 CREATE TABLE t1(a, b);
59 CREATE INDEX i1 ON t1(a, b);
60 INSERT INTO t1 VALUES(1, randstr(1000,1000));
61 INSERT INTO t1 VALUES(2, randstr(1000,1000));
62 INSERT INTO t1 VALUES(3, randstr(1000,1000));
63 INSERT INTO t1 VALUES(4, randstr(1000,1000));
64 INSERT INTO t1 VALUES(5, randstr(1000,1000));
69 # Sanity check to verify that the [test_contents] proc works.
71 test_contents backup-1.2 db main db main
73 # Check that it is possible to create and finish backup operations.
75 do_test backup-1.3.1 {
78 sqlite3_backup B db2 main db main
80 do_test backup-1.3.2 {
83 do_test backup-1.3.3 {
87 # Simplest backup operation. Backup test.db to test2.db. test2.db is
88 # initially empty. test.db uses the default page size.
90 do_test backup-1.4.1 {
91 sqlite3_backup B db2 main db main
93 do_test backup-1.4.2 {
96 do_test backup-1.4.3 {
99 do_test backup-1.4.4 {
102 test_contents backup-1.4.5 db2 main db main
106 # End of backup-1.* tests.
107 #---------------------------------------------------------------------
110 #---------------------------------------------------------------------
111 # The following tests, backup-2.*, are based on the following procedure:
113 # 1) Populate the source database.
114 # 2) Populate the destination database.
115 # 3) Run the backup to completion. (backup-2.*.1)
116 # 4) Integrity check the destination db. (backup-2.*.2)
117 # 5) Check that the contents of the destination db is the same as that
118 # of the source db. (backup-2.*.3)
120 # The test is run with all possible combinations of the following
121 # input parameters, except that if the destination is an in-memory
122 # database, the only page size tested is 1024 bytes (the same as the
125 # * Source database is an in-memory database, OR
126 # * Source database is a file-backed database.
128 # * Target database is an in-memory database, OR
129 # * Target database is a file-backed database.
131 # * Destination database is a main file, OR
132 # * Destination database is an attached file, OR
133 # * Destination database is a temp database.
135 # * Target database is empty (zero bytes), OR
136 # * Target database is larger than the source, OR
137 # * Target database is smaller than the source.
139 # * Target database page-size is the same as the source, OR
140 # * Target database page-size is larger than the source, OR
141 # * Target database page-size is smaller than the source.
143 # * Each call to step copies a single page, OR
144 # * A single call to step copies the entire source database.
147 foreach zSrcFile {test.db :memory:} {
148 foreach zDestFile {test2.db :memory:} {
149 foreach zOpenScript [list {
151 sqlite3 db2 $zSrcFile
152 db2 eval "ATTACH '$zDestFile' AS bak"
157 sqlite3 db2 $zDestFile
162 sqlite3 db2 $zDestFile
166 foreach rows_dest {0 3 10} {
167 foreach pgsz_dest {512 1024 2048} {
168 foreach nPagePerStep {1 200} {
170 # Open the databases.
171 catch { file delete test.db }
172 catch { file delete test2.db }
175 # Set to true if copying to an in-memory destination. Copying to an
176 # in-memory destination is only possible if the initial destination
177 # page size is the same as the source page size (in this case 1024 bytes).
179 set isMemDest [expr {
180 $zDestFile eq ":memory:" || $file_dest eq "temp" && $TEMP_STORE>=2
183 if { $isMemDest==0 || $pgsz_dest == 1024 } {
185 puts -nonewline "Test $iTest: src=$zSrcFile dest=$zDestFile"
186 puts -nonewline " (as $db_dest.$file_dest)"
187 puts -nonewline " rows_dest=$rows_dest pgsz_dest=$pgsz_dest"
191 # Set up the content of the source database.
193 PRAGMA page_size = 1024;
195 CREATE TABLE t1(a, b);
196 CREATE INDEX i1 ON t1(a, b);
197 INSERT INTO t1 VALUES(1, randstr(1000,1000));
198 INSERT INTO t1 VALUES(2, randstr(1000,1000));
199 INSERT INTO t1 VALUES(3, randstr(1000,1000));
200 INSERT INTO t1 VALUES(4, randstr(1000,1000));
201 INSERT INTO t1 VALUES(5, randstr(1000,1000));
207 # Set up the content of the target database.
208 execsql "PRAGMA ${file_dest}.page_size = ${pgsz_dest}" $db_dest
209 if {$rows_dest != 0} {
212 CREATE TABLE ${file_dest}.t1(a, b);
213 CREATE INDEX ${file_dest}.i1 ON t1(a, b);
215 for {set ii 0} {$ii < $rows_dest} {incr ii} {
217 INSERT INTO ${file_dest}.t1 VALUES(1, randstr(1000,1000))
222 # Backup the source database.
223 do_test backup-2.$iTest.1 {
224 sqlite3_backup B $db_dest $file_dest db main
225 while {[B step $nPagePerStep]=="SQLITE_OK"} {}
229 # Run integrity check on the backup.
230 do_test backup-2.$iTest.2 {
231 execsql "PRAGMA ${file_dest}.integrity_check" $db_dest
234 test_contents backup-2.$iTest.3 db main $db_dest $file_dest
244 # End of backup-2.* tests.
245 #---------------------------------------------------------------------
247 #---------------------------------------------------------------------
248 # These tests, backup-3.*, ensure that nothing goes wrong if either
249 # the source or destination database are large enough to include the
250 # the locking-page (the page that contains the range of bytes that
251 # the locks are applied to). These tests assume that the pending
252 # byte is at offset 0x00010000 (64KB offset), as set by tester.tcl,
253 # not at the 1GB offset as it usually is.
255 # The test procedure is as follows (same procedure as used for
256 # the backup-2.* tests):
258 # 1) Populate the source database.
259 # 2) Populate the destination database.
260 # 3) Run the backup to completion. (backup-3.*.1)
261 # 4) Integrity check the destination db. (backup-3.*.2)
262 # 5) Check that the contents of the destination db is the same as that
263 # of the source db. (backup-3.*.3)
265 # The test procedure is run with the following parameters varied:
267 # * Source database includes pending-byte page.
268 # * Source database does not include pending-byte page.
270 # * Target database includes pending-byte page.
271 # * Target database does not include pending-byte page.
273 # * Target database page-size is the same as the source, OR
274 # * Target database page-size is larger than the source, OR
275 # * Target database page-size is smaller than the source.
278 foreach nSrcPg {10 64 65 66 100} {
279 foreach nDestRow {10 100} {
280 foreach nDestPgsz {512 1024 2048 4096} {
282 catch { file delete test.db }
283 catch { file delete test2.db }
287 # Set up the content of the two databases.
289 execsql { PRAGMA page_size = 1024 }
290 execsql "PRAGMA page_size = $nDestPgsz" db2
291 foreach db {db db2} {
294 CREATE TABLE t1(a, b);
295 CREATE INDEX i1 ON t1(a, b);
299 while {[file size test.db]/1024 < $nSrcPg} {
300 execsql { INSERT INTO t1 VALUES($ii, randstr(200,200)) }
303 for {set ii 0} {$ii < $nDestRow} {incr ii} {
304 execsql { INSERT INTO t1 VALUES($ii, randstr(1000,1000)) } db2
307 # Backup the source database.
308 do_test backup-3.$iTest.1 {
309 sqlite3_backup B db main db2 main
310 while {[B step 10]=="SQLITE_OK"} {}
314 # Run integrity check on the backup.
315 do_test backup-3.$iTest.2 {
316 execsql "PRAGMA integrity_check" db2
319 test_contents backup-3.$iTest.3 db main db2 main
328 #--------------------------------------------------------------------
329 do_test backup-3.$iTest.1 {
330 catch { file delete -force test.db }
331 catch { file delete -force test2.db }
335 db eval { PRAGMA page_size = 512 }
336 while {[file size test.db] <= $::sqlite_pending_byte} {
337 db eval "CREATE TABLE t${iTab}(a, b, c)"
342 db2 eval { PRAGMA page_size = 4096 }
343 while {[file size test2.db] < $::sqlite_pending_byte} {
344 db2 eval "CREATE TABLE t${iTab}(a, b, c)"
348 sqlite3_backup B db2 main db main
352 do_test backup-3.$iTest.2 {
357 # End of backup-3.* tests.
358 #---------------------------------------------------------------------
361 #---------------------------------------------------------------------
362 # The following tests, backup-4.*, test various error conditions:
364 # backup-4.1.*: Test invalid database names.
366 # backup-4.2.*: Test that the source database cannot be detached while
367 # a backup is in progress.
369 # backup-4.3.*: Test that the source database handle cannot be closed
370 # while a backup is in progress.
372 # backup-4.4.*: Test an attempt to specify the same handle for the
373 # source and destination databases.
375 # backup-4.5.*: Test that an in-memory destination with a different
376 # page-size to the source database is an error.
381 do_test backup-4.1.1 {
382 catch { sqlite3_backup B db aux db2 main }
384 do_test backup-4.1.2 {
386 } {unknown database aux}
387 do_test backup-4.1.3 {
388 catch { sqlite3_backup B db main db2 aux }
390 do_test backup-4.1.4 {
392 } {unknown database aux}
394 do_test backup-4.2.1 {
395 catch { file delete -force test3.db }
396 catch { file delete -force test4.db }
398 ATTACH 'test3.db' AS aux1;
399 CREATE TABLE aux1.t1(a, b);
402 ATTACH 'test4.db' AS aux2;
403 CREATE TABLE aux2.t2(a, b);
405 sqlite3_backup B db aux1 db2 aux2
407 do_test backup-4.2.2 {
408 catchsql { DETACH aux2 } db2
409 } {1 {database aux2 is locked}}
410 do_test backup-4.2.3 {
413 do_test backup-4.2.4 {
417 do_test backup-4.3.1 {
418 sqlite3_backup B db aux1 db2 aux2
420 do_test backup-4.3.2 {
424 do_test backup-4.3.3 {
426 } {unable to close due to unfinished backup operation}
427 do_test backup-4.3.4 {
430 do_test backup-4.3.5 {
434 do_test backup-4.4.1 {
435 set rc [catch {sqlite3_backup B db main db aux1}]
436 list $rc [sqlite3_errcode db] [sqlite3_errmsg db]
437 } {1 SQLITE_ERROR {source and destination must be distinct}}
441 do_test backup-4.5.1 {
442 catch { file delete -force test.db }
446 CREATE TABLE t1(a, b);
447 INSERT INTO t1 VALUES(1, 2);
450 PRAGMA page_size = 4096;
451 CREATE TABLE t2(a, b);
452 INSERT INTO t2 VALUES(3, 4);
454 sqlite3_backup B db2 main db main
456 do_test backup-4.5.2 {
459 do_test backup-4.5.3 {
466 # End of backup-5.* tests.
467 #---------------------------------------------------------------------
469 #---------------------------------------------------------------------
470 # The following tests, backup-5.*, test that the backup works properly
471 # when the source database is modified during the backup. Test cases
472 # are organized as follows:
474 # backup-5.x.1.*: Nothing special. Modify the database mid-backup.
476 # backup-5.x.2.*: Modify the database mid-backup so that one or more
477 # pages are written out due to cache stress. Then
478 # rollback the transaction.
480 # backup-5.x.3.*: Database is vacuumed.
482 # backup-5.x.4.*: Database is vacuumed and the page-size modified.
484 # backup-5.x.5.*: Database is shrunk via incr-vacuum.
486 # Each test is run three times, in the following configurations:
488 # 1) Backing up file-to-file. The writer writes via an external pager.
489 # 2) Backing up file-to-file. The writer writes via the same pager as
490 # is used by the backup operation.
491 # 3) Backing up memory-to-file.
494 file delete -force bak.db-wal
495 foreach {writer file} {db test.db db3 test.db db :memory:} {
497 catch { file delete bak.db }
499 catch { file delete $file }
503 do_test backup-5.$iTest.1.1 {
506 CREATE TABLE t1(a, b);
507 CREATE INDEX i1 ON t1(a, b);
508 INSERT INTO t1 VALUES(1, randstr(1000,1000));
509 INSERT INTO t1 VALUES(2, randstr(1000,1000));
510 INSERT INTO t1 VALUES(3, randstr(1000,1000));
511 INSERT INTO t1 VALUES(4, randstr(1000,1000));
512 INSERT INTO t1 VALUES(5, randstr(1000,1000));
515 expr {[execsql {PRAGMA page_count}] > 10}
517 do_test backup-5.$iTest.1.2 {
518 sqlite3_backup B db2 main db main
521 do_test backup-5.$iTest.1.3 {
522 execsql { UPDATE t1 SET a = a + 1 } $writer
525 do_test backup-5.$iTest.1.4 {
528 integrity_check backup-5.$iTest.1.5 db2
529 test_contents backup-5.$iTest.1.6 db main db2 main
531 do_test backup-5.$iTest.2.1 {
533 PRAGMA cache_size = 10;
535 INSERT INTO t1 SELECT '', randstr(1000,1000) FROM t1;
536 INSERT INTO t1 SELECT '', randstr(1000,1000) FROM t1;
537 INSERT INTO t1 SELECT '', randstr(1000,1000) FROM t1;
538 INSERT INTO t1 SELECT '', randstr(1000,1000) FROM t1;
542 do_test backup-5.$iTest.2.2 {
543 sqlite3_backup B db2 main db main
546 do_test backup-5.$iTest.2.3 {
549 UPDATE t1 SET a = a + 1;
554 do_test backup-5.$iTest.2.4 {
557 integrity_check backup-5.$iTest.2.5 db2
558 test_contents backup-5.$iTest.2.6 db main db2 main
560 do_test backup-5.$iTest.3.1 {
561 execsql { UPDATE t1 SET b = randstr(1000,1000) }
563 do_test backup-5.$iTest.3.2 {
564 sqlite3_backup B db2 main db main
567 do_test backup-5.$iTest.3.3 {
568 execsql { VACUUM } $writer
571 do_test backup-5.$iTest.3.4 {
574 integrity_check backup-5.$iTest.3.5 db2
575 test_contents backup-5.$iTest.3.6 db main db2 main
577 do_test backup-5.$iTest.4.1 {
578 execsql { UPDATE t1 SET b = randstr(1000,1000) }
580 do_test backup-5.$iTest.4.2 {
581 sqlite3_backup B db2 main db main
584 do_test backup-5.$iTest.4.3 {
586 PRAGMA page_size = 2048;
591 do_test backup-5.$iTest.4.4 {
594 integrity_check backup-5.$iTest.4.5 db2
595 test_contents backup-5.$iTest.4.6 db main db2 main
600 catch { file delete bak.db }
602 catch { file delete $file }
605 do_test backup-5.$iTest.5.1 {
607 PRAGMA auto_vacuum = incremental;
609 CREATE TABLE t1(a, b);
610 CREATE INDEX i1 ON t1(a, b);
611 INSERT INTO t1 VALUES(1, randstr(1000,1000));
612 INSERT INTO t1 VALUES(2, randstr(1000,1000));
613 INSERT INTO t1 VALUES(3, randstr(1000,1000));
614 INSERT INTO t1 VALUES(4, randstr(1000,1000));
615 INSERT INTO t1 VALUES(5, randstr(1000,1000));
619 do_test backup-5.$iTest.5.2 {
620 sqlite3_backup B db2 main db main
623 do_test backup-5.$iTest.5.3 {
626 PRAGMA incremental_vacuum;
630 do_test backup-5.$iTest.5.4 {
633 integrity_check backup-5.$iTest.5.5 db2
634 test_contents backup-5.$iTest.5.6 db main db2 main
640 # End of backup-5.* tests.
641 #---------------------------------------------------------------------
643 #---------------------------------------------------------------------
644 # Test the sqlite3_backup_remaining() and backup_pagecount() APIs.
647 catch { file delete -force test.db }
648 catch { file delete -force test2.db }
653 CREATE TABLE t1(a, b);
654 CREATE INDEX i1 ON t1(a, b);
655 INSERT INTO t1 VALUES(1, randstr(1000,1000));
656 INSERT INTO t1 VALUES(2, randstr(1000,1000));
657 INSERT INTO t1 VALUES(3, randstr(1000,1000));
658 INSERT INTO t1 VALUES(4, randstr(1000,1000));
659 INSERT INTO t1 VALUES(5, randstr(1000,1000));
664 set nTotal [expr {[file size test.db]/1024}]
665 sqlite3_backup B db2 main db main
676 list [B remaining] [B pagecount]
677 } [list [expr $nTotal-6] $nTotal]
679 execsql { CREATE TABLE t2(a PRIMARY KEY, b) }
681 list [B remaining] [B pagecount]
682 } [list [expr $nTotal-5] [expr $nTotal+2]]
691 #---------------------------------------------------------------------
692 # Test cases backup-7.* test that SQLITE_BUSY and SQLITE_LOCKED errors
693 # are returned correctly:
695 # backup-7.1.*: Source database is externally locked (return SQLITE_BUSY).
697 # backup-7.2.*: Attempt to step the backup process while a
698 # write-transaction is underway on the source pager (return
701 # backup-7.3.*: Destination database is externally locked (return SQLITE_BUSY).
704 catch { file delete -force test.db }
705 catch { file delete -force test2.db }
709 CREATE TABLE t1(a, b);
710 CREATE INDEX i1 ON t1(a, b);
711 INSERT INTO t1 VALUES(1, randstr(1000,1000));
712 INSERT INTO t1 SELECT a+ 1, randstr(1000,1000) FROM t1;
713 INSERT INTO t1 SELECT a+ 2, randstr(1000,1000) FROM t1;
714 INSERT INTO t1 SELECT a+ 4, randstr(1000,1000) FROM t1;
715 INSERT INTO t1 SELECT a+ 8, randstr(1000,1000) FROM t1;
716 INSERT INTO t1 SELECT a+16, randstr(1000,1000) FROM t1;
717 INSERT INTO t1 SELECT a+32, randstr(1000,1000) FROM t1;
718 INSERT INTO t1 SELECT a+64, randstr(1000,1000) FROM t1;
722 do_test backup-7.1.1 {
723 sqlite3_backup B db2 main db main
726 do_test backup-7.1.2 {
728 execsql { BEGIN EXCLUSIVE } db3
731 do_test backup-7.1.3 {
732 execsql { ROLLBACK } db3
735 do_test backup-7.2.1 {
738 INSERT INTO t1 VALUES(1, 4);
741 do_test backup-7.2.2 {
744 do_test backup-7.2.3 {
748 do_test backup-7.2.4 {
751 test_contents backup-7.2.5 db main db2 main
752 integrity_check backup-7.3.6 db2
754 do_test backup-7.3.1 {
757 file delete -force test2.db
761 sqlite3_backup B db2 main db main
762 execsql { BEGIN ; CREATE TABLE t2(a, b); } db3
766 do_test backup-7.3.2 {
767 execsql { COMMIT } db3
770 do_test backup-7.3.3 {
773 test_contents backup-7.3.4 db main db2 main
774 integrity_check backup-7.3.5 db2
778 #-----------------------------------------------------------------------
779 # The following tests, backup-8.*, test attaching multiple backup
780 # processes to the same source database. Also, reading from the source
781 # database while a read transaction is active.
783 # These tests reuse the database "test.db" left over from backup-7.*.
786 catch { file delete -force test2.db }
787 catch { file delete -force test3.db }
791 sqlite3_backup B2 db2 main db main
792 sqlite3_backup B3 db3 main db main
793 list [B2 finish] [B3 finish]
794 } {SQLITE_OK SQLITE_OK}
796 sqlite3_backup B3 db3 main db main
797 sqlite3_backup B2 db2 main db main
798 list [B2 finish] [B3 finish]
799 } {SQLITE_OK SQLITE_OK}
801 sqlite3_backup B2 db2 main db main
802 sqlite3_backup B3 db3 main db main
808 SELECT * FROM sqlite_master;
813 list [B3 step 5000] [B3 finish]
814 } {SQLITE_DONE SQLITE_OK}
816 list [B2 step 5000] [B2 finish]
817 } {SQLITE_DONE SQLITE_OK}
818 test_contents backup-8.7 db main db2 main
819 test_contents backup-8.8 db main db3 main
821 execsql { PRAGMA lock_status }
822 } {main shared temp closed}
823 do_test backup-8.10 {
829 #-----------------------------------------------------------------------
830 # The following tests, backup-9.*, test that:
832 # * Passing 0 as an argument to sqlite3_backup_step() means no pages
833 # are backed up (backup-9.1.*), and
834 # * Passing a negative value as an argument to sqlite3_backup_step() means
835 # all pages are backed up (backup-9.2.*).
837 # These tests reuse the database "test.db" left over from backup-7.*.
839 do_test backup-9.1.1 {
841 sqlite3_backup B db2 main db main
844 do_test backup-9.1.2 {
845 set nRemaining [B remaining]
846 expr {$nRemaining>100}
848 do_test backup-9.1.3 {
851 do_test backup-9.1.4 {
855 do_test backup-9.2.1 {
858 do_test backup-9.2.2 {
861 do_test backup-9.2.3 {
866 ifcapable memorymanage {
868 file delete -force test.db
869 file delete -force bak.db
875 do_test backup-10.1.1 {
878 CREATE TABLE t1(a, b);
879 INSERT INTO t1 VALUES(1, randstr(1000,1000));
880 INSERT INTO t1 VALUES(2, randstr(1000,1000));
881 INSERT INTO t1 VALUES(3, randstr(1000,1000));
882 INSERT INTO t1 VALUES(4, randstr(1000,1000));
883 INSERT INTO t1 VALUES(5, randstr(1000,1000));
884 CREATE INDEX i1 ON t1(a, b);
888 do_test backup-10.1.2 {
889 sqlite3_backup B db3 main db2 main
892 do_test backup-10.1.3 {
894 UPDATE t1 SET b = randstr(500,500);
897 sqlite3_release_memory [expr 1024*1024]
898 do_test backup-10.1.3 {
901 do_test backup-10.1.4 {
904 do_test backup-10.1.5 {
905 execsql { PRAGMA integrity_check } db3
913 #-----------------------------------------------------------------------
914 # Test that if the database is written to via the same database handle being
915 # used as the source by a backup operation:
917 # 10.1.*: If the db is in-memory, the backup is restarted.
918 # 10.2.*: If the db is a file, the backup is not restarted.
921 file delete -force test.db test.db-journal
922 foreach {tn file rc} {
923 1 test.db SQLITE_DONE
926 do_test backup-10.$tn.1 {
929 CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB);
931 INSERT INTO t1 VALUES(NULL, randomblob(200));
932 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
933 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
934 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
935 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
936 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
937 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
938 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
939 INSERT INTO t1 SELECT NULL, randomblob(200) FROM t1;
941 SELECT count(*) FROM t1;
945 do_test backup-10.$tn.2 {
946 set pgs [execsql {pragma page_count}]
947 expr {$pgs > 50 && $pgs < 75}
950 do_test backup-10.$tn.3 {
951 file delete -force bak.db bak.db-journal
953 sqlite3_backup B db2 main db main
957 do_test backup-10.$tn.4 {
958 execsql { UPDATE t1 SET b = randomblob(200) WHERE a IN (1, 250) }
961 do_test backup-10.$tn.5 {
965 do_test backup-10.$tn.6 {