-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Fix\sa\scomment\stypo.\s\sThis\scheck-in\sis\s3.7.0\srelease\scandidate\s2.
-D 2010-07-21T16:16:28
+C Backport\sthe\s[65b8636ac6e5]\sfix\sfor\sticket\s[51ae9cad317a1]\sto\sversion\s3.7.0.
+D 2010-08-04T11:59:06
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed
F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0
F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff
-F src/btree.c 9a214e6141555b183216b73ace058c7a499cdbe2
+F src/btree.c 0de928e4da0fb4ef15e33bf3ff13656d0bc98e73
F src/btree.h dd83041eda10c17daf023257c1fc883b5f71f85a
F src/btreeInt.h b0c87f6725b06a0aa194a6d25d54b16ce9d6e291
F src/build.c 559d38b48f79bc92370c082f4606eefe1e8f94ac
F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
F test/expr.test 9f521ae22f00e074959f72ce2e55d46b9ed23f68
F test/filectrl.test 97003734290887566e01dded09dc9e99cb937e9e
-F test/filefmt.test 5d271bf467e6557fe7499dcc8203069c9dc5825e
+F test/filefmt.test f77c92141960b7933bc6691631d2ad62257ef40a
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
F test/fkey2.test 098c06c139a79f690301a43511cd1f6420ae5433
F test/fkey3.test 42f88d6048d8dc079e2a8cf7baad1cc1483a7620
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/pager1.test d8e4b2bc8164c920e6ea0572c9e13576d6e4f3fa
F test/pager2.test f5c757c271ce642d36a393ecbfb3aef1c240dcef
-F test/pagerfault.test a4c0bb8900b8dbf5fcbe41ee2a96148e22174bcb
+F test/pagerfault.test c1d176326ce244db157ce9c3ba128be2a9b172d6
F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
F test/tempdb.test 800c36623d67a2ad1f58784b9c5644e0405af6e6
F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
-F test/tester.tcl cab2b46972cd50c3939a0e30e0b37e73f558bc2d
+F test/tester.tcl 295800403a36c4319354482749e9282ce47b7edc
F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 13ed106c8c279422a6159e28c6887d13a88b7b8b
-R 48f3b6e106f37a4303da6eef05383891
+P b36b105eab6fd3195f4bfba6cb5cda0f063b7460
+R 31c974a6d3f6b8018f2e5977571634b1
+T *bgcolor * #ffb67c
+T *branch * branch-3.7.0
+T *sym-branch-3.7.0 *
+T -sym-release *
+T -sym-trunk *
U drh
-Z 6f03f192e574b328cbf6ee712ebb1776
+Z 3144cc4986e1c468c829202f323640cf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFMRx1eoxKgR168RlERAkrAAJ9jYeUOTv2JXqP7/ZLTAQf2A6QoNACeLuA0
-lTLlFWVnujV93G1zfacFBTo=
-=MCKn
+iD8DBQFMWVYOoxKgR168RlERAoF3AJ9tlSOAFwhoCXpCUpFeVieTmRPNxwCfQvwj
+F4/EhfaUu5V0KCxMjMOPdyk=
+=hZ38
-----END PGP SIGNATURE-----
-b36b105eab6fd3195f4bfba6cb5cda0f063b7460
\ No newline at end of file
+dec70c63d052bbe41fc4a065109d2845c67d3f15
\ No newline at end of file
if( p->inTrans>pBt->inTransaction ){
pBt->inTransaction = p->inTrans;
}
-#ifndef SQLITE_OMIT_SHARED_CACHE
if( wrflag ){
+ MemPage *pPage1 = pBt->pPage1;
+#ifndef SQLITE_OMIT_SHARED_CACHE
assert( !pBt->pWriter );
pBt->pWriter = p;
pBt->isExclusive = (u8)(wrflag>1);
- }
#endif
+
+ /* If the db-size header field is incorrect (as it may be if an old
+ ** client has been writing the database file), update it now. Doing
+ ** this sooner rather than later means the database size can safely
+ ** re-read the database size from page 1 if a savepoint or transaction
+ ** rollback occurs within the transaction.
+ */
+ if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){
+ rc = sqlite3PagerWrite(pPage1->pDbPage);
+ if( rc==SQLITE_OK ){
+ put4byte(&pPage1->aData[28], pBt->nPage);
+ }
+ }
+ }
}
} {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
}
}
+
+#-------------------------------------------------------------------------
+# When a 3.7.0 client opens a write-transaction on a database file that
+# has been appended to or truncated by a pre-370 client, it updates
+# the db-size in the file header immediately. This test case provokes
+# errors during that operation.
+#
+do_test pagerfault-22-pre1 {
+ faultsim_delete_and_reopen
+ db func a_string a_string
+ execsql {
+ 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);
+ }
+ db close
+ sql36231 { INSERT INTO t1 VALUES(a_string(3000)) }
+ faultsim_save_and_close
+} {}
+do_faultsim_test pagerfault-22 -prep {
+ faultsim_restore_and_reopen
+} -body {
+ execsql { INSERT INTO t2 VALUES(2) }
+ execsql { SELECT * FROM t2 }
+} -test {
+ faultsim_test_result {0 {1 2}}
+ faultsim_integrity_check
+}
+
finish_test
show_memstats
}
+# Open a new connection on database test.db and execute the SQL script
+# supplied as an argument. Before returning, close the new conection and
+# restore the 4 byte fields starting at header offsets 28, 92 and 96
+# to the values they held before the SQL was executed. This simulates
+# a write by a pre-3.7.0 client.
+#
+proc sql36231 {sql} {
+ set B [hexio_read test.db 92 8]
+ set A [hexio_read test.db 28 4]
+ sqlite3 db36231 test.db
+ catch { db36231 func a_string a_string }
+ execsql $sql db36231
+ db36231 close
+ hexio_write test.db 28 $A
+ hexio_write test.db 92 $B
+ return ""
+}
# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.