diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/attach.c | 9 | ||||
-rw-r--r-- | src/build.c | 7 | ||||
-rw-r--r-- | src/limits.h | 132 | ||||
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/pager.h | 28 | ||||
-rw-r--r-- | src/pragma.c | 4 | ||||
-rw-r--r-- | src/prepare.c | 4 | ||||
-rw-r--r-- | src/sqlite.h.in | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 38 | ||||
-rw-r--r-- | src/tclsqlite.c | 4 | ||||
-rw-r--r-- | src/test1.c | 365 | ||||
-rw-r--r-- | src/test_config.c | 444 | ||||
-rw-r--r-- | src/vdbe.c | 4 |
13 files changed, 605 insertions, 443 deletions
diff --git a/src/attach.c b/src/attach.c index b25eed250..c5f539a9f 100644 --- a/src/attach.c +++ b/src/attach.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** -** $Id: attach.c,v 1.58 2007/05/04 13:15:56 drh Exp $ +** $Id: attach.c,v 1.59 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" @@ -83,9 +83,10 @@ static void attachFunc( ** * Transaction currently open ** * Specified database name already being used. */ - if( db->nDb>=MAX_ATTACHED+2 ){ + if( db->nDb>=SQLITE_MAX_ATTACHED+2 ){ sqlite3_snprintf( - sizeof(zErr), zErr, "too many attached databases - max %d", MAX_ATTACHED + sizeof(zErr), zErr, "too many attached databases - max %d", + SQLITE_MAX_ATTACHED ); goto attach_error; } @@ -125,7 +126,7 @@ static void attachFunc( ** it to obtain the database schema. At this point the schema may ** or may not be initialised. */ - rc = sqlite3BtreeFactory(db, zFile, 0, MAX_PAGES, &aNew->pBt); + rc = sqlite3BtreeFactory(db, zFile, 0, SQLITE_DEFAULT_CACHE_SIZE, &aNew->pBt); if( rc==SQLITE_OK ){ aNew->pSchema = sqlite3SchemaGet(aNew->pBt); if( !aNew->pSchema ){ diff --git a/src/build.c b/src/build.c index c28f789ab..60f910fad 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.425 2007/05/04 18:30:41 drh Exp $ +** $Id: build.c,v 1.426 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -3093,7 +3093,8 @@ void sqlite3RollbackTransaction(Parse *pParse){ int sqlite3OpenTempDatabase(Parse *pParse){ sqlite3 *db = pParse->db; if( db->aDb[1].pBt==0 && !pParse->explain ){ - int rc = sqlite3BtreeFactory(db, 0, 0, MAX_PAGES, &db->aDb[1].pBt); + int rc = sqlite3BtreeFactory(db, 0, 0, SQLITE_DEFAULT_CACHE_SIZE, + &db->aDb[1].pBt); if( rc!=SQLITE_OK ){ sqlite3ErrorMsg(pParse, "unable to open a temporary database " "file for storing temporary tables"); @@ -3150,7 +3151,7 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ if( iDb>=0 ){ assert( iDb<db->nDb ); assert( db->aDb[iDb].pBt!=0 || iDb==1 ); - assert( iDb<MAX_ATTACHED+2 ); + assert( iDb<SQLITE_MAX_ATTACHED+2 ); mask = 1<<iDb; if( (pParse->cookieMask & mask)==0 ){ pParse->cookieMask |= mask; diff --git a/src/limits.h b/src/limits.h new file mode 100644 index 000000000..64b2c2a78 --- /dev/null +++ b/src/limits.h @@ -0,0 +1,132 @@ +/* +** 2007 May 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file defines various limits of what SQLite can process. +** +** @(#) $Id: limits.h,v 1.1 2007/05/08 01:08:49 drh Exp $ +*/ + +/* +** The maximum length of a TEXT or BLOB in bytes. This also +** limits the size of a row in a table or index. +** +** The hard limit is the ability of a 32-bit signed integer +** to count the size: 2^31-1 or 2147483647. +*/ +#ifndef SQLITE_MAX_LENGTH +# define SQLITE_MAX_LENGTH 1000000000 +#endif + +/* +** This is the maximum number of +** +** * Columns in a table +** * Columns in an index +** * Columns in a view +** * Terms in the SET clause of an UPDATE statement +** * Terms in the result set of a SELECT statement +** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. +** * Terms in the VALUES clause of an INSERT statement +** +** The hard upper limit here is 32676. Most database people will +** tell you that in a well-normalized database, you usually should +** not have more than a dozen or so columns in any table. And if +** that is the case, there is no point in having more than a few +** dozen values in any of the other situations described above. +*/ +#ifndef SQLITE_MAX_COLUMN +# define SQLITE_MAX_COLUMN 1000 +#endif + +/* +** The maximum length of a single SQL statement in bytes. +** The hard limit here is the same as SQLITE_MAX_LENGTH. +*/ +#ifndef SQLITE_MAX_SQL_LENGTH +# define SQLITE_MAX_SQL_LENGTH 1000000 +#endif + +/* +** The maximum number of terms in an expression. +** This is limited to some extent by SQLITE_MAX_SQL_LENGTH. +** But sometime you might want to place more severe limits +** on the complexity of an expression. +*/ +#ifndef SQLITE_MAX_EXPR_LENGTH +# define SQLITE_MAX_EXPR_LENGTH 5000 +#endif + +/* +** The maximum number of opcodes in a VDBE program. +*/ +#ifndef SQLITE_MAX_VDBE_OP +# define SQLITE_MAX_VDBE_OP 25000 +#endif + +/* +** The maximum number of arguments to an SQL function. +*/ +#ifndef SQLITE_MAX_FUNCTION_ARG +# define SQLITE_MAX_FUNCTION_ARG 100 +#endif + +/* +** The maximum number of in-memory pages to use for the main database +** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE +*/ +#ifndef SQLITE_DEFAULT_CACHE_SIZE +# define SQLITE_DEFAULT_CACHE_SIZE 2000 +#endif +#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE +# define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500 +#endif + +/* +** The maximum number of attached databases. This must be at least 2 +** in order to support the main database file (0) and the file used to +** hold temporary tables (1). And it must be less than 32 because +** we use a bitmask of databases with a u32 in places (for example +** the Parse.cookieMask field). +*/ +#ifndef SQLITE_MAX_ATTACHED +# define SQLITE_MAX_ATTACHED 10 +#endif + + +/* +** The maximum value of a ?nnn wildcard that the parser will accept. +*/ +#ifndef SQLITE_MAX_VARIABLE_NUMBER +# define SQLITE_MAX_VARIABLE_NUMBER 999 +#endif + +/* +** The default size of a database page. +*/ +#ifndef SQLITE_DEFAULT_PAGE_SIZE +# define SQLITE_DEFAULT_PAGE_SIZE 1024 +#endif + +/* Maximum page size. The upper bound on this value is 32768. This a limit +** imposed by the necessity of storing the value in a 2-byte unsigned integer +** and the fact that the page size must be a power of 2. +*/ +#ifndef SQLITE_MAX_PAGE_SIZE +# define SQLITE_MAX_PAGE_SIZE 32768 +#endif + +/* +** Maximum number of pages in one database file. +*/ +#ifndef SQLITE_MAX_PAGE_COUNT +# define SQLITE_MAX_PAGE_COUNT 1073741823 +#endif diff --git a/src/main.c b/src/main.c index 506c3c78c..6e9122104 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.373 2007/05/07 14:58:53 danielk1977 Exp $ +** $Id: main.c,v 1.374 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -964,7 +964,8 @@ static int openDatabase( } /* Open the backend database driver */ - rc = sqlite3BtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt); + rc = sqlite3BtreeFactory(db, zFilename, 0, SQLITE_DEFAULT_CACHE_SIZE, + &db->aDb[0].pBt); if( rc!=SQLITE_OK ){ sqlite3Error(db, rc, 0); db->magic = SQLITE_MAGIC_CLOSED; diff --git a/src/pager.h b/src/pager.h index 96b0cd342..59c54255f 100644 --- a/src/pager.h +++ b/src/pager.h @@ -13,39 +13,13 @@ ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** -** @(#) $Id: pager.h,v 1.58 2007/04/13 02:14:30 drh Exp $ +** @(#) $Id: pager.h,v 1.59 2007/05/08 01:08:49 drh Exp $ */ #ifndef _PAGER_H_ #define _PAGER_H_ /* -** The default size of a database page. -*/ -#ifndef SQLITE_DEFAULT_PAGE_SIZE -# define SQLITE_DEFAULT_PAGE_SIZE 1024 -#endif - -/* Maximum page size. The upper bound on this value is 32768. This a limit -** imposed by necessity of storing the value in a 2-byte unsigned integer -** and the fact that the page size must be a power of 2. -** -** This value is used to initialize certain arrays on the stack at -** various places in the code. On embedded machines where stack space -** is limited and the flexibility of having large pages is not needed, -** it makes good sense to reduce the maximum page size to something more -** reasonable, like 1024. -*/ -#ifndef SQLITE_MAX_PAGE_SIZE -# define SQLITE_MAX_PAGE_SIZE 32768 -#endif - -/* -** Maximum number of pages in one database. -*/ -#define SQLITE_MAX_PAGE 1073741823 - -/* ** The type used to represent a page number. The first page in a file ** is called page 1. 0 is used to represent "not a page". */ diff --git a/src/pragma.c b/src/pragma.c index 22720d919..c329ea8f6 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.134 2007/05/04 18:30:41 drh Exp $ +** $Id: pragma.c,v 1.135 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -309,7 +309,7 @@ void sqlite3Pragma( sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cache_size", P3_STATIC); addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize); sqlite3VdbeChangeP1(v, addr, iDb); - sqlite3VdbeChangeP1(v, addr+5, MAX_PAGES); + sqlite3VdbeChangeP1(v, addr+5, SQLITE_DEFAULT_CACHE_SIZE); }else{ int size = atoi(zRight); if( size<0 ) size = -size; diff --git a/src/prepare.c b/src/prepare.c index c711c2f7a..7b4bfe963 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -13,7 +13,7 @@ ** interface, and routines that contribute to loading the database schema ** from disk. ** -** $Id: prepare.c,v 1.47 2007/04/30 21:39:16 drh Exp $ +** $Id: prepare.c,v 1.48 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -261,7 +261,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){ pDb->pSchema->enc = ENC(db); size = meta[2]; - if( size==0 ){ size = MAX_PAGES; } + if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; } pDb->pSchema->cache_size = size; sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f0f0544fa..2a7c4e973 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.206 2007/05/07 14:58:53 danielk1977 Exp $ +** @(#) $Id: sqlite.h.in,v 1.207 2007/05/08 01:08:49 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -185,7 +185,7 @@ int sqlite3_exec( #define SQLITE_PROTOCOL 15 /* NOT USED. Database lock protocol error */ #define SQLITE_EMPTY 16 /* Database is empty */ #define SQLITE_SCHEMA 17 /* The database schema changed */ -#define SQLITE_TOOBIG 18 /* NOT USED. Too much data for one row */ +#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ #define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */ #define SQLITE_MISMATCH 20 /* Data type mismatch */ #define SQLITE_MISUSE 21 /* Library used incorrectly */ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 374f1ebe1..36079f5b0 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,10 +11,12 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.558 2007/05/07 09:32:45 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.559 2007/05/08 01:08:49 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ +#include "limits.h" + #if defined(SQLITE_TCL) || defined(TCLSH) # include <tcl.h> @@ -82,24 +84,6 @@ #endif /* -** The maximum number of in-memory pages to use for the main database -** table and for temporary tables. Internally, the MAX_PAGES and -** TEMP_PAGES macros are used. To override the default values at -** compilation time, the SQLITE_DEFAULT_CACHE_SIZE and -** SQLITE_DEFAULT_TEMP_CACHE_SIZE macros should be set. -*/ -#ifdef SQLITE_DEFAULT_CACHE_SIZE -# define MAX_PAGES SQLITE_DEFAULT_CACHE_SIZE -#else -# define MAX_PAGES 2000 -#endif -#ifdef SQLITE_DEFAULT_TEMP_CACHE_SIZE -# define TEMP_PAGES SQLITE_DEFAULT_TEMP_CACHE_SIZE -#else -# define TEMP_PAGES 500 -#endif - -/* ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 ** afterward. Having this macro allows us to cause the C compiler ** to omit code used by TEMP tables without messy #ifndef statements. @@ -125,20 +109,6 @@ #define NULL_DISTINCT_FOR_UNIQUE 1 /* -** The maximum number of attached databases. This must be at least 2 -** in order to support the main database file (0) and the file used to -** hold temporary tables (1). And it must be less than 32 because -** we use a bitmask of databases with a u32 in places (for example -** the Parse.cookieMask field). -*/ -#define MAX_ATTACHED 10 - -/* -** The maximum value of a ?nnn wildcard that the parser will accept. -*/ -#define SQLITE_MAX_VARIABLE_NUMBER 999 - -/* ** The "file format" number is an integer that is incremented whenever ** the VDBE-level file format changes. The following macros define the ** the default file format for new databases and the maximum file format @@ -1345,7 +1315,7 @@ struct Parse { u32 writeMask; /* Start a write transaction on these databases */ u32 cookieMask; /* Bitmask of schema verified databases */ int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ - int cookieValue[MAX_ATTACHED+2]; /* Values of cookies to verify */ + int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ #ifndef SQLITE_OMIT_SHARED_CACHE int nTableLock; /* Number of locks in aTableLock */ TableLock *aTableLock; /* Required table locks for shared-cache mode */ diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 59d301933..bca6ed398 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -12,7 +12,7 @@ ** A TCL Interface to SQLite. Append this file to sqlite3.c and ** compile the whole thing to build a TCL-enabled version of SQLite. ** -** $Id: tclsqlite.c,v 1.186 2007/05/04 19:03:03 danielk1977 Exp $ +** $Id: tclsqlite.c,v 1.187 2007/05/08 01:08:49 drh Exp $ */ #include "tcl.h" #include <errno.h> @@ -2497,6 +2497,7 @@ int TCLSH_MAIN(int argc, char **argv){ extern int Sqlitetestschema_Init(Tcl_Interp*); extern int Sqlitetest_autoext_Init(Tcl_Interp*); extern int Sqlitetest_hexio_Init(Tcl_Interp*); + extern int Sqliteconfig_Init(Tcl_Interp*); Sqlitetest1_Init(interp); Sqlitetest2_Init(interp); @@ -2512,6 +2513,7 @@ int TCLSH_MAIN(int argc, char **argv){ Sqlitetestschema_Init(interp); Sqlitetest_autoext_Init(interp); Sqlitetest_hexio_Init(interp); + Sqliteconfig_Init(interp); Md5_Init(interp); #ifdef SQLITE_SSE Sqlitetestsse_Init(interp); diff --git a/src/test1.c b/src/test1.c index a0917508e..47f190938 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.250 2007/05/07 14:58:53 danielk1977 Exp $ +** $Id: test1.c,v 1.251 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -4220,368 +4220,6 @@ static int test_pager_refcounts( /* -** This routine sets entries in the global ::sqlite_options() array variable -** according to the compile-time configuration of the database. Test -** procedures use this to determine when tests should be omitted. -*/ -static void set_options(Tcl_Interp *interp){ -#ifdef SQLITE_32BIT_ROWID - Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_CASE_SENSITIVE_LIKE - Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_DISABLE_DIRSYNC - Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_DISABLE_LFS - Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_ALTERTABLE - Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_ANALYZE - Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_ATTACH - Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_AUTHORIZATION - Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_AUTOINCREMENT - Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_AUTOVACUUM - Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY); -#endif /* SQLITE_OMIT_AUTOVACUUM */ -#if !defined(SQLITE_DEFAULT_AUTOVACUUM) || SQLITE_DEFAULT_AUTOVACUUM==0 - Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","1",TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION - Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_BLOB_LITERAL - Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_CAST - Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_CHECK - Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_ENABLE_COLUMN_METADATA - Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_COMPLETE - Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_COMPOUND_SELECT - Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_CONFLICT_CLAUSE - Tcl_SetVar2(interp, "sqlite_options", "conflict", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY); -#endif - -#if OS_UNIX - Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_DATETIME_FUNCS - Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_DISKIO - Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_EXPLAIN - Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_FLOATING_POINT - Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_FOREIGN_KEY - Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_ENABLE_FTS1 - Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_ENABLE_FTS2 - Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_GLOBALRECOVER - Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_ENABLE_ICU - Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_INCRBLOB - Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY); -#endif /* SQLITE_OMIT_AUTOVACUUM */ - -#ifdef SQLITE_OMIT_INTEGRITY_CHECK - Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY); -#endif - -#if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1 - Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION - Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_LOAD_EXTENSION - Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_MEMORYDB - Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_OR_OPTIMIZATION - Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_PAGER_PRAGMAS - Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_PARSER - Tcl_SetVar2(interp, "sqlite_options", "parser", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "parser", "1", TCL_GLOBAL_ONLY); -#endif - -#if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS) - Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY); - Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK - Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_ENABLE_REDEF_IO - Tcl_SetVar2(interp, "sqlite_options", "redefio", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "redefio", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_REINDEX - Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS - Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS - Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_SHARED_CACHE - Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_SUBQUERY - Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_TCL_VARIABLE - Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); -#endif - -#if defined(THREADSAFE) && THREADSAFE - Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "0", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_TRACE - Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_TRIGGER - Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_TEMPDB - Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_UTF16 - Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY); -#endif - -#if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH) - Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_VIEW - Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_OMIT_VIRTUALTABLE - Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY); -#endif - -#ifdef SQLITE_DEFAULT_FILE_FORMAT - Tcl_ObjSetVar2(interp, - Tcl_NewStringObj("sqlite_default_file_format", -1), 0, - Tcl_NewIntObj(SQLITE_DEFAULT_FILE_FORMAT), TCL_GLOBAL_ONLY - ); -#endif -#ifdef SQLITE_MAX_PAGE_SIZE - Tcl_ObjSetVar2(interp, - Tcl_NewStringObj("SQLITE_MAX_PAGE_SIZE", -1), 0, - Tcl_NewIntObj(SQLITE_MAX_PAGE_SIZE), TCL_GLOBAL_ONLY - ); -#endif -#ifdef TEMP_STORE - Tcl_ObjSetVar2(interp, - Tcl_NewStringObj("TEMP_STORE", -1), 0, - Tcl_NewIntObj(TEMP_STORE), TCL_GLOBAL_ONLY - ); -#endif -} - -/* ** tclcmd: working_64bit_int ** ** Some TCL builds (ex: cygwin) do not support 64-bit integers. This @@ -4900,7 +4538,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ Tcl_LinkVar(interp, "sqlite_fullsync_count", (char*)&sqlite3_fullsync_count, TCL_LINK_INT); #endif /* OS_UNIX */ - set_options(interp); return TCL_OK; } diff --git a/src/test_config.c b/src/test_config.c new file mode 100644 index 000000000..ff500e302 --- /dev/null +++ b/src/test_config.c @@ -0,0 +1,444 @@ +/* +** 2007 May 7 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file contains code used for testing the SQLite system. +** None of the code in this file goes into a deliverable build. +** +** The focus of this file is providing the TCL testing layer +** access to compile-time constants. +** +** $Id: test_config.c,v 1.1 2007/05/08 01:08:49 drh Exp $ +*/ +#include "sqliteInt.h" +#include "tcl.h" +#include "os.h" +#include <stdlib.h> +#include <string.h> + +/* +** This routine sets entries in the global ::sqlite_options() array variable +** according to the compile-time configuration of the database. Test +** procedures use this to determine when tests should be omitted. +*/ +static void set_options(Tcl_Interp *interp){ +#ifdef SQLITE_32BIT_ROWID + Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_CASE_SENSITIVE_LIKE + Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_DISABLE_DIRSYNC + Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_DISABLE_LFS + Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_ALTERTABLE + Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_ANALYZE + Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_ATTACH + Tcl_SetVar2(interp, "sqlite_options", "attach", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "attach", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_AUTHORIZATION + Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "auth", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_AUTOINCREMENT + Tcl_SetVar2(interp, "sqlite_options", "autoinc", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "autoinc", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_AUTOVACUUM + Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY); +#endif /* SQLITE_OMIT_AUTOVACUUM */ +#if !defined(SQLITE_DEFAULT_AUTOVACUUM) || SQLITE_DEFAULT_AUTOVACUUM==0 + Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","1",TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION + Tcl_SetVar2(interp, "sqlite_options", "between_opt", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "between_opt", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_BLOB_LITERAL + Tcl_SetVar2(interp, "sqlite_options", "bloblit", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_CAST + Tcl_SetVar2(interp, "sqlite_options", "cast", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "cast", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_CHECK + Tcl_SetVar2(interp, "sqlite_options", "check", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "check", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_ENABLE_COLUMN_METADATA + Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "columnmetadata", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_COMPLETE + Tcl_SetVar2(interp, "sqlite_options", "complete", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "complete", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_COMPOUND_SELECT + Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_CONFLICT_CLAUSE + Tcl_SetVar2(interp, "sqlite_options", "conflict", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY); +#endif + +#if OS_UNIX + Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_DATETIME_FUNCS + Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_DISKIO + Tcl_SetVar2(interp, "sqlite_options", "diskio", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "diskio", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_EXPLAIN + Tcl_SetVar2(interp, "sqlite_options", "explain", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "explain", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_FLOATING_POINT + Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "floatingpoint", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_FOREIGN_KEY + Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_ENABLE_FTS1 + Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_ENABLE_FTS2 + Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_GLOBALRECOVER + Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_ENABLE_ICU + Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "icu", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_INCRBLOB + Tcl_SetVar2(interp, "sqlite_options", "incrblob", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "incrblob", "1", TCL_GLOBAL_ONLY); +#endif /* SQLITE_OMIT_AUTOVACUUM */ + +#ifdef SQLITE_OMIT_INTEGRITY_CHECK + Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "integrityck", "1", TCL_GLOBAL_ONLY); +#endif + +#if defined(SQLITE_DEFAULT_FILE_FORMAT) && SQLITE_DEFAULT_FILE_FORMAT==1 + Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "legacyformat", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION + Tcl_SetVar2(interp, "sqlite_options", "like_opt", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "like_opt", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_LOAD_EXTENSION + Tcl_SetVar2(interp, "sqlite_options", "load_ext", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "load_ext", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_MEMORYDB + Tcl_SetVar2(interp, "sqlite_options", "memorydb", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "memorydb", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT + Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "memorymanage", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_OR_OPTIMIZATION + Tcl_SetVar2(interp, "sqlite_options", "or_opt", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "or_opt", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_PAGER_PRAGMAS + Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "pager_pragmas", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_PARSER + Tcl_SetVar2(interp, "sqlite_options", "parser", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "parser", "1", TCL_GLOBAL_ONLY); +#endif + +#if defined(SQLITE_OMIT_PRAGMA) || defined(SQLITE_OMIT_FLAG_PRAGMAS) + Tcl_SetVar2(interp, "sqlite_options", "pragma", "0", TCL_GLOBAL_ONLY); + Tcl_SetVar2(interp, "sqlite_options", "integrityck", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "pragma", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_PROGRESS_CALLBACK + Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_ENABLE_REDEF_IO + Tcl_SetVar2(interp, "sqlite_options", "redefio", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "redefio", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_REINDEX + Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS + Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "schema_pragmas", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS + Tcl_SetVar2(interp, "sqlite_options", "schema_version", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "schema_version", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_SHARED_CACHE + Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "shared_cache", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_SUBQUERY + Tcl_SetVar2(interp, "sqlite_options", "subquery", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "subquery", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_TCL_VARIABLE + Tcl_SetVar2(interp, "sqlite_options", "tclvar", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY); +#endif + +#if defined(THREADSAFE) && THREADSAFE + Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "0", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_TRACE + Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_TRIGGER + Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_TEMPDB + Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_UTF16 + Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "utf16", "1", TCL_GLOBAL_ONLY); +#endif + +#if defined(SQLITE_OMIT_VACUUM) || defined(SQLITE_OMIT_ATTACH) + Tcl_SetVar2(interp, "sqlite_options", "vacuum", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "vacuum", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_VIEW + Tcl_SetVar2(interp, "sqlite_options", "view", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "view", "1", TCL_GLOBAL_ONLY); +#endif + +#ifdef SQLITE_OMIT_VIRTUALTABLE + Tcl_SetVar2(interp, "sqlite_options", "vtab", "0", TCL_GLOBAL_ONLY); +#else + Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY); +#endif + + { + static int sqlite_max_length = SQLITE_MAX_LENGTH; + Tcl_LinkVar(interp, "SQLITE_MAX_LENGTH", + (char*)&sqlite_max_length, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_column = SQLITE_MAX_COLUMN; + Tcl_LinkVar(interp, "SQLITE_MAX_COLUMN", + (char*)&sqlite_max_column, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_expr_length = SQLITE_MAX_EXPR_LENGTH; + Tcl_LinkVar(interp, "SQLITE_MAX_EXPR_LENGTH", + (char*)&sqlite_max_expr_length, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_vdbe_op = SQLITE_MAX_VDBE_OP; + Tcl_LinkVar(interp, "SQLITE_MAX_VDBE_OP", + (char*)&sqlite_max_vdbe_op, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_function_arg = SQLITE_MAX_FUNCTION_ARG; + Tcl_LinkVar(interp, "SQLITE_MAX_FUNCTION_ARG", + (char*)&sqlite_max_function_arg, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_default_temp_cache_size = SQLITE_DEFAULT_TEMP_CACHE_SIZE; + Tcl_LinkVar(interp, "SQLITE_DEFAULT_TEMP_CACHE_SIZE", + (char*)&sqlite_default_temp_cache_size, + TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_default_cache_size = SQLITE_DEFAULT_CACHE_SIZE; + Tcl_LinkVar(interp, "SQLITE_DEFAULT_CACHE_SIZE", + (char*)&sqlite_default_cache_size, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_variable_number = SQLITE_MAX_VARIABLE_NUMBER; + Tcl_LinkVar(interp, "SQLITE_MAX_VARIABLE_NUMBER", + (char*)&sqlite_max_variable_number, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_default_page_size = SQLITE_DEFAULT_PAGE_SIZE; + Tcl_LinkVar(interp, "SQLITE_DEFAULT_PAGE_SIZE", + (char*)&sqlite_default_page_size, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_page_size = SQLITE_MAX_PAGE_SIZE; + Tcl_LinkVar(interp, "SQLITE_MAX_PAGE_SIZE", + (char*)&sqlite_max_page_size, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_max_page_count = SQLITE_MAX_PAGE_COUNT; + Tcl_LinkVar(interp, "SQLITE_MAX_PAGE_COUNT", + (char*)&sqlite_max_page_count, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int temp_store = TEMP_STORE; + Tcl_LinkVar(interp, "TEMP_STORE", + (char*)&temp_store, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } + { + static int sqlite_default_file_format = SQLITE_DEFAULT_FILE_FORMAT; + Tcl_LinkVar(interp, "SQLITE_DEFAULT_FILE_FORMAT", + (char*)&sqlite_default_file_format, TCL_LINK_INT|TCL_LINK_READ_ONLY); + } +} + + +/* +** Register commands with the TCL interpreter. +*/ +int Sqliteconfig_Init(Tcl_Interp *interp){ + set_options(interp); + return TCL_OK; +} diff --git a/src/vdbe.c b/src/vdbe.c index 569a6ef25..fef1993b4 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.607 2007/05/04 18:30:41 drh Exp $ +** $Id: vdbe.c,v 1.608 2007/05/08 01:08:49 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -2750,7 +2750,7 @@ case OP_OpenEphemeral: { /* no-push */ pCx = allocateCursor(p, i, -1); if( pCx==0 ) goto no_mem; pCx->nullRow = 1; - rc = sqlite3BtreeFactory(db, 0, 1, TEMP_PAGES, &pCx->pBt); + rc = sqlite3BtreeFactory(db, 0, 1, SQLITE_DEFAULT_TEMP_CACHE_SIZE, &pCx->pBt); if( rc==SQLITE_OK ){ rc = sqlite3BtreeBeginTrans(pCx->pBt, 1); } |