| Index: third_party/sqlite/src/test/filefmt.test
|
| diff --git a/third_party/sqlite/src/test/filefmt.test b/third_party/sqlite/src/test/filefmt.test
|
| index 07cc5ca2b857d9c6dcb31b4d7f8930d1533d18b3..16b459630c3d67508b4a195ed577dd25fbcba993 100644
|
| --- a/third_party/sqlite/src/test/filefmt.test
|
| +++ b/third_party/sqlite/src/test/filefmt.test
|
| @@ -16,6 +16,12 @@
|
|
|
| set testdir [file dirname $argv0]
|
| source $testdir/tester.tcl
|
| +
|
| +# Do not use a codec for tests in this file, as the database file is
|
| +# manipulated directly using tcl scripts (using the [hexio_write] command).
|
| +#
|
| +do_not_use_codec
|
| +
|
| db close
|
| file delete -force test.db test.db-journal
|
|
|
| @@ -111,5 +117,80 @@ ifcapable pager_pragmas {
|
| } {1 {file is encrypted or is not a database}}
|
| }
|
|
|
| +#-------------------------------------------------------------------------
|
| +# The following block of tests - filefmt-2.* - test that versions 3.7.0
|
| +# and later can read and write databases that have been modified or created
|
| +# by 3.6.23.1 and earlier. The difference difference is that 3.7.0 stores
|
| +# the size of the database in the database file header, whereas 3.6.23.1
|
| +# always derives this from the size of the file.
|
| +#
|
| +db close
|
| +file delete -force test.db
|
| +
|
| +set a_string_counter 1
|
| +proc a_string {n} {
|
| + incr ::a_string_counter
|
| + string range [string repeat "${::a_string_counter}." $n] 1 $n
|
| +}
|
| +sqlite3 db test.db
|
| +db func a_string a_string
|
| +
|
| +do_execsql_test filefmt-2.1.1 {
|
| + PRAGMA page_size = 1024;
|
| + PRAGMA auto_vacuum = 0;
|
| + CREATE TABLE t1(a);
|
| + CREATE INDEX i1 ON t1(a);
|
| + INSERT INTO t1 VALUES(a_string(3000));
|
| + CREATE TABLE t2(a);
|
| + INSERT INTO t2 VALUES(1);
|
| +} {}
|
| +do_test filefmt-2.1.2 {
|
| + hexio_read test.db 28 4
|
| +} {00000009}
|
| +
|
| +do_test filefmt-2.1.3 {
|
| + sql36231 { INSERT INTO t1 VALUES(a_string(3000)) }
|
| +} {}
|
| +
|
| +do_execsql_test filefmt-2.1.4 { INSERT INTO t2 VALUES(2) } {}
|
| +integrity_check filefmt-2.1.5
|
| +do_test filefmt-2.1.6 { hexio_read test.db 28 4 } {00000010}
|
| +
|
| +db close
|
| +file delete -force test.db
|
| +sqlite3 db test.db
|
| +db func a_string a_string
|
| +
|
| +do_execsql_test filefmt-2.2.1 {
|
| + PRAGMA page_size = 1024;
|
| + PRAGMA auto_vacuum = 0;
|
| + CREATE TABLE t1(a);
|
| + CREATE INDEX i1 ON t1(a);
|
| + INSERT INTO t1 VALUES(a_string(3000));
|
| + CREATE TABLE t2(a);
|
| + INSERT INTO t2 VALUES(1);
|
| +} {}
|
| +do_test filefmt-2.2.2 {
|
| + hexio_read test.db 28 4
|
| +} {00000009}
|
| +
|
| +do_test filefmt-2.2.3 {
|
| + sql36231 { INSERT INTO t1 VALUES(a_string(3000)) }
|
| +} {}
|
| +
|
| +do_execsql_test filefmt-2.2.4 {
|
| + PRAGMA integrity_check;
|
| + BEGIN;
|
| + INSERT INTO t2 VALUES(2);
|
| + SAVEPOINT a;
|
| + INSERT INTO t2 VALUES(3);
|
| + ROLLBACK TO a;
|
| +} {ok}
|
| +
|
| +integrity_check filefmt-2.2.5
|
| +do_execsql_test filefmt-2.2.6 { COMMIT } {}
|
| +db close
|
| +sqlite3 db test.db
|
| +integrity_check filefmt-2.2.7
|
|
|
| finish_test
|
|
|