-C Return\sSQLITE_BUSY\sif\sthe\sdatabase\sis\slocked\sreading\sthe\sschema\swithin\r\nsqlite_prepare().\sTicket\s#1106.\s(CVS\s2322)
-D 2005-02-09T07:05:46
+C Fix\sa\sproblem\swith\sVACUUM\sthat\scan\slead\sto\sdatabase\scorruption.\s(CVS\s2323)
+D 2005-02-12T00:19:30
F Makefile.in d928187101fa3d78426cf48ca30e39d0fb714e57
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
F src/update.c b6f4668c11059f86b71581187d09197fa28ec4be
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c 1b7b9a127b66743ab6cba8d44597aeb570723c99
-F src/vacuum.c 4dbe45a5c41674a04ac45a7586031583386ab119
+F src/vacuum.c ccb34e92fd662b2d975e3c8d8cfd229c9081cb78
F src/vdbe.c d9ec62c9f63768b4d4f8513b25aded8faf2de17b
F src/vdbe.h bb9186484f749a839c6c43953e79a6530253f7cd
F src/vdbeInt.h e80721cd8ff611789e20743eec43363a9fb5a48e
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test 7669ca789d62c258b678e8aa7a22a57eac10f2cf
F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
-F test/vacuum.test 10204524354ff5947e056419fa6b4f4b5067a541
+F test/vacuum.test 76c4bc4589353d071e81c003a25338d02560474d
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 306cc4342eb03c28de1a92c681836189e03e5af9
F test/where.test ffb790dfda75d977bae7a1f5830351623f76861b
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl 3e522a06ad41992023c80ca29a048ae2331ca5bd
-P f73a8aa34afd39e0b7df8f22b5c5d2c8d8979a1b
-R f830539fd533897542bbb8d2a19a23a0
-U danielk1977
-Z 0245bb834a1cf0f9358bd0fb2bd64ab5
+P c33c02d6069b90f295698a9f35f4aa99dee5f5e9
+R 8e61ab153be1dc618b065882d6b2d1a5
+U drh
+Z ed61c7e978da07a018272bafaa9d7f6b
-c33c02d6069b90f295698a9f35f4aa99dee5f5e9
\ No newline at end of file
+63894baf1b37156fd0b84eba4c9c5e8f43cee3f3
\ No newline at end of file
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
-** $Id: vacuum.c,v 1.38 2005/02/05 12:48:48 danielk1977 Exp $
+** $Id: vacuum.c,v 1.39 2005/02/12 00:19:30 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
*/
if( sqlite3BtreeIsInTrans(pTemp) ){
u32 meta;
+ int i;
+
+ /* This array determines which meta meta values are preserved in the
+ ** vacuum. Even entries are the meta value number and odd entries
+ ** are an increment to apply to the meta value after the vacuum.
+ ** The increment is used to increase the schema cookie so that other
+ ** connections to the same database will know to reread the schema.
+ */
+ static const unsigned char aCopy[] = {
+ 1, 1, /* Add one to the old schema cookie */
+ 3, 0, /* Preserve the default page cache size */
+ 5, 0, /* Preserve the default text encoding */
+ 6, 0, /* Preserve the user version */
+ };
assert( 0==sqlite3BtreeIsInTrans(pMain) );
rc = sqlite3BtreeBeginTrans(pMain, 1);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
- /* Copy Btree meta values 3 and 4. These correspond to SQL layer meta
- ** values 2 and 3, the default values of a couple of pragmas.
- */
- rc = sqlite3BtreeGetMeta(pMain, 3, &meta);
- if( rc!=SQLITE_OK ) goto end_of_vacuum;
- rc = sqlite3BtreeUpdateMeta(pTemp, 3, meta);
- if( rc!=SQLITE_OK ) goto end_of_vacuum;
- rc = sqlite3BtreeGetMeta(pMain, 4, &meta);
- if( rc!=SQLITE_OK ) goto end_of_vacuum;
- rc = sqlite3BtreeUpdateMeta(pTemp, 4, meta);
- if( rc!=SQLITE_OK ) goto end_of_vacuum;
+ /* Copy Btree meta values */
+ for(i=0; i<sizeof(aCopy)/sizeof(aCopy[0]); i+=2){
+ rc = sqlite3BtreeGetMeta(pMain, aCopy[i], &meta);
+ if( rc!=SQLITE_OK ) goto end_of_vacuum;
+ rc = sqlite3BtreeUpdateMeta(pTemp, aCopy[i], meta+aCopy[i+1]);
+ }
rc = sqlite3BtreeCopyFile(pMain, pTemp);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
# This file implements regression tests for SQLite library. The
# focus of this file is testing the VACUUM statement.
#
-# $Id: vacuum.test,v 1.33 2005/02/03 01:08:20 drh Exp $
+# $Id: vacuum.test,v 1.34 2005/02/12 00:19:30 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
cksum db2
} $cksum
+# Make sure the schema cookie is incremented by vacuum.
+#
+do_test vacuum-2.5 {
+ execsql {
+ BEGIN;
+ CREATE TABLE t6 AS SELECT * FROM t1;
+ CREATE TABLE t7 AS SELECT * FROM t1;
+ COMMIT;
+ }
+ sqlite3 db3 test.db
+ execsql {
+ SELECT * FROM t7 LIMIT 1
+ } db3
+ execsql {
+ VACUUM;
+ }
+ execsql {
+ INSERT INTO t7 VALUES(1234567890,'hello','world');
+ } db3
+ execsql {
+ SELECT * FROM t7 WHERE a=1234567890
+ }
+} {1234567890 hello world}
+integrity_check vacuum-2.6
+do_test vacuum-2.7 {
+ execsql {
+ SELECT * FROM t7 WHERE a=1234567890
+ } db3
+} {1234567890 hello world}
+do_test vacuum-2.8 {
+ execsql {
+ INSERT INTO t7 SELECT * FROM t6;
+ SELECT count(*) FROM t7;
+ }
+} 513
+integrity_check vacuum-2.9
+do_test vacuum-2.10 {
+ execsql {
+ DELETE FROM t7;
+ SELECT count(*) FROM t7;
+ } db3
+} 0
+integrity_check vacuum-2.11
+db3 close
+
+
# Ticket #427. Make sure VACUUM works when the EMPTY_RESULT_CALLBACKS
# pragma is turned on.
#
} $::cksum
}
-# finish_test
+
+finish_test