/ Check-in [8dd938e4]
Login

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

Overview
Comment:Fix VACUUM so that it works on files whose name contains '. Ticket #873 (CVS 1930)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8dd938e48048ffeb11181db9d98112ea2adbcfa6
User & Date: drh 2004-09-02 15:27:42
Context
2004-09-02
15:49
Fix a bug in the pagesize test script. (CVS 1931) check-in: 1cf05bc6 user: drh tags: trunk
15:27
Fix VACUUM so that it works on files whose name contains '. Ticket #873 (CVS 1930) check-in: 8dd938e4 user: drh tags: trunk
15:14
Fix a problem with EXPLAIN on pragmas that return single integer values. Ticket #886 (CVS 1929) check-in: 8ce3d730 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vacuum.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the VACUUM command.
    13     13   **
    14     14   ** Most of the code in this file may be omitted by defining the
    15     15   ** SQLITE_OMIT_VACUUM macro.
    16     16   **
    17         -** $Id: vacuum.c,v 1.28 2004/07/26 23:07:52 drh Exp $
           17  +** $Id: vacuum.c,v 1.29 2004/09/02 15:27:42 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   
    22     22   #if !defined(SQLITE_OMIT_VACUUM) || SQLITE_OMIT_VACUUM
    23     23   /*
    24     24   ** Generate a random name of 20 character in length.
................................................................................
   137    137     ** can be set to 'off' for this file, as it is not recovered if a crash
   138    138     ** occurs anyway. The integrity of the database is maintained by a
   139    139     ** (possibly synchronous) transaction opened on the main database before
   140    140     ** sqlite3BtreeCopyFile() is called.
   141    141     **
   142    142     ** An optimisation would be to use a non-journaled pager.
   143    143     */
   144         -  zSql = sqlite3MPrintf("ATTACH '%s' AS vacuum_db;", zTemp);
          144  +  zSql = sqlite3MPrintf("ATTACH '%q' AS vacuum_db;", zTemp);
   145    145     if( !zSql ){
   146    146       rc = SQLITE_NOMEM;
   147    147       goto end_of_vacuum;
   148    148     }
   149    149     rc = execSql(db, zSql);
   150    150     sqliteFree(zSql);
   151    151     zSql = 0;

Changes to test/vacuum.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the VACUUM statement.
    13     13   #
    14         -# $Id: vacuum.test,v 1.24 2004/07/26 23:07:52 drh Exp $
           14  +# $Id: vacuum.test,v 1.25 2004/09/02 15:27:42 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   set fcnt 1
    20     20   proc cksum {{db db}} {
    21     21     set sql "SELECT name, type, sql FROM sqlite_master ORDER BY name, type"
................................................................................
   208    208       select count(*) from "abc abc" WHERE a = X'00112233';
   209    209     }
   210    210   } {1}
   211    211   
   212    212   # Check what happens when an in-memory database is vacuumed.
   213    213   do_test vacuum-7.0 {
   214    214     sqlite3 db2 :memory:
          215  +  execsql {
          216  +    CREATE TABLE t1(t);
          217  +    VACUUM;
          218  +  } db2
          219  +} {}
          220  +db2 close
          221  +
          222  +# Ticket #873.  VACUUM a database that has ' in its name.
          223  +#
          224  +do_test vacuum-8.1 {
          225  +  file delete -force a'z.db
          226  +  file delete -force a'z.db-journal
          227  +  sqlite3 db2 a'z.db
   215    228     execsql {
   216    229       CREATE TABLE t1(t);
   217    230       VACUUM;
   218    231     } db2
   219    232   } {}
   220    233   db2 close
   221    234   
   222    235   # finish_test