SQLite

Check-in [efd7bcb34c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure the database schema has been read before compiling an incrmental_vacuum pragma. (CVS 4032)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: efd7bcb34c1b4a0a3d4b954b90dfee93ac87bc86
User & Date: danielk1977 2007-05-23 13:50:24.000
Context
2007-05-23
16:23
Add some code to MemTranslate() to prevent the READ_UTF8() macro from overreading a buffer. (CVS 4033) (check-in: 0595319cd7 user: danielk1977 tags: trunk)
13:50
Make sure the database schema has been read before compiling an incrmental_vacuum pragma. (CVS 4032) (check-in: efd7bcb34c user: danielk1977 tags: trunk)
13:34
Fix a leaked page reference that could occur after an IO error in auto-vacuum databases. Also modify incrvacuum.test to work with DEFAULT_AUTOVACUUM=1 builds. (CVS 4031) (check-in: e691f2fa3d user: danielk1977 tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/pragma.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21













-
+







/*
** 2003 April 6
**
** 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 contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.138 2007/05/11 12:30:04 drh Exp $
** $Id: pragma.c,v 1.139 2007/05/23 13:50:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
441
442
443
444
445
446
447



448
449
450
451
452
453
454
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457







+
+
+







  **  PRAGMA [database.]incremental_vacuum(N)
  **
  ** Do N steps of incremental vacuuming on a database.
  */
#ifndef SQLITE_OMIT_AUTOVACUUM
  if( sqlite3StrICmp(zLeft,"incremental_vacuum")==0 ){
    int iLimit, addr;
    if( sqlite3ReadSchema(pParse) ){
      goto pragma_out;
    }
    if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
      iLimit = 0x7fffffff;
    }
    sqlite3BeginWriteOperation(pParse, 0, iDb);
    sqlite3VdbeAddOp(v, OP_MemInt, iLimit, 0);
    addr = sqlite3VdbeAddOp(v, OP_IncrVacuum, iDb, 0);
    sqlite3VdbeAddOp(v, OP_Callback, 0, 0);
Changes to test/incrvacuum.test.
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24







-
+







#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the incremental vacuum feature.
#
# Note: There are also some tests for incremental vacuum and IO 
# errors in incrvacuum_ioerr.test.
#
# $Id: incrvacuum.test,v 1.7 2007/05/23 13:34:32 danielk1977 Exp $
# $Id: incrvacuum.test,v 1.8 2007/05/23 13:50:24 danielk1977 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} {
431
432
433
434
435
436
437
438
















439
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455








+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

      SELECT * FROM tbl1;
    }
  } {hello world}

  if {$::nRow == $::iWrite} break
  incr ::iWrite
}

#---------------------------------------------------------------------
# This test - incrvacuum-8.* - is to check that nothing goes wrong
# with an incremental-vacuum if it is the first statement executed
# after an existing database is opened.
#
# At one point, this would always return SQLITE_SCHEMA (which 
# causes an infinite loop in tclsqlite.c if using the Tcl interface).
#
do_test incrvacuum-8.1 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA incremental_vacuum(50);
  }
} {}

finish_test