/ Check-in [93b623b2]
Login

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

Overview
Comment:Begin implementing a new system of upper bounds on the capabilities of SQLite. By clearly defining the upper bounds, we make those upper bounds explicitly testable. This check-in is just infrastructure. The upper bounds are not yet enforced. (CVS 3941)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 93b623b232a43f78d2c90bfa2389dd5b28ad7280
User & Date: drh 2007-05-08 01:08:49
Context
2007-05-08
11:27
Fix a bug in the test logic introduced by check-in (3928). (CVS 3942) check-in: 47d1678d user: drh tags: trunk
01:08
Begin implementing a new system of upper bounds on the capabilities of SQLite. By clearly defining the upper bounds, we make those upper bounds explicitly testable. This check-in is just infrastructure. The upper bounds are not yet enforced. (CVS 3941) check-in: 93b623b2 user: drh tags: trunk
2007-05-07
19:31
Fix an NULL deref in the randomblob() function following a malloc failure. (CVS 3940) check-in: 011e7db2 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   221    221     $(TOP)/src/test6.c \
   222    222     $(TOP)/src/test7.c \
   223    223     $(TOP)/src/test8.c \
   224    224     $(TOP)/src/test9.c \
   225    225     $(TOP)/src/test_autoext.c \
   226    226     $(TOP)/src/test_async.c \
   227    227     $(TOP)/src/test_btree.c \
          228  +  $(TOP)/src/test_config.c \
   228    229     $(TOP)/src/test_hexio.c \
   229    230     $(TOP)/src/test_md5.c \
   230    231     $(TOP)/src/test_schema.c \
   231    232     $(TOP)/src/test_server.c \
   232    233     $(TOP)/src/test_tclvar.c \
   233    234     $(TOP)/src/utf.c \
   234    235     $(TOP)/src/util.c \
................................................................................
   239    240   # Header files used by all library source files.
   240    241   #
   241    242   HDR = \
   242    243      sqlite3.h  \
   243    244      $(TOP)/src/btree.h \
   244    245      $(TOP)/src/btreeInt.h \
   245    246      $(TOP)/src/hash.h \
          247  +   $(TOP)/src/limits.h \
   246    248      opcodes.h \
   247    249      $(TOP)/src/os.h \
   248    250      $(TOP)/src/os_common.h \
   249    251      $(TOP)/src/sqlite3ext.h \
   250    252      $(TOP)/src/sqliteInt.h  \
   251    253      $(TOP)/src/vdbe.h \
   252    254      parse.h

Changes to main.mk.

   177    177     $(TOP)/src/test6.c \
   178    178     $(TOP)/src/test7.c \
   179    179     $(TOP)/src/test8.c \
   180    180     $(TOP)/src/test9.c \
   181    181     $(TOP)/src/test_autoext.c \
   182    182     $(TOP)/src/test_async.c \
   183    183     $(TOP)/src/test_btree.c \
          184  +  $(TOP)/src/test_config.c \
   184    185     $(TOP)/src/test_hexio.c \
   185    186     $(TOP)/src/test_md5.c \
   186    187     $(TOP)/src/test_schema.c \
   187    188     $(TOP)/src/test_server.c \
   188    189     $(TOP)/src/test_tclvar.c \
   189    190     $(TOP)/src/utf.c \
   190    191     $(TOP)/src/util.c \
................................................................................
   195    196   # Header files used by all library source files.
   196    197   #
   197    198   HDR = \
   198    199      sqlite3.h  \
   199    200      $(TOP)/src/btree.h \
   200    201      $(TOP)/src/btreeInt.h \
   201    202      $(TOP)/src/hash.h \
          203  +   $(TOP)/src/limits.h \
   202    204      opcodes.h \
   203    205      $(TOP)/src/os.h \
   204    206      $(TOP)/src/os_common.h \
   205    207      $(TOP)/src/sqlite3ext.h \
   206    208      $(TOP)/src/sqliteInt.h  \
   207    209      $(TOP)/src/vdbe.h \
   208    210      parse.h

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.58 2007/05/04 13:15:56 drh Exp $
           14  +** $Id: attach.c,v 1.59 2007/05/08 01:08:49 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   #ifndef SQLITE_OMIT_ATTACH
    19     19   /*
    20     20   ** Resolve an expression that was part of an ATTACH or DETACH statement. This
    21     21   ** is slightly different from resolving a normal SQL expression, because simple
................................................................................
    79     79   
    80     80     /* Check for the following errors:
    81     81     **
    82     82     **     * Too many attached databases,
    83     83     **     * Transaction currently open
    84     84     **     * Specified database name already being used.
    85     85     */
    86         -  if( db->nDb>=MAX_ATTACHED+2 ){
           86  +  if( db->nDb>=SQLITE_MAX_ATTACHED+2 ){
    87     87       sqlite3_snprintf(
    88         -      sizeof(zErr), zErr, "too many attached databases - max %d", MAX_ATTACHED
           88  +      sizeof(zErr), zErr, "too many attached databases - max %d", 
           89  +      SQLITE_MAX_ATTACHED
    89     90       );
    90     91       goto attach_error;
    91     92     }
    92     93     if( !db->autoCommit ){
    93     94       sqlite3_snprintf(sizeof(zErr), zErr,
    94     95                        "cannot ATTACH database within transaction");
    95     96       goto attach_error;
................................................................................
   121    122     aNew = &db->aDb[db->nDb++];
   122    123     memset(aNew, 0, sizeof(*aNew));
   123    124   
   124    125     /* Open the database file. If the btree is successfully opened, use
   125    126     ** it to obtain the database schema. At this point the schema may
   126    127     ** or may not be initialised.
   127    128     */
   128         -  rc = sqlite3BtreeFactory(db, zFile, 0, MAX_PAGES, &aNew->pBt);
          129  +  rc = sqlite3BtreeFactory(db, zFile, 0, SQLITE_DEFAULT_CACHE_SIZE, &aNew->pBt);
   129    130     if( rc==SQLITE_OK ){
   130    131       aNew->pSchema = sqlite3SchemaGet(aNew->pBt);
   131    132       if( !aNew->pSchema ){
   132    133         rc = SQLITE_NOMEM;
   133    134       }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
   134    135         sqlite3_snprintf(sizeof(zErr), zErr, 
   135    136           "attached databases must use the same text encoding as main database");

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.425 2007/05/04 18:30:41 drh Exp $
           25  +** $Id: build.c,v 1.426 2007/05/08 01:08:49 drh Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
  3089   3089   /*
  3090   3090   ** Make sure the TEMP database is open and available for use.  Return
  3091   3091   ** the number of errors.  Leave any error messages in the pParse structure.
  3092   3092   */
  3093   3093   int sqlite3OpenTempDatabase(Parse *pParse){
  3094   3094     sqlite3 *db = pParse->db;
  3095   3095     if( db->aDb[1].pBt==0 && !pParse->explain ){
  3096         -    int rc = sqlite3BtreeFactory(db, 0, 0, MAX_PAGES, &db->aDb[1].pBt);
         3096  +    int rc = sqlite3BtreeFactory(db, 0, 0, SQLITE_DEFAULT_CACHE_SIZE,
         3097  +                                 &db->aDb[1].pBt);
  3097   3098       if( rc!=SQLITE_OK ){
  3098   3099         sqlite3ErrorMsg(pParse, "unable to open a temporary database "
  3099   3100           "file for storing temporary tables");
  3100   3101         pParse->rc = rc;
  3101   3102         return 1;
  3102   3103       }
  3103   3104       if( db->flags & !db->autoCommit ){
................................................................................
  3146   3147     db = pParse->db;
  3147   3148     if( pParse->cookieGoto==0 ){
  3148   3149       pParse->cookieGoto = sqlite3VdbeAddOp(v, OP_Goto, 0, 0)+1;
  3149   3150     }
  3150   3151     if( iDb>=0 ){
  3151   3152       assert( iDb<db->nDb );
  3152   3153       assert( db->aDb[iDb].pBt!=0 || iDb==1 );
  3153         -    assert( iDb<MAX_ATTACHED+2 );
         3154  +    assert( iDb<SQLITE_MAX_ATTACHED+2 );
  3154   3155       mask = 1<<iDb;
  3155   3156       if( (pParse->cookieMask & mask)==0 ){
  3156   3157         pParse->cookieMask |= mask;
  3157   3158         pParse->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
  3158   3159         if( !OMIT_TEMPDB && iDb==1 ){
  3159   3160           sqlite3OpenTempDatabase(pParse);
  3160   3161         }

Added src/limits.h.

            1  +/*
            2  +** 2007 May 7
            3  +**
            4  +** The author disclaims copyright to this source code.  In place of
            5  +** a legal notice, here is a blessing:
            6  +**
            7  +**    May you do good and not evil.
            8  +**    May you find forgiveness for yourself and forgive others.
            9  +**    May you share freely, never taking more than you give.
           10  +**
           11  +*************************************************************************
           12  +** 
           13  +** This file defines various limits of what SQLite can process.
           14  +**
           15  +** @(#) $Id: limits.h,v 1.1 2007/05/08 01:08:49 drh Exp $
           16  +*/
           17  +
           18  +/*
           19  +** The maximum length of a TEXT or BLOB in bytes.   This also
           20  +** limits the size of a row in a table or index.
           21  +**
           22  +** The hard limit is the ability of a 32-bit signed integer
           23  +** to count the size: 2^31-1 or 2147483647.
           24  +*/
           25  +#ifndef SQLITE_MAX_LENGTH
           26  +# define SQLITE_MAX_LENGTH 1000000000
           27  +#endif
           28  +
           29  +/*
           30  +** This is the maximum number of
           31  +**
           32  +**    * Columns in a table
           33  +**    * Columns in an index
           34  +**    * Columns in a view
           35  +**    * Terms in the SET clause of an UPDATE statement
           36  +**    * Terms in the result set of a SELECT statement
           37  +**    * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
           38  +**    * Terms in the VALUES clause of an INSERT statement
           39  +**
           40  +** The hard upper limit here is 32676.  Most database people will
           41  +** tell you that in a well-normalized database, you usually should
           42  +** not have more than a dozen or so columns in any table.  And if
           43  +** that is the case, there is no point in having more than a few
           44  +** dozen values in any of the other situations described above.
           45  +*/
           46  +#ifndef SQLITE_MAX_COLUMN
           47  +# define SQLITE_MAX_COLUMN 1000
           48  +#endif
           49  +
           50  +/*
           51  +** The maximum length of a single SQL statement in bytes.
           52  +** The hard limit here is the same as SQLITE_MAX_LENGTH.
           53  +*/
           54  +#ifndef SQLITE_MAX_SQL_LENGTH
           55  +# define SQLITE_MAX_SQL_LENGTH 1000000
           56  +#endif
           57  +
           58  +/*
           59  +** The maximum number of terms in an expression.
           60  +** This is limited to some extent by SQLITE_MAX_SQL_LENGTH.
           61  +** But sometime you might want to place more severe limits
           62  +** on the complexity of an expression.
           63  +*/
           64  +#ifndef SQLITE_MAX_EXPR_LENGTH
           65  +# define SQLITE_MAX_EXPR_LENGTH 5000
           66  +#endif
           67  +
           68  +/*
           69  +** The maximum number of opcodes in a VDBE program.
           70  +*/
           71  +#ifndef SQLITE_MAX_VDBE_OP
           72  +# define SQLITE_MAX_VDBE_OP 25000
           73  +#endif
           74  +
           75  +/*
           76  +** The maximum number of arguments to an SQL function.
           77  +*/
           78  +#ifndef SQLITE_MAX_FUNCTION_ARG
           79  +# define SQLITE_MAX_FUNCTION_ARG 100
           80  +#endif
           81  +
           82  +/*
           83  +** The maximum number of in-memory pages to use for the main database
           84  +** table and for temporary tables.  The SQLITE_DEFAULT_CACHE_SIZE
           85  +*/
           86  +#ifndef SQLITE_DEFAULT_CACHE_SIZE
           87  +# define SQLITE_DEFAULT_CACHE_SIZE  2000
           88  +#endif
           89  +#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
           90  +# define SQLITE_DEFAULT_TEMP_CACHE_SIZE  500
           91  +#endif
           92  +
           93  +/*
           94  +** The maximum number of attached databases.  This must be at least 2
           95  +** in order to support the main database file (0) and the file used to
           96  +** hold temporary tables (1).  And it must be less than 32 because
           97  +** we use a bitmask of databases with a u32 in places (for example
           98  +** the Parse.cookieMask field).
           99  +*/
          100  +#ifndef SQLITE_MAX_ATTACHED
          101  +# define SQLITE_MAX_ATTACHED 10
          102  +#endif
          103  +
          104  +
          105  +/*
          106  +** The maximum value of a ?nnn wildcard that the parser will accept.
          107  +*/
          108  +#ifndef SQLITE_MAX_VARIABLE_NUMBER
          109  +# define SQLITE_MAX_VARIABLE_NUMBER 999
          110  +#endif
          111  +
          112  +/*
          113  +** The default size of a database page.
          114  +*/
          115  +#ifndef SQLITE_DEFAULT_PAGE_SIZE
          116  +# define SQLITE_DEFAULT_PAGE_SIZE 1024
          117  +#endif
          118  +
          119  +/* Maximum page size.  The upper bound on this value is 32768.  This a limit
          120  +** imposed by the necessity of storing the value in a 2-byte unsigned integer
          121  +** and the fact that the page size must be a power of 2.
          122  +*/
          123  +#ifndef SQLITE_MAX_PAGE_SIZE
          124  +# define SQLITE_MAX_PAGE_SIZE 32768
          125  +#endif
          126  +
          127  +/*
          128  +** Maximum number of pages in one database file.
          129  +*/
          130  +#ifndef SQLITE_MAX_PAGE_COUNT
          131  +# define SQLITE_MAX_PAGE_COUNT 1073741823
          132  +#endif

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.373 2007/05/07 14:58:53 danielk1977 Exp $
           17  +** $Id: main.c,v 1.374 2007/05/08 01:08:49 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** The version of the library
................................................................................
   960    960     db->pDfltColl->type = SQLITE_COLL_BINARY;
   961    961     pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 6, 0);
   962    962     if( pColl ){
   963    963       pColl->type = SQLITE_COLL_NOCASE;
   964    964     }
   965    965   
   966    966     /* Open the backend database driver */
   967         -  rc = sqlite3BtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt);
          967  +  rc = sqlite3BtreeFactory(db, zFilename, 0, SQLITE_DEFAULT_CACHE_SIZE,
          968  +                           &db->aDb[0].pBt);
   968    969     if( rc!=SQLITE_OK ){
   969    970       sqlite3Error(db, rc, 0);
   970    971       db->magic = SQLITE_MAGIC_CLOSED;
   971    972       goto opendb_out;
   972    973     }
   973    974     db->aDb[0].pSchema = sqlite3SchemaGet(db->aDb[0].pBt);
   974    975     db->aDb[1].pSchema = sqlite3SchemaGet(0);

Changes to src/pager.h.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This header file defines the interface that the sqlite page cache
    13     13   ** subsystem.  The page cache subsystem reads and writes a file a page
    14     14   ** at a time and provides a journal for rollback.
    15     15   **
    16         -** @(#) $Id: pager.h,v 1.58 2007/04/13 02:14:30 drh Exp $
           16  +** @(#) $Id: pager.h,v 1.59 2007/05/08 01:08:49 drh Exp $
    17     17   */
    18     18   
    19     19   #ifndef _PAGER_H_
    20     20   #define _PAGER_H_
    21     21   
    22         -/*
    23         -** The default size of a database page.
    24         -*/
    25         -#ifndef SQLITE_DEFAULT_PAGE_SIZE
    26         -# define SQLITE_DEFAULT_PAGE_SIZE 1024
    27         -#endif
    28         -
    29         -/* Maximum page size.  The upper bound on this value is 32768.  This a limit
    30         -** imposed by necessity of storing the value in a 2-byte unsigned integer
    31         -** and the fact that the page size must be a power of 2.
    32         -**
    33         -** This value is used to initialize certain arrays on the stack at
    34         -** various places in the code.  On embedded machines where stack space
    35         -** is limited and the flexibility of having large pages is not needed,
    36         -** it makes good sense to reduce the maximum page size to something more
    37         -** reasonable, like 1024.
    38         -*/
    39         -#ifndef SQLITE_MAX_PAGE_SIZE
    40         -# define SQLITE_MAX_PAGE_SIZE 32768
    41         -#endif
    42         -
    43         -/*
    44         -** Maximum number of pages in one database.
    45         -*/
    46         -#define SQLITE_MAX_PAGE 1073741823
    47         -
    48     22   /*
    49     23   ** The type used to represent a page number.  The first page in a file
    50     24   ** is called page 1.  0 is used to represent "not a page".
    51     25   */
    52     26   typedef unsigned int Pgno;
    53     27   
    54     28   /*

Changes to src/pragma.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 PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.134 2007/05/04 18:30:41 drh Exp $
           14  +** $Id: pragma.c,v 1.135 2007/05/08 01:08:49 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include "os.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /* Ignore this whole file if pragmas are disabled
    21     21   */
................................................................................
   305    305       int addr;
   306    306       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   307    307       if( !zRight ){
   308    308         sqlite3VdbeSetNumCols(v, 1);
   309    309         sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cache_size", P3_STATIC);
   310    310         addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
   311    311         sqlite3VdbeChangeP1(v, addr, iDb);
   312         -      sqlite3VdbeChangeP1(v, addr+5, MAX_PAGES);
          312  +      sqlite3VdbeChangeP1(v, addr+5, SQLITE_DEFAULT_CACHE_SIZE);
   313    313       }else{
   314    314         int size = atoi(zRight);
   315    315         if( size<0 ) size = -size;
   316    316         sqlite3BeginWriteOperation(pParse, 0, iDb);
   317    317         sqlite3VdbeAddOp(v, OP_Integer, size, 0);
   318    318         sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 2);
   319    319         addr = sqlite3VdbeAddOp(v, OP_Integer, 0, 0);

Changes to src/prepare.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains the implementation of the sqlite3_prepare()
    13     13   ** interface, and routines that contribute to loading the database schema
    14     14   ** from disk.
    15     15   **
    16         -** $Id: prepare.c,v 1.47 2007/04/30 21:39:16 drh Exp $
           16  +** $Id: prepare.c,v 1.48 2007/05/08 01:08:49 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "os.h"
    20     20   #include <ctype.h>
    21     21   
    22     22   /*
    23     23   ** Fill the InitData structure with an error message that indicates
................................................................................
   257    257       }
   258    258     }else{
   259    259       DbSetProperty(db, iDb, DB_Empty);
   260    260     }
   261    261     pDb->pSchema->enc = ENC(db);
   262    262   
   263    263     size = meta[2];
   264         -  if( size==0 ){ size = MAX_PAGES; }
          264  +  if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }
   265    265     pDb->pSchema->cache_size = size;
   266    266     sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
   267    267   
   268    268     /*
   269    269     ** file_format==1    Version 3.0.0.
   270    270     ** file_format==2    Version 3.1.3.  // ALTER TABLE ADD COLUMN
   271    271     ** file_format==3    Version 3.1.4.  // ditto but with non-NULL defaults

Changes to src/sqlite.h.in.

     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 header file defines the interface that the SQLite library
    13     13   ** presents to client programs.
    14     14   **
    15         -** @(#) $Id: sqlite.h.in,v 1.206 2007/05/07 14:58:53 danielk1977 Exp $
           15  +** @(#) $Id: sqlite.h.in,v 1.207 2007/05/08 01:08:49 drh Exp $
    16     16   */
    17     17   #ifndef _SQLITE3_H_
    18     18   #define _SQLITE3_H_
    19     19   #include <stdarg.h>     /* Needed for the definition of va_list */
    20     20   
    21     21   /*
    22     22   ** Make sure we can call this stuff from C++.
................................................................................
   181    181   #define SQLITE_CORRUPT     11   /* The database disk image is malformed */
   182    182   #define SQLITE_NOTFOUND    12   /* NOT USED. Table or record not found */
   183    183   #define SQLITE_FULL        13   /* Insertion failed because database is full */
   184    184   #define SQLITE_CANTOPEN    14   /* Unable to open the database file */
   185    185   #define SQLITE_PROTOCOL    15   /* NOT USED. Database lock protocol error */
   186    186   #define SQLITE_EMPTY       16   /* Database is empty */
   187    187   #define SQLITE_SCHEMA      17   /* The database schema changed */
   188         -#define SQLITE_TOOBIG      18   /* NOT USED. Too much data for one row */
          188  +#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
   189    189   #define SQLITE_CONSTRAINT  19   /* Abort due to contraint violation */
   190    190   #define SQLITE_MISMATCH    20   /* Data type mismatch */
   191    191   #define SQLITE_MISUSE      21   /* Library used incorrectly */
   192    192   #define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
   193    193   #define SQLITE_AUTH        23   /* Authorization denied */
   194    194   #define SQLITE_FORMAT      24   /* Auxiliary database format error */
   195    195   #define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */

Changes to src/sqliteInt.h.

     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   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.558 2007/05/07 09:32:45 danielk1977 Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.559 2007/05/08 01:08:49 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
           18  +#include "limits.h"
           19  +
    18     20   
    19     21   #if defined(SQLITE_TCL) || defined(TCLSH)
    20     22   # include <tcl.h>
    21     23   #endif
    22     24   
    23     25   /*
    24     26   ** Many people are failing to set -DNDEBUG=1 when compiling SQLite.
................................................................................
    77     79   # define SQLITE_OMIT_TRACE 1
    78     80   # undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
    79     81   #endif
    80     82   #ifndef SQLITE_BIG_DBL
    81     83   # define SQLITE_BIG_DBL (1e99)
    82     84   #endif
    83     85   
    84         -/*
    85         -** The maximum number of in-memory pages to use for the main database
    86         -** table and for temporary tables. Internally, the MAX_PAGES and 
    87         -** TEMP_PAGES macros are used. To override the default values at
    88         -** compilation time, the SQLITE_DEFAULT_CACHE_SIZE and 
    89         -** SQLITE_DEFAULT_TEMP_CACHE_SIZE macros should be set.
    90         -*/
    91         -#ifdef SQLITE_DEFAULT_CACHE_SIZE
    92         -# define MAX_PAGES SQLITE_DEFAULT_CACHE_SIZE
    93         -#else
    94         -# define MAX_PAGES   2000
    95         -#endif
    96         -#ifdef SQLITE_DEFAULT_TEMP_CACHE_SIZE
    97         -# define TEMP_PAGES SQLITE_DEFAULT_TEMP_CACHE_SIZE
    98         -#else
    99         -# define TEMP_PAGES   500
   100         -#endif
   101         -
   102     86   /*
   103     87   ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
   104     88   ** afterward. Having this macro allows us to cause the C compiler 
   105     89   ** to omit code used by TEMP tables without messy #ifndef statements.
   106     90   */
   107     91   #ifdef SQLITE_OMIT_TEMPDB
   108     92   #define OMIT_TEMPDB 1
................................................................................
   120    104   ** If the following macro is set to 0, the NULLs are indistinct for
   121    105   ** a UNIQUE index.  In this mode, you can only have a single NULL entry
   122    106   ** for a column declared UNIQUE.  This is the way Informix and SQL Server
   123    107   ** work.
   124    108   */
   125    109   #define NULL_DISTINCT_FOR_UNIQUE 1
   126    110   
   127         -/*
   128         -** The maximum number of attached databases.  This must be at least 2
   129         -** in order to support the main database file (0) and the file used to
   130         -** hold temporary tables (1).  And it must be less than 32 because
   131         -** we use a bitmask of databases with a u32 in places (for example
   132         -** the Parse.cookieMask field).
   133         -*/
   134         -#define MAX_ATTACHED 10
   135         -
   136         -/*
   137         -** The maximum value of a ?nnn wildcard that the parser will accept.
   138         -*/
   139         -#define SQLITE_MAX_VARIABLE_NUMBER 999
   140         -
   141    111   /*
   142    112   ** The "file format" number is an integer that is incremented whenever
   143    113   ** the VDBE-level file format changes.  The following macros define the
   144    114   ** the default file format for new databases and the maximum file format
   145    115   ** that the library can read.
   146    116   */
   147    117   #define SQLITE_MAX_FILE_FORMAT 4
................................................................................
  1341   1311     int nTab;            /* Number of previously allocated VDBE cursors */
  1342   1312     int nMem;            /* Number of memory cells used so far */
  1343   1313     int nSet;            /* Number of sets used so far */
  1344   1314     int ckOffset;        /* Stack offset to data used by CHECK constraints */
  1345   1315     u32 writeMask;       /* Start a write transaction on these databases */
  1346   1316     u32 cookieMask;      /* Bitmask of schema verified databases */
  1347   1317     int cookieGoto;      /* Address of OP_Goto to cookie verifier subroutine */
  1348         -  int cookieValue[MAX_ATTACHED+2];  /* Values of cookies to verify */
         1318  +  int cookieValue[SQLITE_MAX_ATTACHED+2];  /* Values of cookies to verify */
  1349   1319   #ifndef SQLITE_OMIT_SHARED_CACHE
  1350   1320     int nTableLock;        /* Number of locks in aTableLock */
  1351   1321     TableLock *aTableLock; /* Required table locks for shared-cache mode */
  1352   1322   #endif
  1353   1323   
  1354   1324     /* Above is constant between recursions.  Below is reset before and after
  1355   1325     ** each recursion */

Changes to src/tclsqlite.c.

     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   ** A TCL Interface to SQLite.  Append this file to sqlite3.c and
    13     13   ** compile the whole thing to build a TCL-enabled version of SQLite.
    14     14   **
    15         -** $Id: tclsqlite.c,v 1.186 2007/05/04 19:03:03 danielk1977 Exp $
           15  +** $Id: tclsqlite.c,v 1.187 2007/05/08 01:08:49 drh Exp $
    16     16   */
    17     17   #include "tcl.h"
    18     18   #include <errno.h>
    19     19   
    20     20   /*
    21     21   ** Some additional include files are needed if this file is not
    22     22   ** appended to the amalgamation.
................................................................................
  2493   2493       extern int Md5_Init(Tcl_Interp*);
  2494   2494       extern int Sqlitetestsse_Init(Tcl_Interp*);
  2495   2495       extern int Sqlitetestasync_Init(Tcl_Interp*);
  2496   2496       extern int Sqlitetesttclvar_Init(Tcl_Interp*);
  2497   2497       extern int Sqlitetestschema_Init(Tcl_Interp*);
  2498   2498       extern int Sqlitetest_autoext_Init(Tcl_Interp*);
  2499   2499       extern int Sqlitetest_hexio_Init(Tcl_Interp*);
         2500  +    extern int Sqliteconfig_Init(Tcl_Interp*);
  2500   2501   
  2501   2502       Sqlitetest1_Init(interp);
  2502   2503       Sqlitetest2_Init(interp);
  2503   2504       Sqlitetest3_Init(interp);
  2504   2505       Sqlitetest4_Init(interp);
  2505   2506       Sqlitetest5_Init(interp);
  2506   2507       Sqlitetest6_Init(interp);
................................................................................
  2508   2509       Sqlitetest8_Init(interp);
  2509   2510       Sqlitetest9_Init(interp);
  2510   2511       Sqlitetestasync_Init(interp);
  2511   2512       Sqlitetesttclvar_Init(interp);
  2512   2513       Sqlitetestschema_Init(interp);
  2513   2514       Sqlitetest_autoext_Init(interp);
  2514   2515       Sqlitetest_hexio_Init(interp);
         2516  +    Sqliteconfig_Init(interp);
  2515   2517       Md5_Init(interp);
  2516   2518   #ifdef SQLITE_SSE
  2517   2519       Sqlitetestsse_Init(interp);
  2518   2520   #endif
  2519   2521     }
  2520   2522   #endif
  2521   2523     if( argc>=2 || TCLSH==2 ){

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.250 2007/05/07 14:58:53 danielk1977 Exp $
           16  +** $Id: test1.c,v 1.251 2007/05/08 01:08:49 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   
................................................................................
  4215   4215       Tcl_ListObjAppendElement(0, pResult, Tcl_NewIntObj(v));
  4216   4216     }
  4217   4217     Tcl_SetObjResult(interp, pResult);
  4218   4218     return TCL_OK;
  4219   4219   }
  4220   4220   
  4221   4221   
  4222         -/*
  4223         -** This routine sets entries in the global ::sqlite_options() array variable
  4224         -** according to the compile-time configuration of the database.  Test
  4225         -** procedures use this to determine when tests should be omitted.
  4226         -*/
  4227         -static void set_options(Tcl_Interp *interp){
  4228         -#ifdef SQLITE_32BIT_ROWID
  4229         -  Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY);
  4230         -#else
  4231         -  Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY);
  4232         -#endif
  4233         -
  4234         -#ifdef SQLITE_CASE_SENSITIVE_LIKE
  4235         -  Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY);
  4236         -#else
  4237         -  Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
  4238         -#endif
  4239         -
  4240         -#ifdef SQLITE_DISABLE_DIRSYNC
  4241         -  Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
  4242         -#else
  4243         -  Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
  4244         -#endif
  4245         -
  4246         -#ifdef SQLITE_DISABLE_LFS
  4247         -  Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
  4248         -#else
  4249         -  Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
  4250         -#endif
  4251         -
  4252         -#ifdef SQLITE_OMIT_ALTERTABLE
  4253         -  Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
  4254         -#else
  4255         -  Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
  4256         -#endif
  4257         -
  4258         -#ifdef SQLITE_OMIT_ANALYZE
  4259         -  Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
  4260         -#else
  4261         -  Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
  4262         -#endif
  4263         -
  4264         -#ifdef SQLITE_OMIT_ATTACH
  4265         -  Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
  4266         -#else
  4267         -  Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
  4268         -#endif
  4269         -
  4270         -#ifdef SQLITE_OMIT_AUTHORIZATION
  4271         -  Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
  4272         -#else
  4273         -  Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
  4274         -#endif
  4275         -
  4276         -#ifdef SQLITE_OMIT_AUTOINCREMENT
  4277         -  Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY);
  4278         -#else
  4279         -  Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY);
  4280         -#endif
  4281         -
  4282         -#ifdef SQLITE_OMIT_AUTOVACUUM
  4283         -  Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
  4284         -#else
  4285         -  Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY);
  4286         -#endif /* SQLITE_OMIT_AUTOVACUUM */
  4287         -#if !defined(SQLITE_DEFAULT_AUTOVACUUM) || SQLITE_DEFAULT_AUTOVACUUM==0
  4288         -  Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY);
  4289         -#else
  4290         -  Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","1",TCL_GLOBAL_ONLY);
  4291         -#endif
  4292         -
  4293         -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
  4294         -  Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY);
  4295         -#else
  4296         -  Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY);
  4297         -#endif
  4298         -
  4299         -#ifdef SQLITE_OMIT_BLOB_LITERAL
  4300         -  Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY);
  4301         -#else
  4302         -  Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
  4303         -#endif
  4304         -
  4305         -#ifdef SQLITE_OMIT_CAST
  4306         -  Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY);
  4307         -#else
  4308         -  Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY);
  4309         -#endif
  4310         -
  4311         -#ifdef SQLITE_OMIT_CHECK
  4312         -  Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY);
  4313         -#else
  4314         -  Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY);
  4315         -#endif
  4316         -
  4317         -#ifdef SQLITE_ENABLE_COLUMN_METADATA
  4318         -  Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY);
  4319         -#else
  4320         -  Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY);
  4321         -#endif
  4322         -
  4323         -#ifdef SQLITE_OMIT_COMPLETE
  4324         -  Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
  4325         -#else
  4326         -  Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY);
  4327         -#endif
  4328         -
  4329         -#ifdef SQLITE_OMIT_COMPOUND_SELECT
  4330         -  Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
  4331         -#else
  4332         -  Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
  4333         -#endif
  4334         -
  4335         -#ifdef SQLITE_OMIT_CONFLICT_CLAUSE
  4336         -  Tcl_SetVar2(interp, "sqlite_options", "conflict", "0", TCL_GLOBAL_ONLY);
  4337         -#else
  4338         -  Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
  4339         -#endif
  4340         -
  4341         -#if OS_UNIX
  4342         -  Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
  4343         -#else
  4344         -  Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY);
  4345         -#endif
  4346         -
  4347         -#ifdef SQLITE_OMIT_DATETIME_FUNCS
  4348         -  Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY);
  4349         -#else
  4350         -  Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
  4351         -#endif
  4352         -
  4353         -#ifdef SQLITE_OMIT_DISKIO
  4354         -  Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY);
  4355         -#else
  4356         -  Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY);
  4357         -#endif
  4358         -
  4359         -#ifdef SQLITE_OMIT_EXPLAIN
  4360         -  Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY);
  4361         -#else
  4362         -  Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
  4363         -#endif
  4364         -
  4365         -#ifdef SQLITE_OMIT_FLOATING_POINT
  4366         -  Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
  4367         -#else
  4368         -  Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY);
  4369         -#endif
  4370         -
  4371         -#ifdef SQLITE_OMIT_FOREIGN_KEY
  4372         -  Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY);
  4373         -#else
  4374         -  Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
  4375         -#endif
  4376         -
  4377         -#ifdef SQLITE_ENABLE_FTS1
  4378         -  Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY);
  4379         -#else
  4380         -  Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY);
  4381         -#endif
  4382         -
  4383         -#ifdef SQLITE_ENABLE_FTS2
  4384         -  Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY);
  4385         -#else
  4386         -  Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY);
  4387         -#endif
  4388         -
  4389         -#ifdef SQLITE_OMIT_GLOBALRECOVER
  4390         -  Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "0", TCL_GLOBAL_ONLY);
  4391         -#else
  4392         -  Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "1", TCL_GLOBAL_ONLY);
  4393         -#endif
  4394         -
  4395         -#ifdef SQLITE_ENABLE_ICU
  4396         -  Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
  4397         -#else
  4398         -  Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
  4399         -#endif
  4400         -
  4401         -#ifdef SQLITE_OMIT_INCRBLOB
  4402         -  Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
  4403         -#else
  4404         -  Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY);
  4405         -#endif /* SQLITE_OMIT_AUTOVACUUM */
  4406         -
  4407         -#ifdef SQLITE_OMIT_INTEGRITY_CHECK
  4408         -  Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
  4409         -#else
  4410         -  Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY);
  4411         -#endif
  4412         -
  4413         -#if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
  4414         -  Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY);
  4415         -#else
  4416         -  Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY);
  4417         -#endif
  4418         -
  4419         -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
  4420         -  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
  4421         -#else
  4422         -  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
  4423         -#endif
  4424         -
  4425         -#ifdef SQLITE_OMIT_LOAD_EXTENSION
  4426         -  Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
  4427         -#else
  4428         -  Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
  4429         -#endif
  4430         -
  4431         -#ifdef SQLITE_OMIT_MEMORYDB
  4432         -  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
  4433         -#else
  4434         -  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
  4435         -#endif
  4436         -
  4437         -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  4438         -  Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
  4439         -#else
  4440         -  Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
  4441         -#endif
  4442         -
  4443         -#ifdef SQLITE_OMIT_OR_OPTIMIZATION
  4444         -  Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY);
  4445         -#else
  4446         -  Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
  4447         -#endif
  4448         -
  4449         -#ifdef SQLITE_OMIT_PAGER_PRAGMAS
  4450         -  Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY);
  4451         -#else
  4452         -  Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
  4453         -#endif
  4454         -
  4455         -#ifdef SQLITE_OMIT_PARSER
  4456         -  Tcl_SetVar2(interp, "sqlite_options", "parser", "0", TCL_GLOBAL_ONLY);
  4457         -#else
  4458         -  Tcl_SetVar2(interp, "sqlite_options", "parser", "1", TCL_GLOBAL_ONLY);
  4459         -#endif
  4460         -
  4461         -#if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
  4462         -  Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY);
  4463         -  Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
  4464         -#else
  4465         -  Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY);
  4466         -#endif
  4467         -
  4468         -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
  4469         -  Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY);
  4470         -#else
  4471         -  Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
  4472         -#endif
  4473         -
  4474         -#ifdef SQLITE_ENABLE_REDEF_IO
  4475         -  Tcl_SetVar2(interp, "sqlite_options", "redefio", "1", TCL_GLOBAL_ONLY);
  4476         -#else
  4477         -  Tcl_SetVar2(interp, "sqlite_options", "redefio", "0", TCL_GLOBAL_ONLY);
  4478         -#endif
  4479         -
  4480         -#ifdef SQLITE_OMIT_REINDEX
  4481         -  Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
  4482         -#else
  4483         -  Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
  4484         -#endif
  4485         -
  4486         -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
  4487         -  Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY);
  4488         -#else
  4489         -  Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY);
  4490         -#endif
  4491         -
  4492         -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
  4493         -  Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY);
  4494         -#else
  4495         -  Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
  4496         -#endif
  4497         -
  4498         -#ifdef SQLITE_OMIT_SHARED_CACHE
  4499         -  Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY);
  4500         -#else
  4501         -  Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY);
  4502         -#endif
  4503         -
  4504         -#ifdef SQLITE_OMIT_SUBQUERY
  4505         -  Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY);
  4506         -#else
  4507         -  Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY);
  4508         -#endif
  4509         -
  4510         -#ifdef SQLITE_OMIT_TCL_VARIABLE
  4511         -  Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY);
  4512         -#else
  4513         -  Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
  4514         -#endif
  4515         -
  4516         -#if defined(THREADSAFE) && THREADSAFE
  4517         -  Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY);
  4518         -#else
  4519         -  Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "0", TCL_GLOBAL_ONLY);
  4520         -#endif
  4521         -
  4522         -#ifdef SQLITE_OMIT_TRACE
  4523         -  Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
  4524         -#else
  4525         -  Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
  4526         -#endif
  4527         -
  4528         -#ifdef SQLITE_OMIT_TRIGGER
  4529         -  Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
  4530         -#else
  4531         -  Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
  4532         -#endif
  4533         -
  4534         -#ifdef SQLITE_OMIT_TEMPDB
  4535         -  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
  4536         -#else
  4537         -  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
  4538         -#endif
  4539         -
  4540         -#ifdef SQLITE_OMIT_UTF16
  4541         -  Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
  4542         -#else
  4543         -  Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
  4544         -#endif
  4545         -
  4546         -#if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
  4547         -  Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
  4548         -#else
  4549         -  Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
  4550         -#endif
  4551         -
  4552         -#ifdef SQLITE_OMIT_VIEW
  4553         -  Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);
  4554         -#else
  4555         -  Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY);
  4556         -#endif
  4557         -
  4558         -#ifdef SQLITE_OMIT_VIRTUALTABLE
  4559         -  Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY);
  4560         -#else
  4561         -  Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
  4562         -#endif
  4563         -
  4564         -#ifdef SQLITE_DEFAULT_FILE_FORMAT
  4565         -  Tcl_ObjSetVar2(interp, 
  4566         -      Tcl_NewStringObj("sqlite_default_file_format", -1), 0, 
  4567         -      Tcl_NewIntObj(SQLITE_DEFAULT_FILE_FORMAT), TCL_GLOBAL_ONLY
  4568         -  );
  4569         -#endif
  4570         -#ifdef SQLITE_MAX_PAGE_SIZE
  4571         -  Tcl_ObjSetVar2(interp, 
  4572         -      Tcl_NewStringObj("SQLITE_MAX_PAGE_SIZE", -1), 0, 
  4573         -      Tcl_NewIntObj(SQLITE_MAX_PAGE_SIZE), TCL_GLOBAL_ONLY
  4574         -  );
  4575         -#endif
  4576         -#ifdef TEMP_STORE
  4577         -  Tcl_ObjSetVar2(interp, 
  4578         -      Tcl_NewStringObj("TEMP_STORE", -1), 0, 
  4579         -      Tcl_NewIntObj(TEMP_STORE), TCL_GLOBAL_ONLY
  4580         -  );
  4581         -#endif
  4582         -}
  4583         -
  4584   4222   /*
  4585   4223   ** tclcmd:   working_64bit_int
  4586   4224   **
  4587   4225   ** Some TCL builds (ex: cygwin) do not support 64-bit integers.  This
  4588   4226   ** leads to a number of test failures.  The present command checks the
  4589   4227   ** TCL build to see whether or not it supports 64-bit integers.  It
  4590   4228   ** returns TRUE if it does and FALSE if not.
................................................................................
  4896   4534         (char*)&bitmask_size, TCL_LINK_INT|TCL_LINK_READ_ONLY);
  4897   4535   #if OS_UNIX
  4898   4536     Tcl_LinkVar(interp, "sqlite_sync_count",
  4899   4537         (char*)&sqlite3_sync_count, TCL_LINK_INT);
  4900   4538     Tcl_LinkVar(interp, "sqlite_fullsync_count",
  4901   4539         (char*)&sqlite3_fullsync_count, TCL_LINK_INT);
  4902   4540   #endif /* OS_UNIX */
  4903         -  set_options(interp);
  4904   4541   
  4905   4542     return TCL_OK;
  4906   4543   }

Added src/test_config.c.

            1  +/*
            2  +** 2007 May 7
            3  +**
            4  +** The author disclaims copyright to this source code.  In place of
            5  +** a legal notice, here is a blessing:
            6  +**
            7  +**    May you do good and not evil.
            8  +**    May you find forgiveness for yourself and forgive others.
            9  +**    May you share freely, never taking more than you give.
           10  +**
           11  +*************************************************************************
           12  +** 
           13  +** This file contains code used for testing the SQLite system.
           14  +** None of the code in this file goes into a deliverable build.
           15  +** 
           16  +** The focus of this file is providing the TCL testing layer
           17  +** access to compile-time constants.
           18  +**
           19  +** $Id: test_config.c,v 1.1 2007/05/08 01:08:49 drh Exp $
           20  +*/
           21  +#include "sqliteInt.h"
           22  +#include "tcl.h"
           23  +#include "os.h"
           24  +#include <stdlib.h>
           25  +#include <string.h>
           26  +
           27  +/*
           28  +** This routine sets entries in the global ::sqlite_options() array variable
           29  +** according to the compile-time configuration of the database.  Test
           30  +** procedures use this to determine when tests should be omitted.
           31  +*/
           32  +static void set_options(Tcl_Interp *interp){
           33  +#ifdef SQLITE_32BIT_ROWID
           34  +  Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY);
           35  +#else
           36  +  Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY);
           37  +#endif
           38  +
           39  +#ifdef SQLITE_CASE_SENSITIVE_LIKE
           40  +  Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY);
           41  +#else
           42  +  Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
           43  +#endif
           44  +
           45  +#ifdef SQLITE_DISABLE_DIRSYNC
           46  +  Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
           47  +#else
           48  +  Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
           49  +#endif
           50  +
           51  +#ifdef SQLITE_DISABLE_LFS
           52  +  Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
           53  +#else
           54  +  Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
           55  +#endif
           56  +
           57  +#ifdef SQLITE_OMIT_ALTERTABLE
           58  +  Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
           59  +#else
           60  +  Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
           61  +#endif
           62  +
           63  +#ifdef SQLITE_OMIT_ANALYZE
           64  +  Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
           65  +#else
           66  +  Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
           67  +#endif
           68  +
           69  +#ifdef SQLITE_OMIT_ATTACH
           70  +  Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY);
           71  +#else
           72  +  Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY);
           73  +#endif
           74  +
           75  +#ifdef SQLITE_OMIT_AUTHORIZATION
           76  +  Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
           77  +#else
           78  +  Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY);
           79  +#endif
           80  +
           81  +#ifdef SQLITE_OMIT_AUTOINCREMENT
           82  +  Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY);
           83  +#else
           84  +  Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY);
           85  +#endif
           86  +
           87  +#ifdef SQLITE_OMIT_AUTOVACUUM
           88  +  Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
           89  +#else
           90  +  Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY);
           91  +#endif /* SQLITE_OMIT_AUTOVACUUM */
           92  +#if !defined(SQLITE_DEFAULT_AUTOVACUUM) || SQLITE_DEFAULT_AUTOVACUUM==0
           93  +  Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY);
           94  +#else
           95  +  Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","1",TCL_GLOBAL_ONLY);
           96  +#endif
           97  +
           98  +#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
           99  +  Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY);
          100  +#else
          101  +  Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY);
          102  +#endif
          103  +
          104  +#ifdef SQLITE_OMIT_BLOB_LITERAL
          105  +  Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY);
          106  +#else
          107  +  Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
          108  +#endif
          109  +
          110  +#ifdef SQLITE_OMIT_CAST
          111  +  Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY);
          112  +#else
          113  +  Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY);
          114  +#endif
          115  +
          116  +#ifdef SQLITE_OMIT_CHECK
          117  +  Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY);
          118  +#else
          119  +  Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY);
          120  +#endif
          121  +
          122  +#ifdef SQLITE_ENABLE_COLUMN_METADATA
          123  +  Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY);
          124  +#else
          125  +  Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY);
          126  +#endif
          127  +
          128  +#ifdef SQLITE_OMIT_COMPLETE
          129  +  Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY);
          130  +#else
          131  +  Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY);
          132  +#endif
          133  +
          134  +#ifdef SQLITE_OMIT_COMPOUND_SELECT
          135  +  Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
          136  +#else
          137  +  Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
          138  +#endif
          139  +
          140  +#ifdef SQLITE_OMIT_CONFLICT_CLAUSE
          141  +  Tcl_SetVar2(interp, "sqlite_options", "conflict", "0", TCL_GLOBAL_ONLY);
          142  +#else
          143  +  Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
          144  +#endif
          145  +
          146  +#if OS_UNIX
          147  +  Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
          148  +#else
          149  +  Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY);
          150  +#endif
          151  +
          152  +#ifdef SQLITE_OMIT_DATETIME_FUNCS
          153  +  Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY);
          154  +#else
          155  +  Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY);
          156  +#endif
          157  +
          158  +#ifdef SQLITE_OMIT_DISKIO
          159  +  Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY);
          160  +#else
          161  +  Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY);
          162  +#endif
          163  +
          164  +#ifdef SQLITE_OMIT_EXPLAIN
          165  +  Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY);
          166  +#else
          167  +  Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY);
          168  +#endif
          169  +
          170  +#ifdef SQLITE_OMIT_FLOATING_POINT
          171  +  Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY);
          172  +#else
          173  +  Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY);
          174  +#endif
          175  +
          176  +#ifdef SQLITE_OMIT_FOREIGN_KEY
          177  +  Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY);
          178  +#else
          179  +  Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
          180  +#endif
          181  +
          182  +#ifdef SQLITE_ENABLE_FTS1
          183  +  Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY);
          184  +#else
          185  +  Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY);
          186  +#endif
          187  +
          188  +#ifdef SQLITE_ENABLE_FTS2
          189  +  Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY);
          190  +#else
          191  +  Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY);
          192  +#endif
          193  +
          194  +#ifdef SQLITE_OMIT_GLOBALRECOVER
          195  +  Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "0", TCL_GLOBAL_ONLY);
          196  +#else
          197  +  Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "1", TCL_GLOBAL_ONLY);
          198  +#endif
          199  +
          200  +#ifdef SQLITE_ENABLE_ICU
          201  +  Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
          202  +#else
          203  +  Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY);
          204  +#endif
          205  +
          206  +#ifdef SQLITE_OMIT_INCRBLOB
          207  +  Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY);
          208  +#else
          209  +  Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY);
          210  +#endif /* SQLITE_OMIT_AUTOVACUUM */
          211  +
          212  +#ifdef SQLITE_OMIT_INTEGRITY_CHECK
          213  +  Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
          214  +#else
          215  +  Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY);
          216  +#endif
          217  +
          218  +#if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1
          219  +  Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY);
          220  +#else
          221  +  Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY);
          222  +#endif
          223  +
          224  +#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
          225  +  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY);
          226  +#else
          227  +  Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY);
          228  +#endif
          229  +
          230  +#ifdef SQLITE_OMIT_LOAD_EXTENSION
          231  +  Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY);
          232  +#else
          233  +  Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY);
          234  +#endif
          235  +
          236  +#ifdef SQLITE_OMIT_MEMORYDB
          237  +  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY);
          238  +#else
          239  +  Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY);
          240  +#endif
          241  +
          242  +#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
          243  +  Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY);
          244  +#else
          245  +  Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY);
          246  +#endif
          247  +
          248  +#ifdef SQLITE_OMIT_OR_OPTIMIZATION
          249  +  Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY);
          250  +#else
          251  +  Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY);
          252  +#endif
          253  +
          254  +#ifdef SQLITE_OMIT_PAGER_PRAGMAS
          255  +  Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY);
          256  +#else
          257  +  Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY);
          258  +#endif
          259  +
          260  +#ifdef SQLITE_OMIT_PARSER
          261  +  Tcl_SetVar2(interp, "sqlite_options", "parser", "0", TCL_GLOBAL_ONLY);
          262  +#else
          263  +  Tcl_SetVar2(interp, "sqlite_options", "parser", "1", TCL_GLOBAL_ONLY);
          264  +#endif
          265  +
          266  +#if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS)
          267  +  Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY);
          268  +  Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY);
          269  +#else
          270  +  Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY);
          271  +#endif
          272  +
          273  +#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
          274  +  Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY);
          275  +#else
          276  +  Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY);
          277  +#endif
          278  +
          279  +#ifdef SQLITE_ENABLE_REDEF_IO
          280  +  Tcl_SetVar2(interp, "sqlite_options", "redefio", "1", TCL_GLOBAL_ONLY);
          281  +#else
          282  +  Tcl_SetVar2(interp, "sqlite_options", "redefio", "0", TCL_GLOBAL_ONLY);
          283  +#endif
          284  +
          285  +#ifdef SQLITE_OMIT_REINDEX
          286  +  Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
          287  +#else
          288  +  Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
          289  +#endif
          290  +
          291  +#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
          292  +  Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY);
          293  +#else
          294  +  Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY);
          295  +#endif
          296  +
          297  +#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
          298  +  Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY);
          299  +#else
          300  +  Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY);
          301  +#endif
          302  +
          303  +#ifdef SQLITE_OMIT_SHARED_CACHE
          304  +  Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY);
          305  +#else
          306  +  Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY);
          307  +#endif
          308  +
          309  +#ifdef SQLITE_OMIT_SUBQUERY
          310  +  Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY);
          311  +#else
          312  +  Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY);
          313  +#endif
          314  +
          315  +#ifdef SQLITE_OMIT_TCL_VARIABLE
          316  +  Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY);
          317  +#else
          318  +  Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
          319  +#endif
          320  +
          321  +#if defined(THREADSAFE) && THREADSAFE
          322  +  Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY);
          323  +#else
          324  +  Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "0", TCL_GLOBAL_ONLY);
          325  +#endif
          326  +
          327  +#ifdef SQLITE_OMIT_TRACE
          328  +  Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
          329  +#else
          330  +  Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
          331  +#endif
          332  +
          333  +#ifdef SQLITE_OMIT_TRIGGER
          334  +  Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
          335  +#else
          336  +  Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
          337  +#endif
          338  +
          339  +#ifdef SQLITE_OMIT_TEMPDB
          340  +  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
          341  +#else
          342  +  Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
          343  +#endif
          344  +
          345  +#ifdef SQLITE_OMIT_UTF16
          346  +  Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
          347  +#else
          348  +  Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY);
          349  +#endif
          350  +
          351  +#if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH)
          352  +  Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY);
          353  +#else
          354  +  Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY);
          355  +#endif
          356  +
          357  +#ifdef SQLITE_OMIT_VIEW
          358  +  Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY);
          359  +#else
          360  +  Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY);
          361  +#endif
          362  +
          363  +#ifdef SQLITE_OMIT_VIRTUALTABLE
          364  +  Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY);
          365  +#else
          366  +  Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
          367  +#endif
          368  +
          369  +  {
          370  +    static int sqlite_max_length = SQLITE_MAX_LENGTH;
          371  +    Tcl_LinkVar(interp, "SQLITE_MAX_LENGTH",
          372  +           (char*)&sqlite_max_length, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          373  +  }
          374  +  {
          375  +    static int sqlite_max_column = SQLITE_MAX_COLUMN;
          376  +    Tcl_LinkVar(interp, "SQLITE_MAX_COLUMN",
          377  +           (char*)&sqlite_max_column, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          378  +  }
          379  +  {
          380  +    static int sqlite_max_expr_length = SQLITE_MAX_EXPR_LENGTH;
          381  +    Tcl_LinkVar(interp, "SQLITE_MAX_EXPR_LENGTH",
          382  +           (char*)&sqlite_max_expr_length, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          383  +  }
          384  +  {
          385  +    static int sqlite_max_vdbe_op = SQLITE_MAX_VDBE_OP;
          386  +    Tcl_LinkVar(interp, "SQLITE_MAX_VDBE_OP",
          387  +           (char*)&sqlite_max_vdbe_op, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          388  +  }
          389  +  {
          390  +    static int sqlite_max_function_arg = SQLITE_MAX_FUNCTION_ARG;
          391  +    Tcl_LinkVar(interp, "SQLITE_MAX_FUNCTION_ARG",
          392  +           (char*)&sqlite_max_function_arg, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          393  +  }
          394  +  {
          395  +    static int sqlite_default_temp_cache_size = SQLITE_DEFAULT_TEMP_CACHE_SIZE;
          396  +    Tcl_LinkVar(interp, "SQLITE_DEFAULT_TEMP_CACHE_SIZE",
          397  +           (char*)&sqlite_default_temp_cache_size,
          398  +           TCL_LINK_INT|TCL_LINK_READ_ONLY);
          399  +  }
          400  +  {
          401  +    static int sqlite_default_cache_size = SQLITE_DEFAULT_CACHE_SIZE;
          402  +    Tcl_LinkVar(interp, "SQLITE_DEFAULT_CACHE_SIZE",
          403  +           (char*)&sqlite_default_cache_size, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          404  +  }
          405  +  {
          406  +    static int sqlite_max_variable_number = SQLITE_MAX_VARIABLE_NUMBER;
          407  +    Tcl_LinkVar(interp, "SQLITE_MAX_VARIABLE_NUMBER",
          408  +           (char*)&sqlite_max_variable_number, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          409  +  }
          410  +  {
          411  +    static int sqlite_default_page_size = SQLITE_DEFAULT_PAGE_SIZE;
          412  +    Tcl_LinkVar(interp, "SQLITE_DEFAULT_PAGE_SIZE",
          413  +           (char*)&sqlite_default_page_size, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          414  +  }
          415  +  {
          416  +    static int sqlite_max_page_size = SQLITE_MAX_PAGE_SIZE;
          417  +    Tcl_LinkVar(interp, "SQLITE_MAX_PAGE_SIZE",
          418  +           (char*)&sqlite_max_page_size, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          419  +  }
          420  +  {
          421  +    static int sqlite_max_page_count = SQLITE_MAX_PAGE_COUNT;
          422  +    Tcl_LinkVar(interp, "SQLITE_MAX_PAGE_COUNT",
          423  +           (char*)&sqlite_max_page_count, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          424  +  }
          425  +  {
          426  +    static int temp_store = TEMP_STORE;
          427  +    Tcl_LinkVar(interp, "TEMP_STORE",
          428  +           (char*)&temp_store, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          429  +  }
          430  +  {
          431  +    static int sqlite_default_file_format = SQLITE_DEFAULT_FILE_FORMAT;
          432  +    Tcl_LinkVar(interp, "SQLITE_DEFAULT_FILE_FORMAT",
          433  +           (char*)&sqlite_default_file_format, TCL_LINK_INT|TCL_LINK_READ_ONLY);
          434  +  }
          435  +}
          436  +
          437  +
          438  +/*
          439  +** Register commands with the TCL interpreter.
          440  +*/
          441  +int Sqliteconfig_Init(Tcl_Interp *interp){
          442  +  set_options(interp);
          443  +  return TCL_OK;
          444  +}

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.607 2007/05/04 18:30:41 drh Exp $
           46  +** $Id: vdbe.c,v 1.608 2007/05/08 01:08:49 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   /*
................................................................................
  2746   2746   case OP_OpenEphemeral: {       /* no-push */
  2747   2747     int i = pOp->p1;
  2748   2748     Cursor *pCx;
  2749   2749     assert( i>=0 );
  2750   2750     pCx = allocateCursor(p, i, -1);
  2751   2751     if( pCx==0 ) goto no_mem;
  2752   2752     pCx->nullRow = 1;
  2753         -  rc = sqlite3BtreeFactory(db, 0, 1, TEMP_PAGES, &pCx->pBt);
         2753  +  rc = sqlite3BtreeFactory(db, 0, 1, SQLITE_DEFAULT_TEMP_CACHE_SIZE, &pCx->pBt);
  2754   2754     if( rc==SQLITE_OK ){
  2755   2755       rc = sqlite3BtreeBeginTrans(pCx->pBt, 1);
  2756   2756     }
  2757   2757     if( rc==SQLITE_OK ){
  2758   2758       /* If a transient index is required, create it by calling
  2759   2759       ** sqlite3BtreeCreateTable() with the BTREE_ZERODATA flag before
  2760   2760       ** opening it. If a transient table is required, just use the

Changes to test/alter2.test.

     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing that SQLite can handle a subtle 
    13     13   # file format change that may be used in the future to implement
    14     14   # "ALTER TABLE ... ADD COLUMN".
    15     15   #
    16         -# $Id: alter2.test,v 1.7 2007/04/02 12:29:01 danielk1977 Exp $
           16  +# $Id: alter2.test,v 1.8 2007/05/08 01:08:49 drh Exp $
    17     17   #
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
    21     21   
    22     22   # We have to have pragmas in order to do this test
    23     23   ifcapable {!pragma} return
................................................................................
   254    254     sqlite3_errcode $::DB
   255    255   } {SQLITE_ERROR}
   256    256   
   257    257   #---------------------------------------------------------------------
   258    258   # Check that executing VACUUM on a file with file-format version 2
   259    259   # resets the file format to 1.
   260    260   #
   261         -set default_file_format [expr $sqlite_default_file_format==4 ? 4 : 1]
          261  +set default_file_format [expr $SQLITE_DEFAULT_FILE_FORMAT==4 ? 4 : 1]
   262    262   do_test alter2-5.1 {
   263    263     set_file_format 2
   264    264     get_file_format
   265    265   } {2}
   266    266   do_test alter2-5.2 {
   267    267     execsql {
   268    268       VACUUM;