Index: src/pragma.c ================================================================== --- src/pragma.c +++ src/pragma.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.170 2008/02/13 18:25:27 danielk1977 Exp $ +** $Id: pragma.c,v 1.171 2008/03/19 00:21:31 drh Exp $ */ #include "sqliteInt.h" #include /* Ignore this whole file if pragmas are disabled @@ -935,17 +935,20 @@ { OP_String8, 0, 6, 0}, /* 4 */ { OP_Concat, 4, 3, 3}, { OP_Concat, 5, 3, 3}, { OP_Concat, 6, 3, 3}, { OP_ResultRow, 3, 1, 0}, + { OP_IfPos, 1, 0, 0}, /* 9 */ + { OP_Halt, 0, 0, 0}, }; sqlite3GenerateIndexKey(pParse, pIdx, 1, 3); jmp2 = sqlite3VdbeAddOp3(v, OP_Found, j+2, 0, 3); addr = sqlite3VdbeAddOpList(v, ArraySize(idxErr), idxErr); sqlite3VdbeChangeP4(v, addr+1, "rowid ", P4_STATIC); sqlite3VdbeChangeP4(v, addr+3, " missing from index ", P4_STATIC); sqlite3VdbeChangeP4(v, addr+4, pIdx->zName, P4_STATIC); + sqlite3VdbeJumpHere(v, addr+9); sqlite3VdbeJumpHere(v, jmp2); } sqlite3VdbeAddOp2(v, OP_Next, 1, loopTop+1); sqlite3VdbeJumpHere(v, loopTop); for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ Index: src/test2.c ================================================================== --- src/test2.c +++ src/test2.c @@ -11,11 +11,11 @@ ************************************************************************* ** Code for testing the pager.c module in SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test2.c,v 1.54 2008/03/07 19:51:14 drh Exp $ +** $Id: test2.c,v 1.55 2008/03/19 00:21:31 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include #include @@ -715,11 +715,9 @@ (char*)&sqlite3_diskfull_pending, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_diskfull", (char*)&sqlite3_diskfull, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_pending_byte", (char*)&sqlite3_pending_byte, TCL_LINK_INT); - Tcl_LinkVar(interp, "pager_pagesize", - (char*)&test_pagesize, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_pager_n_sort_bucket", (char*)&sqlite3_pager_n_sort_bucket, TCL_LINK_INT); return TCL_OK; } Index: test/alter2.test ================================================================== --- test/alter2.test +++ test/alter2.test @@ -11,21 +11,20 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # -# $Id: alter2.test,v 1.12 2007/11/28 13:43:17 drh Exp $ +# $Id: alter2.test,v 1.13 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # We have to have pragmas in order to do this test ifcapable {!pragma} return -# These tests do not work if there is a codec. The -# btree_open command does not know how to handle codecs. +# These tests do not work if there is a codec. # #if {[catch {sqlite3 -has_codec} r] || $r} return # The file format change affects the way row-records stored in tables (but # not indices) are interpreted. Before version 3.1.3, a row-record for a @@ -40,27 +39,21 @@ # This procedure sets the value of the file-format in file 'test.db' # to $newval. Also, the schema cookie is incremented. # proc set_file_format {newval} { - set bt [btree_open test.db 10 0] - btree_begin_transaction $bt - set meta [btree_get_meta $bt] - lset meta 2 $newval ;# File format - lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie - eval "btree_update_meta $bt $meta" - btree_commit $bt - btree_close $bt + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} } # This procedure returns the value of the file-format in file 'test.db'. # proc get_file_format {{fname test.db}} { - set bt [btree_open $fname 10 0] - set meta [btree_get_meta $bt] - btree_close $bt - lindex $meta 2 + return [hexio_get_int [hexio_read $fname 44 4]] } # This procedure sets the SQL statement stored for table $tbl in the # sqlite_master table of file 'test.db' to $sql. Also set the file format # to the supplied value. This is 2 if the added column has a default that is @@ -234,11 +227,13 @@ # format that SQLite does not support (in this case 5). Note: The # file format is checked each time the schema is read, so changing the # file format requires incrementing the schema cookie. # do_test alter2-4.1 { + db close set_file_format 5 + sqlite3 db test.db } {} do_test alter2-4.2 { # We have to run two queries here because the Tcl interface uses # sqlite3_prepare_v2(). In this case, the first query encounters an # SQLITE_SCHEMA error. Then, when trying to recompile the statement, the @@ -253,20 +248,20 @@ # catchsql { SELECT * FROM sqlite_master; } catchsql { SELECT * FROM sqlite_master; } } {1 {unsupported file format}} do_test alter2-4.3 { - sqlite3_errcode $::DB + sqlite3_errcode db } {SQLITE_ERROR} do_test alter2-4.4 { set ::DB [sqlite3_connection_pointer db] catchsql { SELECT * FROM sqlite_master; } } {1 {unsupported file format}} do_test alter2-4.5 { - sqlite3_errcode $::DB + sqlite3_errcode db } {SQLITE_ERROR} #--------------------------------------------------------------------- # Check that executing VACUUM on a file with file-format version 2 # resets the file format to 1. @@ -273,10 +268,12 @@ # set default_file_format [expr $SQLITE_DEFAULT_FILE_FORMAT==4 ? 4 : 1] ifcapable vacuum { do_test alter2-5.1 { set_file_format 2 + db close + sqlite3 db test.db execsql {SELECT 1 FROM sqlite_master LIMIT 1;} get_file_format } {2} do_test alter2-5.2 { execsql { @@ -294,11 +291,10 @@ # do_test alter2-6.1 { db close set_file_format 2 sqlite3 db test.db - set ::DB [sqlite3_connection_pointer db] get_file_format } {2} ifcapable attach { do_test alter2-6.2 { file delete -force test2.db-journal Index: test/alter3.test ================================================================== --- test/alter3.test +++ test/alter3.test @@ -11,11 +11,11 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # -# $Id: alter3.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $ +# $Id: alter3.test,v 1.11 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -48,14 +48,11 @@ # # This procedure returns the value of the file-format in file 'test.db'. # proc get_file_format {{fname test.db}} { - set bt [btree_open $fname 10 0] - set meta [btree_get_meta $bt] - btree_close $bt - lindex $meta 2 + return [hexio_get_int [hexio_read $fname 44 4]] } do_test alter3-1.1 { execsql { CREATE TABLE abc(a, b, c); Index: test/capi3.test ================================================================== --- test/capi3.test +++ test/capi3.test @@ -9,11 +9,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # -# $Id: capi3.test,v 1.59 2008/02/21 21:30:07 drh Exp $ +# $Id: capi3.test,v 1.60 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -632,22 +632,32 @@ do_test capi3-6.4-misuse { db cache flush sqlite3_close $DB } {SQLITE_OK} db close + +# This procedure sets the value of the file-format in file 'test.db' +# to $newval. Also, the schema cookie is incremented. +# +proc set_file_format {newval} { + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} +} + +# This procedure returns the value of the file-format in file 'test.db'. +# +proc get_file_format {{fname test.db}} { + return [hexio_get_int [hexio_read $fname 44 4]] +} if {![sqlite3 -has-codec]} { # Test what happens when the library encounters a newer file format. - # Do this by updating the file format via the btree layer. do_test capi3-7.1 { - set ::bt [btree_open test.db 10 0] - btree_begin_transaction $::bt - set meta [btree_get_meta $::bt] - lset meta 2 5 - eval [concat btree_update_meta $::bt [lrange $meta 0 end]] - btree_commit $::bt - btree_close $::bt + set_file_format 5 } {} do_test capi3-7.2 { sqlite3 db test.db catchsql { SELECT * FROM sqlite_master; @@ -658,62 +668,45 @@ if {![sqlite3 -has-codec]} { # Now test that the library correctly handles bogus entries in the # sqlite_master table (schema corruption). do_test capi3-8.1 { - file delete -force test.db - file delete -force test.db-journal + file delete -force test.db test.db-journal sqlite3 db test.db execsql { CREATE TABLE t1(a); } db close } {} do_test capi3-8.2 { - set ::bt [btree_open test.db 10 0] - btree_begin_transaction $::bt - set ::bc [btree_cursor $::bt 1 1] - - # Build a 5-field row record consisting of 5 null records. This is - # officially black magic. - catch {unset data} - set data [binary format c6 {6 0 0 0 0 0}] - btree_insert $::bc 5 $data - - btree_close_cursor $::bc - btree_commit $::bt - btree_close $::bt + sqlite3 db test.db + execsql { + PRAGMA writable_schema=ON; + INSERT INTO sqlite_master VALUES(NULL,NULL,NULL,NULL,NULL); + } + db close } {} do_test capi3-8.3 { sqlite3 db test.db catchsql { SELECT * FROM sqlite_master; } } {1 {malformed database schema}} do_test capi3-8.4 { - set ::bt [btree_open test.db 10 0] - btree_begin_transaction $::bt - set ::bc [btree_cursor $::bt 1 1] - - # Build a 5-field row record. The first field is a string 'table', and - # subsequent fields are all NULL. Replace the other broken record with - # this one and try to read the schema again. The broken record uses - # either UTF-8 or native UTF-16 (if this file is being run by - # utf16.test). - if { [string match UTF-16* $::ENC] } { - set data [binary format c6a10 {6 33 0 0 0 0} [utf16 table]] - } else { - set data [binary format c6a5 {6 23 0 0 0 0} table] - } - btree_insert $::bc 5 $data - - btree_close_cursor $::bc - btree_commit $::bt - btree_close $::bt + # Build a 5-field row record. The first field is a string 'table', and + # subsequent fields are all NULL. + db close + file delete -force test.db test.db-journal + sqlite3 db test.db + execsql { + CREATE TABLE t1(a); + PRAGMA writable_schema=ON; + INSERT INTO sqlite_master VALUES('table',NULL,NULL,NULL,NULL); + } + db close } {}; do_test capi3-8.5 { - db close sqlite3 db test.db catchsql { SELECT * FROM sqlite_master; } } {1 {malformed database schema}} Index: test/capi3c.test ================================================================== --- test/capi3c.test +++ test/capi3c.test @@ -11,11 +11,11 @@ # This file implements regression tests for SQLite library. # # This is a copy of the capi3.test file that has been adapted to # test the new sqlite3_prepare_v2 interface. # -# $Id: capi3c.test,v 1.14 2008/01/19 23:50:26 drh Exp $ +# $Id: capi3c.test,v 1.15 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -592,14 +592,12 @@ set ::ENC [execsql {pragma encoding}] db close do_test capi3c-6.0 { -btree_breakpoint sqlite3 db test.db set DB [sqlite3_connection_pointer db] -btree_breakpoint sqlite3_key $DB xyzzy set sql {SELECT a FROM t1 order by rowid} set STMT [sqlite3_prepare_v2 $DB $sql -1 TAIL] expr 0 } {0} @@ -619,22 +617,32 @@ sqlite3_close $DB } {SQLITE_OK} do_test capi3c-6.99-misuse { db close } {} + +# This procedure sets the value of the file-format in file 'test.db' +# to $newval. Also, the schema cookie is incremented. +# +proc set_file_format {newval} { + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} +} + +# This procedure returns the value of the file-format in file 'test.db'. +# +proc get_file_format {{fname test.db}} { + return [hexio_get_int [hexio_read $fname 44 4]] +} if {![sqlite3 -has-codec]} { # Test what happens when the library encounters a newer file format. - # Do this by updating the file format via the btree layer. do_test capi3c-7.1 { - set ::bt [btree_open test.db 10 0] - btree_begin_transaction $::bt - set meta [btree_get_meta $::bt] - lset meta 2 5 - eval [concat btree_update_meta $::bt [lrange $meta 0 end]] - btree_commit $::bt - btree_close $::bt + set_file_format 5 } {} do_test capi3c-7.2 { sqlite3 db test.db catchsql { SELECT * FROM sqlite_master; @@ -645,62 +653,45 @@ if {![sqlite3 -has-codec]} { # Now test that the library correctly handles bogus entries in the # sqlite_master table (schema corruption). do_test capi3c-8.1 { - file delete -force test.db - file delete -force test.db-journal + file delete -force test.db test.db-journal sqlite3 db test.db execsql { CREATE TABLE t1(a); } db close } {} do_test capi3c-8.2 { - set ::bt [btree_open test.db 10 0] - btree_begin_transaction $::bt - set ::bc [btree_cursor $::bt 1 1] - - # Build a 5-field row record consisting of 5 null records. This is - # officially black magic. - catch {unset data} - set data [binary format c6 {6 0 0 0 0 0}] - btree_insert $::bc 5 $data - - btree_close_cursor $::bc - btree_commit $::bt - btree_close $::bt + sqlite3 db test.db + execsql { + PRAGMA writable_schema=ON; + INSERT INTO sqlite_master VALUES(NULL,NULL,NULL,NULL,NULL); + } + db close } {} do_test capi3c-8.3 { sqlite3 db test.db catchsql { SELECT * FROM sqlite_master; } } {1 {malformed database schema}} do_test capi3c-8.4 { - set ::bt [btree_open test.db 10 0] - btree_begin_transaction $::bt - set ::bc [btree_cursor $::bt 1 1] - - # Build a 5-field row record. The first field is a string 'table', and - # subsequent fields are all NULL. Replace the other broken record with - # this one and try to read the schema again. The broken record uses - # either UTF-8 or native UTF-16 (if this file is being run by - # utf16.test). - if { [string match UTF-16* $::ENC] } { - set data [binary format c6a10 {6 33 0 0 0 0} [utf16 table]] - } else { - set data [binary format c6a5 {6 23 0 0 0 0} table] - } - btree_insert $::bc 5 $data - - btree_close_cursor $::bc - btree_commit $::bt - btree_close $::bt + # Build a 5-field row record. The first field is a string 'table', and + # subsequent fields are all NULL. + db close + file delete -force test.db test.db-journal + sqlite3 db test.db + execsql { + CREATE TABLE t1(a); + PRAGMA writable_schema=ON; + INSERT INTO sqlite_master VALUES('table',NULL,NULL,NULL,NULL); + } + db close } {}; do_test capi3c-8.5 { - db close sqlite3 db test.db catchsql { SELECT * FROM sqlite_master; } } {1 {malformed database schema}} Index: test/descidx1.test ================================================================== --- test/descidx1.test +++ test/descidx1.test @@ -9,11 +9,11 @@ # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is descending indices. # -# $Id: descidx1.test,v 1.9 2007/11/28 13:43:17 drh Exp $ +# $Id: descidx1.test,v 1.10 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -21,28 +21,23 @@ # This procedure sets the value of the file-format in file 'test.db' # to $newval. Also, the schema cookie is incremented. # proc set_file_format {newval} { - set bt [btree_open test.db 10 0] - btree_begin_transaction $bt - set meta [btree_get_meta $bt] - lset meta 2 $newval ;# File format - lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie - eval "btree_update_meta $bt $meta" - btree_commit $bt - btree_close $bt + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} } # This procedure returns the value of the file-format in file 'test.db'. # proc get_file_format {{fname test.db}} { - set bt [btree_open $fname 10 0] - set meta [btree_get_meta $bt] - btree_close $bt - lindex $meta 2 + return [hexio_get_int [hexio_read $fname 44 4]] } + # Verify that the file format starts as 4. # do_test descidx1-1.1 { execsql { Index: test/descidx2.test ================================================================== --- test/descidx2.test +++ test/descidx2.test @@ -9,11 +9,11 @@ # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is descending indices. # -# $Id: descidx2.test,v 1.4 2006/07/11 14:17:52 drh Exp $ +# $Id: descidx2.test,v 1.5 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -21,28 +21,23 @@ # This procedure sets the value of the file-format in file 'test.db' # to $newval. Also, the schema cookie is incremented. # proc set_file_format {newval} { - set bt [btree_open test.db 10 0] - btree_begin_transaction $bt - set meta [btree_get_meta $bt] - lset meta 2 $newval ;# File format - lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie - eval "btree_update_meta $bt $meta" - btree_commit $bt - btree_close $bt + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} } # This procedure returns the value of the file-format in file 'test.db'. # proc get_file_format {{fname test.db}} { - set bt [btree_open $fname 10 0] - set meta [btree_get_meta $bt] - btree_close $bt - lindex $meta 2 + return [hexio_get_int [hexio_read $fname 44 4]] } + # Verify that the file format starts as 4 # do_test descidx2-1.1 { execsql { Index: test/descidx3.test ================================================================== --- test/descidx3.test +++ test/descidx3.test @@ -9,11 +9,11 @@ # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is descending indices. # -# $Id: descidx3.test,v 1.5 2006/07/11 14:17:52 drh Exp $ +# $Id: descidx3.test,v 1.6 2008/03/19 00:21:31 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -25,27 +25,21 @@ # This procedure sets the value of the file-format in file 'test.db' # to $newval. Also, the schema cookie is incremented. # proc set_file_format {newval} { - set bt [btree_open test.db 10 0] - btree_begin_transaction $bt - set meta [btree_get_meta $bt] - lset meta 2 $newval ;# File format - lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie - eval "btree_update_meta $bt $meta" - btree_commit $bt - btree_close $bt + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} } # This procedure returns the value of the file-format in file 'test.db'. # proc get_file_format {{fname test.db}} { - set bt [btree_open $fname 10 0] - set meta [btree_get_meta $bt] - btree_close $bt - lindex $meta 2 + return [hexio_get_int [hexio_read $fname 44 4]] } # Verify that the file format starts as 4. # do_test descidx3-1.1 { Index: test/minmax3.test ================================================================== --- test/minmax3.test +++ test/minmax3.test @@ -6,11 +6,11 @@ # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** -# $Id: minmax3.test,v 1.1 2008/01/05 17:39:30 danielk1977 Exp $ +# $Id: minmax3.test,v 1.2 2008/03/19 00:21:31 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Do an SQL statement. Append the search count to the end of the result. @@ -22,30 +22,26 @@ # This procedure sets the value of the file-format in file 'test.db' # to $newval. Also, the schema cookie is incremented. # proc set_file_format {newval} { - set bt [btree_open test.db 10 0] - btree_begin_transaction $bt - set meta [btree_get_meta $bt] - lset meta 2 $newval ;# File format - lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie - eval "btree_update_meta $bt $meta" - btree_commit $bt - btree_close $bt -} - -# Create the file as file-format 4 (DESC index support). This is -# required to exercise a few cases in where.c. -# -execsql { select * from sqlite_master } -set_file_format 4 + hexio_write test.db 44 [hexio_render_int32 $newval] + set schemacookie [hexio_get_int [hexio_read test.db 40 4]] + incr schemacookie + hexio_write test.db 40 [hexio_render_int32 $schemacookie] + return {} +} do_test minmax3-1.0 { execsql { - BEGIN; CREATE TABLE t1(x, y, z); + } + db close + set_file_format 4 + sqlite3 db test.db + execsql { + BEGIN; INSERT INTO t1 VALUES('1', 'I', 'one'); INSERT INTO t1 VALUES('2', 'IV', 'four'); INSERT INTO t1 VALUES('2', NULL, 'three'); INSERT INTO t1 VALUES('2', 'II', 'two'); INSERT INTO t1 VALUES('2', 'V', 'five'); @@ -139,6 +135,5 @@ execsql { DROP INDEX i1 } } {} finish_test - Index: test/pragma.test ================================================================== --- test/pragma.test +++ test/pragma.test @@ -10,11 +10,11 @@ #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # -# $Id: pragma.test,v 1.58 2008/03/18 13:46:53 drh Exp $ +# $Id: pragma.test,v 1.59 2008/03/19 00:21:31 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: @@ -260,44 +260,45 @@ } } {1 11 2 3 2 22 3 4} ifcapable attach { if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} { do_test pragma-3.2 { - set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}] - set db [btree_open test.db 100 0] - btree_begin_transaction $db - set c [btree_cursor $db $rootpage 1] - btree_first $c - btree_delete $c - btree_commit $db - btree_close $db + db eval {SELECT rootpage FROM sqlite_master WHERE name='i2'} break + set pgsz [db eval {PRAGMA page_size}] + # overwrite the header on the rootpage of the index in order to + # make the index appear to be empty. + # + set offset [expr {$pgsz*($rootpage-1)}] + hexio_write test.db $offset 0a00000000040000000000 + db close + sqlite3 db test.db execsql {PRAGMA integrity_check} - } {{rowid 1 missing from index i2} {wrong # of entries in index i2}} + } {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} do_test pragma-3.3 { execsql {PRAGMA integrity_check=1} } {{rowid 1 missing from index i2}} do_test pragma-3.4 { execsql { ATTACH DATABASE 'test.db' AS t2; PRAGMA integrity_check } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} + } {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} do_test pragma-3.5 { execsql { - PRAGMA integrity_check=3 + PRAGMA integrity_check=4 } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}} + } {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}} do_test pragma-3.6 { execsql { PRAGMA integrity_check=xyz } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} + } {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} do_test pragma-3.7 { execsql { PRAGMA integrity_check=0 } - } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}} + } {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} # Add additional corruption by appending unused pages to the end of # the database file testerr.db # do_test pragma-3.8 { @@ -324,11 +325,11 @@ PRAGMA integrity_check } } {{*** in database t2 *** Page 4 is never used Page 5 is never used -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}} +Page 6 is never used} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} do_test pragma-3.10 { execsql { PRAGMA integrity_check=1 } } {{*** in database t2 *** @@ -338,11 +339,11 @@ PRAGMA integrity_check=5 } } {{*** in database t2 *** Page 4 is never used Page 5 is never used -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}} +Page 6 is never used} {rowid 1 missing from index i2} {rowid 2 missing from index i2}} do_test pragma-3.12 { execsql { PRAGMA integrity_check=4 } } {{*** in database t2 *** @@ -370,33 +371,33 @@ PRAGMA integrity_check } } {{*** in database t2 *** Page 4 is never used Page 5 is never used -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** +Page 6 is never used} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** Page 4 is never used Page 5 is never used -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}} +Page 6 is never used} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}} do_test pragma-3.16 { execsql { - PRAGMA integrity_check(9) + PRAGMA integrity_check(10) } } {{*** in database t2 *** Page 4 is never used Page 5 is never used -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** +Page 6 is never used} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** Page 4 is never used Page 5 is never used Page 6 is never used} {rowid 1 missing from index i2}} do_test pragma-3.17 { execsql { - PRAGMA integrity_check=7 + PRAGMA integrity_check=8 } } {{*** in database t2 *** Page 4 is never used Page 5 is never used -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** +Page 6 is never used} {rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2} {*** in database t3 *** Page 4 is never used Page 5 is never used}} do_test pragma-3.18 { execsql { PRAGMA integrity_check=4