Index: src/vacuum.c ================================================================== --- src/vacuum.c +++ src/vacuum.c @@ -12,11 +12,11 @@ ** This file contains code used to implement the VACUUM command. ** ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. ** -** $Id: vacuum.c,v 1.7 2003/05/13 00:21:59 drh Exp $ +** $Id: vacuum.c,v 1.8 2003/08/15 13:24:52 drh Exp $ */ #include "sqliteInt.h" #include "os.h" /* @@ -109,10 +109,11 @@ vacuumStruct *p = (vacuumStruct*)pArg; int rc = 0; const char *zSep = "("; int i; + if( argv==0 ) return 0; p->s2.nUsed = 0; appendText(&p->s2, "INSERT INTO ", -1); appendQuoted(&p->s2, p->zTable); appendText(&p->s2, " VALUES", -1); for(i=0; ipParse, p->dbNew, argv[2]); if( rc==SQLITE_OK && strcmp(argv[0],"table")==0 ){ @@ -167,10 +169,11 @@ static int vacuumCallback3(void *pArg, int argc, char **argv, char **NotUsed){ vacuumStruct *p = (vacuumStruct*)pArg; int rc = 0; char zBuf[200]; assert( argc==1 ); + if( argv==0 ) return 0; assert( argv[0]!=0 ); assert( strlen(p->zPragma)<100 ); assert( strlen(argv[0])<30 ); sprintf(zBuf,"PRAGMA %s=%s;", p->zPragma, argv[0]); rc = execsql(p->pParse, p->dbNew, zBuf); Index: test/vacuum.test ================================================================== --- test/vacuum.test +++ test/vacuum.test @@ -9,11 +9,11 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the VACUUM statement. # -# $Id: vacuum.test,v 1.10 2003/04/25 13:28:03 drh Exp $ +# $Id: vacuum.test,v 1.11 2003/08/15 13:24:53 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl proc cksum {{db db}} { @@ -118,9 +118,21 @@ do_test vacuum-2.4 { catch {db2 eval {SELECT count(*) FROM sqlite_master}} cksum db2 } $cksum +# Ticket #427. Make sure VACUUM works when the EMPTY_RESULT_CALLBACKS +# pragma is turned on. +# +do_test vacuum-3.1 { + db close + file delete test.db + sqlite db test.db + execsql { + PRAGMA empty_result_callbacks=on; + VACUUM; + } +} {} catch {db2 close} # finish_test