/ Check-in [cbebfb89]
Login

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

Overview
Comment:The -DSQLITE_OMIT_ATTACH=1 option now omits both the ATTACH and VACUUM commands. Ticket #2268. The regression test suite depends on both of these commands and will not run if compiled with this option. (CVS 3727)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cbebfb89603044e48b3a87b79d1eefbbc5b4c8a5
User & Date: drh 2007-03-27 14:44:51
Context
2007-03-27
15:00
Updates to the VACUUM documentation. Ticket #2257. (CVS 3728) check-in: c61c97c9 user: drh tags: trunk
14:44
The -DSQLITE_OMIT_ATTACH=1 option now omits both the ATTACH and VACUUM commands. Ticket #2268. The regression test suite depends on both of these commands and will not run if compiled with this option. (CVS 3727) check-in: cbebfb89 user: drh tags: trunk
14:05
Fix off-by-one errors in the header comments of btree.c. Ticket #2272. (CVS 3726) check-in: a70ea720 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/attach.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the ATTACH and DETACH commands.
    13     13   **
    14         -** $Id: attach.c,v 1.55 2007/03/24 16:45:05 danielk1977 Exp $
           14  +** $Id: attach.c,v 1.56 2007/03/27 14:44:51 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
           18  +#ifndef SQLITE_OMIT_ATTACH
    18     19   /*
    19     20   ** Resolve an expression that was part of an ATTACH or DETACH statement. This
    20     21   ** is slightly different from resolving a normal SQL expression, because simple
    21     22   ** identifiers are treated as strings, not possible column names or aliases.
    22     23   **
    23     24   ** i.e. if the parser sees:
    24     25   **
................................................................................
   347    348   ** Called by the parser to compile an ATTACH statement.
   348    349   **
   349    350   **     ATTACH p AS pDbname KEY pKey
   350    351   */
   351    352   void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){
   352    353     codeAttach(pParse, SQLITE_ATTACH, "sqlite_attach", 3, p, p, pDbname, pKey);
   353    354   }
          355  +#endif /* SQLITE_OMIT_ATTACH */
   354    356   
   355    357   /*
   356    358   ** Register the functions sqlite_attach and sqlite_detach.
   357    359   */
   358    360   void sqlite3AttachFunctions(sqlite3 *db){
          361  +#ifndef SQLITE_OMIT_ATTACH
   359    362     static const int enc = SQLITE_UTF8;
   360    363     sqlite3CreateFunc(db, "sqlite_attach", 3, enc, db, attachFunc, 0, 0);
   361    364     sqlite3CreateFunc(db, "sqlite_detach", 1, enc, db, detachFunc, 0, 0);
          365  +#endif
   362    366   }
   363    367   
   364    368   /*
   365    369   ** Initialize a DbFixer structure.  This routine must be called prior
   366    370   ** to passing the structure to one of the sqliteFixAAAA() routines below.
   367    371   **
   368    372   ** The return value indicates whether or not fixation is required.  TRUE

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.215 2007/02/02 12:44:37 drh Exp $
           17  +** @(#) $Id: parse.y,v 1.216 2007/03/27 14:44:51 drh Exp $
    18     18   */
    19     19   
    20     20   // All token codes are small integers with #defines that begin with "TK_"
    21     21   %token_prefix TK_
    22     22   
    23     23   // The type of the data attached to each token is Token.  This is also the
    24     24   // default type for non-terminals.
................................................................................
   886    886   ///////////////////////////// The DROP INDEX command /////////////////////////
   887    887   //
   888    888   cmd ::= DROP INDEX ifexists(E) fullname(X).   {sqlite3DropIndex(pParse, X, E);}
   889    889   
   890    890   ///////////////////////////// The VACUUM command /////////////////////////////
   891    891   //
   892    892   %ifndef SQLITE_OMIT_VACUUM
          893  +%ifndef SQLITE_OMIT_ATTACH
   893    894   cmd ::= VACUUM.                {sqlite3Vacuum(pParse);}
   894    895   cmd ::= VACUUM nm.             {sqlite3Vacuum(pParse);}
          896  +%endif  SQLITE_OMIT_ATTACH
   895    897   %endif  SQLITE_OMIT_VACUUM
   896    898   
   897    899   ///////////////////////////// The PRAGMA command /////////////////////////////
   898    900   //
   899    901   %ifndef SQLITE_OMIT_PRAGMA
   900    902   cmd ::= PRAGMA nm(X) dbnm(Z) EQ nmnum(Y).  {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
   901    903   cmd ::= PRAGMA nm(X) dbnm(Z) EQ ON(Y).  {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
................................................................................
  1014   1016   %ifndef SQLITE_OMIT_TRIGGER
  1015   1017   cmd ::= DROP TRIGGER ifexists(NOERR) fullname(X). {
  1016   1018     sqlite3DropTrigger(pParse,X,NOERR);
  1017   1019   }
  1018   1020   %endif  !SQLITE_OMIT_TRIGGER
  1019   1021   
  1020   1022   //////////////////////// ATTACH DATABASE file AS name /////////////////////////
         1023  +%ifndef SQLITE_OMIT_ATTACH
  1021   1024   cmd ::= ATTACH database_kw_opt expr(F) AS expr(D) key_opt(K). {
  1022   1025     sqlite3Attach(pParse, F, D, K);
  1023   1026   }
         1027  +cmd ::= DETACH database_kw_opt expr(D). {
         1028  +  sqlite3Detach(pParse, D);
         1029  +}
         1030  +
  1024   1031   %type key_opt {Expr *}
  1025   1032   %destructor key_opt {sqlite3ExprDelete($$);}
  1026   1033   key_opt(A) ::= .                     { A = 0; }
  1027   1034   key_opt(A) ::= KEY expr(X).          { A = X; }
  1028   1035   
  1029   1036   database_kw_opt ::= DATABASE.
  1030   1037   database_kw_opt ::= .
  1031         -
  1032         -//////////////////////// DETACH DATABASE name /////////////////////////////////
  1033         -cmd ::= DETACH database_kw_opt expr(D). {
  1034         -  sqlite3Detach(pParse, D);
  1035         -}
         1038  +%endif SQLITE_OMIT_ATTACH
  1036   1039   
  1037   1040   ////////////////////////// REINDEX collation //////////////////////////////////
  1038   1041   %ifndef SQLITE_OMIT_REINDEX
  1039   1042   cmd ::= REINDEX.                {sqlite3Reindex(pParse, 0, 0);}
  1040   1043   cmd ::= REINDEX nm(X) dbnm(Y).  {sqlite3Reindex(pParse, &X, &Y);}
  1041   1044   %endif  SQLITE_OMIT_REINDEX
  1042   1045   

Changes to src/test1.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing all sorts of SQLite interfaces.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test1.c,v 1.230 2007/03/26 22:05:02 drh Exp $
           16  +** $Id: test1.c,v 1.231 2007/03/27 14:44:51 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "tcl.h"
    20     20   #include "os.h"
    21     21   #include <stdlib.h>
    22     22   #include <string.h>
    23     23   
................................................................................
  3753   3753   #endif
  3754   3754   
  3755   3755   #ifdef SQLITE_OMIT_ANALYZE
  3756   3756     Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
  3757   3757   #else
  3758   3758     Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
  3759   3759   #endif
         3760  +
         3761  +#ifdef SQLITE_OMIT_ATTACH
         3762  +  Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
         3763  +#else
         3764  +  Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
         3765  +#endif
  3760   3766   
  3761   3767   #ifdef SQLITE_OMIT_AUTHORIZATION
  3762   3768     Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
  3763   3769   #else
  3764   3770     Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
  3765   3771   #endif
  3766   3772   
................................................................................
  4012   4018   
  4013   4019   #ifdef SQLITE_OMIT_UTF16
  4014   4020     Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
  4015   4021   #else
  4016   4022     Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
  4017   4023   #endif
  4018   4024   
  4019         -#ifdef SQLITE_OMIT_VACUUM
         4025  +#if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
  4020   4026     Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
  4021   4027   #else
  4022   4028     Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
  4023   4029   #endif
  4024   4030   
  4025   4031   #ifdef SQLITE_OMIT_VIEW
  4026   4032     Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);

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.67 2007/03/06 16:03:56 danielk1977 Exp $
           17  +** $Id: vacuum.c,v 1.68 2007/03/27 14:44:51 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "vdbeInt.h"
    21     21   #include "os.h"
    22     22   
    23         -#ifndef SQLITE_OMIT_VACUUM
           23  +#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
    24     24   /*
    25     25   ** Execute zSql on database db. Return an error code.
    26     26   */
    27     27   static int execSql(sqlite3 *db, const char *zSql){
    28     28     sqlite3_stmt *pStmt;
    29     29     if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){
    30     30       return sqlite3_errcode(db);
................................................................................
   267    267     strcat(zTemp, "-journal");
   268    268     sqlite3OsDelete(zTemp);
   269    269     sqliteFree( zSql );
   270    270     sqlite3ResetInternalSchema(db, 0);
   271    271   
   272    272     return rc;
   273    273   }
   274         -#endif  /* SQLITE_OMIT_VACUUM */
          274  +#endif  /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.593 2007/03/27 13:36:37 drh Exp $
           46  +** $Id: vdbe.c,v 1.594 2007/03/27 14:44:51 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  4507   4507     if( rc==SQLITE_ERROR ){
  4508   4508       sqlite3SetString(&p->zErrMsg, sqlite3_value_text(pMem), (char*)0);
  4509   4509     }
  4510   4510     break;
  4511   4511   }
  4512   4512   
  4513   4513   
  4514         -#ifndef SQLITE_OMIT_VACUUM
         4514  +#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
  4515   4515   /* Opcode: Vacuum * * *
  4516   4516   **
  4517   4517   ** Vacuum the entire database.  This opcode will cause other virtual
  4518   4518   ** machines to be created and run.  It may not be called from within
  4519   4519   ** a transaction.
  4520   4520   */
  4521   4521   case OP_Vacuum: {        /* no-push */

Changes to tool/mkkeywordhash.c.

    11     11   ** A header comment placed at the beginning of generated code.
    12     12   */
    13     13   static const char zHdr[] = 
    14     14     "/***** This file contains automatically generated code ******\n"
    15     15     "**\n"
    16     16     "** The code in this file has been automatically generated by\n"
    17     17     "**\n"
    18         -  "**     $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.25 2007/02/21 16:44:33 drh Exp $\n"
           18  +  "**     $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.26 2007/03/27 14:44:52 drh Exp $\n"
    19     19     "**\n"
    20     20     "** The code in this file implements a function that determines whether\n"
    21     21     "** or not a given identifier is really an SQL keyword.  The same thing\n"
    22     22     "** might be implemented more directly using a hand-written hash table.\n"
    23     23     "** But by using this automatically generated code, the size of the code\n"
    24     24     "** is substantially reduced.  This is important for embedded applications\n"
    25     25     "** on platforms with limited memory.\n"
................................................................................
   110    110   #  define SUBQUERY   0x00001000
   111    111   #endif
   112    112   #ifdef SQLITE_OMIT_TRIGGER
   113    113   #  define TRIGGER    0
   114    114   #else
   115    115   #  define TRIGGER    0x00002000
   116    116   #endif
   117         -#ifdef SQLITE_OMIT_VACUUM
          117  +#if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
   118    118   #  define VACUUM     0
   119    119   #else
   120    120   #  define VACUUM     0x00004000
   121    121   #endif
   122    122   #ifdef SQLITE_OMIT_VIEW
   123    123   #  define VIEW       0
   124    124   #else