-C Get\stests\sworking\swith\sSQLITE_OMIT_AUTOVACUUM=1.\s(CVS\s3918)
-D 2007-05-04T14:36:22
+C Optional\sparameter\sin\sthe\sINCREMENTAL\sVACUUM\sstatement\sspecifies\show\smany\npages\sto\svacuum\sfrom\sthe\sdatabase.\s(CVS\s3919)
+D 2007-05-04T16:14:38
F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f
F src/btree.c ebf16f19fc9e732c93b98083c4dfdbadad247e5c
F src/btree.h 2c187d60cf76d74c2b4767294d6b5fa267037ff0
-F src/build.c 05ef6d80d957d17f6458afc04b81aa00cb4cb093
+F src/build.c 470c3d39ab87bc817858493a32446630d6f553f3
F src/callback.c 6414ed32d55859d0f65067aa5b88d2da27b3af9e
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c c34a9c86ffd6da4cb3903ea038d977ec539d07e2
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c f01e0e577b7b54c3cdba24a30ecc585a805f23fa
F src/pager.h d652ddf092d2318d00e41f8539760fe8e57c157c
-F src/parse.y c4ee802a603ae69361b8d060ae440dd9d4fccf7f
+F src/parse.y 502cec813c863f864cb951d95121dbabd56b9396
F src/pragma.c 4fdefc03c3fd0ee87f8aad82bf80ba9bf1cdf416
F src/prepare.c 03277063bc4f5860efbf23548fa0123ac0f6eaec
F src/printf.c 0c6f40648770831341ac45ab32423a80b4c87f05
F src/shell.c d07ae326b3815d80f71c69b3c7584382e47f6447
F src/sqlite.h.in a666300976897eced975b448f722a722b362c6b1
F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890
-F src/sqliteInt.h 5a8c0221a4f11998f46aa76364a9559af8d7c1f7
+F src/sqliteInt.h 478ca87a2a08b56db820e36935b134fd30da8d17
F src/table.c a8de75bcedf84d4060d804264b067ab3b1a3561d
F src/tclsqlite.c cd87bbaffd115ded71b4b9c03be7b5b213c4ba7a
F src/test1.c 29a39fdde51f4612082ecf3f5af54dac93766f87
F test/incrblob.test ebfee15334f33dae682d3161acff9c4d169d4672
F test/incrblob_err.test 9f78c159279c992fa5ce49c06f50b680fc470520
F test/incrvacuum.test 2173bc075c7b3b96ccf228d737dd4f5c29500dc4
+F test/incrvacuum2.test c8c33a6e2b7ddfaa7256ae84a776e22cce9c920e
F test/incrvacuum_ioerr.test 0ebc382bcc2036ec58cf49cc5ffada45f75d907b
F test/index.test e65df12bed94b2903ee89987115e1578687e9266
F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 9d7a2e2bb41e7baed2cdcf199cb04d7aef19c010
-R 6f7220eaa2a5bebdd0c32a725c034b6c
+P b94d39e4d903bc34a9d0bbedd971677abc0ddfc0
+R 33b57057d3649deaa5906674a92ab54c
U drh
-Z 7cb97d159316a6b06274bb5cc230bd07
+Z 95bb62fd59bc4dc14d01347fa995fad6
-b94d39e4d903bc34a9d0bbedd971677abc0ddfc0
\ No newline at end of file
+ed713f9ccb5d0f306a79ab9931e43db2327fb435
\ No newline at end of file
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.423 2007/05/04 13:15:56 drh Exp $
+** $Id: build.c,v 1.424 2007/05/04 16:14:38 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
/*
** This is called to compile a statement of the form "INCREMENTAL VACUUM".
*/
-void sqlite3IncrVacuum(Parse *pParse){
+void sqlite3IncrVacuum(Parse *pParse, Token *pLimit){
Vdbe *v = sqlite3GetVdbe(pParse);
+ int iLimit;
+ if( pLimit==0 || !sqlite3GetInt32((char*)pLimit->z, &iLimit) ){
+ iLimit = 0x7fffffff;
+ }
if( v ){
int addr;
sqlite3BeginWriteOperation(pParse, 0, 0);
- addr = sqlite3VdbeCurrentAddr(v);
- sqlite3VdbeAddOp(v, OP_IncrVacuum, 0, addr+3);
+ sqlite3VdbeAddOp(v, OP_MemInt, iLimit, 0);
+ addr = sqlite3VdbeAddOp(v, OP_IncrVacuum, 0, 0);
sqlite3VdbeAddOp(v, OP_Callback, 0, 0);
- sqlite3VdbeAddOp(v, OP_Goto, 0, addr);
+ sqlite3VdbeAddOp(v, OP_MemIncr, -1, 0);
+ sqlite3VdbeAddOp(v, OP_IfMemPos, 0, addr);
+ sqlite3VdbeJumpHere(v, addr);
}
}
#endif /* #ifndef SQLITE_OMIT_AUTOVACUUM */
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.220 2007/05/04 14:14:45 drh Exp $
+** @(#) $Id: parse.y,v 1.221 2007/05/04 16:14:38 drh Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
%endif SQLITE_OMIT_VACUUM
%ifndef SQLITE_OMIT_AUTOVACUUM
-cmd ::= INCREMENTAL VACUUM. {sqlite3IncrVacuum(pParse);}
+cmd ::= INCREMENTAL VACUUM. {sqlite3IncrVacuum(pParse, 0);}
+cmd ::= INCREMENTAL VACUUM INTEGER(X). {sqlite3IncrVacuum(pParse, &X);}
%endif
///////////////////////////// The PRAGMA command /////////////////////////////
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.554 2007/05/04 11:59:32 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.555 2007/05/04 16:14:38 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
FuncDef *sqlite3VtabOverloadFunction(FuncDef*, int nArg, Expr*);
void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**);
int sqlite3Reprepare(Vdbe*);
-void sqlite3IncrVacuum(Parse *pParse);
+void sqlite3IncrVacuum(Parse *pParse, Token*);
#ifdef SQLITE_SSE
#include "sseInt.h"
--- /dev/null
+# 2007 May 04
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is testing the incremental vacuum feature.
+#
+# $Id: incrvacuum2.test,v 1.1 2007/05/04 16:14:39 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# If this build of the library does not support auto-vacuum, omit this
+# whole file.
+ifcapable {!autovacuum || !pragma} {
+ finish_test
+ return
+}
+
+# Create a database in incremental vacuum mode that has many
+# pages on the freelist.
+#
+do_test incrvacuum2-1.1 {
+ execsql {
+ PRAGMA page_size=1024;
+ PRAGMA auto_vacuum=incremental;
+ CREATE TABLE t1(x);
+ INSERT INTO t1 VALUES(zeroblob(30000));
+ DELETE FROM t1;
+ }
+ file size test.db
+} {32768}
+
+# Vacuum off a single page.
+#
+do_test incrvacuum2-1.2 {
+ execsql {
+ INCREMENTAL VACUUM 1
+ }
+ file size test.db
+} {31744}
+
+# Vacuum off five pages
+#
+do_test incrvacuum2-1.3 {
+ execsql {
+ INCREMENTAL VACUUM 5
+ }
+ file size test.db
+} {26624}
+
+# Vacuum off all the rest
+#
+do_test incrvacuum2-1.4 {
+ execsql {
+ INCREMENTAL VACUUM 1000
+ }
+ file size test.db
+} {3072}
+
+finish_test