/ Check-in [2fdc147d]
Login

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

Overview
Comment:Make sure VACUUM cleans up after itself. Ticket #2071. (CVS 3514)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2fdc147d0059dcdfff2da33bd9fedb0bee057aa1
User & Date: drh 2006-11-18 20:20:22
Context
2006-11-20
16:21
Fix the ".dump" command in the shell. Ticket #2072. Also ticket #2065. (CVS 3515) check-in: 9fdc2496 user: drh tags: trunk
2006-11-18
20:20
Make sure VACUUM cleans up after itself. Ticket #2071. (CVS 3514) check-in: 2fdc147d user: drh tags: trunk
00:12
Store minimal terms in interior nodes. Whenever there's a break between leaf nodes, instead of storing the entire leftmost term of the rightmost child, store only that portion of the leftmost term necessary to distinguish it from the rightmost term of the leftmost child. (CVS 3513) check-in: f6e0b080 user: shess tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vacuum.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
255
256
257
258
259
260
261



262
263
264
265
266
267
**
*************************************************************************
** 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.64 2006/10/10 13:07:36 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
#include "os.h"

#ifndef SQLITE_OMIT_VACUUM
/*
................................................................................
int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
  int rc = SQLITE_OK;     /* Return code from service routines */
  Btree *pMain;           /* The database being vacuumed */
  Btree *pTemp;           /* The temporary database we vacuum into */
  char *zSql = 0;         /* SQL statements */
  int saved_flags;        /* Saved value of the db->flags */
  Db *pDb = 0;            /* Database to detach at end of vacuum */
  char zTemp[SQLITE_TEMPNAME_SIZE+1];  /* Name of the TEMP file */

  /* Save the current value of the write-schema flag before setting it. */
  saved_flags = db->flags;
  db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks;

  if( !db->autoCommit ){
    sqlite3SetString(pzErrMsg, "cannot VACUUM from within a transaction", 
................................................................................
    sqlite3MallocDisallow();
    sqlite3BtreeClose(pDb->pBt);
    sqlite3MallocAllow();
    pDb->pBt = 0;
    pDb->pSchema = 0;
  }




  sqliteFree( zSql );
  sqlite3ResetInternalSchema(db, 0);

  return rc;
}
#endif  /* SQLITE_OMIT_VACUUM */







|







 







|







 







>
>
>






10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
**
*************************************************************************
** 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.65 2006/11/18 20:20:22 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
#include "os.h"

#ifndef SQLITE_OMIT_VACUUM
/*
................................................................................
int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
  int rc = SQLITE_OK;     /* Return code from service routines */
  Btree *pMain;           /* The database being vacuumed */
  Btree *pTemp;           /* The temporary database we vacuum into */
  char *zSql = 0;         /* SQL statements */
  int saved_flags;        /* Saved value of the db->flags */
  Db *pDb = 0;            /* Database to detach at end of vacuum */
  char zTemp[SQLITE_TEMPNAME_SIZE+20];  /* Name of the TEMP file */

  /* Save the current value of the write-schema flag before setting it. */
  saved_flags = db->flags;
  db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks;

  if( !db->autoCommit ){
    sqlite3SetString(pzErrMsg, "cannot VACUUM from within a transaction", 
................................................................................
    sqlite3MallocDisallow();
    sqlite3BtreeClose(pDb->pBt);
    sqlite3MallocAllow();
    pDb->pBt = 0;
    pDb->pSchema = 0;
  }

  sqlite3OsDelete(zTemp);
  strcat(zTemp, "-journal");
  sqlite3OsDelete(zTemp);
  sqliteFree( zSql );
  sqlite3ResetInternalSchema(db, 0);

  return rc;
}
#endif  /* SQLITE_OMIT_VACUUM */