From c797d4dccd35777b8daf9d1eb6404a738104777b Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 8 May 2007 01:08:49 +0000 Subject: [PATCH] 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) FossilOrigin-Name: 93b623b232a43f78d2c90bfa2389dd5b28ad7280 --- Makefile.in | 2 + main.mk | 2 + manifest | 40 +++-- manifest.uuid | 2 +- src/attach.c | 9 +- src/build.c | 7 +- src/limits.h | 132 ++++++++++++++ src/main.c | 5 +- src/pager.h | 28 +-- src/pragma.c | 4 +- src/prepare.c | 4 +- src/sqlite.h.in | 4 +- src/sqliteInt.h | 38 +--- src/tclsqlite.c | 4 +- src/test1.c | 365 +------------------------------------ src/test_config.c | 444 ++++++++++++++++++++++++++++++++++++++++++++++ src/vdbe.c | 4 +- test/alter2.test | 4 +- 18 files changed, 633 insertions(+), 465 deletions(-) create mode 100644 src/limits.h create mode 100644 src/test_config.c diff --git a/Makefile.in b/Makefile.in index 80cf8e594a..d8c5522404 100644 --- a/Makefile.in +++ b/Makefile.in @@ -225,6 +225,7 @@ TESTSRC = \ $(TOP)/src/test_autoext.c \ $(TOP)/src/test_async.c \ $(TOP)/src/test_btree.c \ + $(TOP)/src/test_config.c \ $(TOP)/src/test_hexio.c \ $(TOP)/src/test_md5.c \ $(TOP)/src/test_schema.c \ @@ -243,6 +244,7 @@ HDR = \ $(TOP)/src/btree.h \ $(TOP)/src/btreeInt.h \ $(TOP)/src/hash.h \ + $(TOP)/src/limits.h \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ diff --git a/main.mk b/main.mk index 2596722096..34b82c6b68 100644 --- a/main.mk +++ b/main.mk @@ -181,6 +181,7 @@ TESTSRC = \ $(TOP)/src/test_autoext.c \ $(TOP)/src/test_async.c \ $(TOP)/src/test_btree.c \ + $(TOP)/src/test_config.c \ $(TOP)/src/test_hexio.c \ $(TOP)/src/test_md5.c \ $(TOP)/src/test_schema.c \ @@ -199,6 +200,7 @@ HDR = \ $(TOP)/src/btree.h \ $(TOP)/src/btreeInt.h \ $(TOP)/src/hash.h \ + $(TOP)/src/limits.h \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ diff --git a/manifest b/manifest index 3c9d5f30c9..9d068bac7a 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ -C Fix\san\sNULL\sderef\sin\sthe\srandomblob()\sfunction\sfollowing\sa\smalloc\sfailure.\s(CVS\s3940) -D 2007-05-07T19:31:16 -F Makefile.in ab0f3cb6b34aa8ccec0bb57e6696fd4bd6b34a8f +C Begin\simplementing\sa\snew\ssystem\sof\supper\sbounds\son\sthe\scapabilities\nof\sSQLite.\s\sBy\sclearly\sdefining\sthe\supper\sbounds,\swe\smake\sthose\nupper\sbounds\sexplicitly\stestable.\s\sThis\scheck-in\sis\sjust\sinfrastructure.\nThe\supper\sbounds\sare\snot\syet\senforced.\s(CVS\s3941) +D 2007-05-08T01:08:49 +F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F VERSION 6de5e9812c227f00155cb59af3535017aef3e258 @@ -46,7 +46,7 @@ F ext/fts2/mkfts2amal.tcl 2a9ec76b0760fe7f3669dca5bc0d60728bc1c977 F ext/icu/icu.c 6b47f5bbaf32bce03112282ecca1f54bec969e42 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387 -F main.mk 09c19ae05ac9e5654d5fd866a980b21ad9df8f30 +F main.mk 4e3bc2b9b069c15c43e4339c0e87eba9388617c1 F mkdll.sh ed62756baf44babf562a7843588790c02fee2106 F mkopcodec.awk bd46ad001c98dfbab07b1713cb8e692fa0e5415d F mkopcodeh.awk cde995d269aa06c94adbf6455bea0acedb913fa5 @@ -59,12 +59,12 @@ F sqlite3.def a96c1d0d39362b763d2ddba220a32da41a15c4b4 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a F src/alter.c 2c79ec40f65e33deaf90ca493422c74586e481a3 F src/analyze.c 4bbf5ddf9680587c6d4917e02e378b6037be3651 -F src/attach.c f088f8155541ff75542239ec40cf05f3d81390ba +F src/attach.c a674f72b5e4a02b81d0ae7e6e14c1a2f48e36491 F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f F src/btree.c 6d3db6416c71f678a4dd4719ce6d754ad5927c46 F src/btree.h 845543b5a53d5d8a80ea14aeeb521276602317b7 F src/btreeInt.h cb3c0e9eb842d06079a62cdf3492c90c5db7ba75 -F src/build.c 0dd6f0d0a5d304be91374f4c7228a3e9b00ff7f1 +F src/build.c 94022eb081e10aa00149762ca5e0ed639673cedf F src/callback.c 9c12535669a638f90a67e10440b99c7b93c0fbf4 F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675 F src/date.c c34a9c86ffd6da4cb3903ea038d977ec539d07e2 @@ -76,8 +76,9 @@ F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 F src/insert.c e595ca26805dfb3a9ebaabc28e7947c479f3b14d F src/legacy.c 388c71ad7fbcd898ba1bcbfc98a3ac954bfa5d01 +F src/limits.h 74b7f201cf75d0cffcfc40757de0e4caeeb1fca1 F src/loadext.c afe4f4755dc49c36ef505748bbdddecb9f1d02a2 -F src/main.c 0e389104acf4a7c26b57f35ee84eecc60a5d6da5 +F src/main.c 00e01d7912e40b81546f4e6ddf7bda54b430dbd1 F src/malloc.c b89e31258a85158d15795bf87ae3ba007e56329b F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/os.c 4650e98aadd27abfe1698ff58edf6893c58d4881 @@ -92,21 +93,21 @@ F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_win.c 3b6169038101d06c54b4f04662bfd44b6cf2f289 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/pager.c 9c9a9df78636f4b9c8e18f90e93337a1231aaef7 -F src/pager.h d652ddf092d2318d00e41f8539760fe8e57c157c +F src/pager.h 236e4065b3ca066e8e3edd43fbdd00e2c71a55d5 F src/parse.y a5bdc301e970ceb3826b56a84898b8966d5353f8 -F src/pragma.c 3f16c1274bc25afb630b61a3630ea19a2fd0b5dc -F src/prepare.c 03277063bc4f5860efbf23548fa0123ac0f6eaec +F src/pragma.c f426fef6b045dec23b1cf2f28397122a50fde109 +F src/prepare.c b35a6f23608264f1f0c4a5339b15d3b9361f0b85 F src/printf.c 67de0dcb40ef3297f4a047b434b81585c0f7062d F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88 F src/select.c a306d03fc7d8365055bef70c3563e8fca897460f F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c d07ae326b3815d80f71c69b3c7584382e47f6447 -F src/sqlite.h.in b7682eac8b0365b5c0740a527900449b4815740e +F src/sqlite.h.in 8e00b44bf4e049df5b1520230c311bd39e264a49 F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890 -F src/sqliteInt.h 5e1cf645ef1bf8b43c5d020adbeed43746df24ed +F src/sqliteInt.h 2933fb3d045f85c481453276ed737bd7e65364d5 F src/table.c a8de75bcedf84d4060d804264b067ab3b1a3561d -F src/tclsqlite.c f3414b2d6bc37e6760b49c9abd3504ff69f4441b -F src/test1.c 3891b07526d311ad040d099a76d5fbfdcb826783 +F src/tclsqlite.c f425c7583665ef78dd8397b2de0b8e0028e80ce2 +F src/test1.c 73edd70920e462bbc20885fec66a48b5cace0edc F src/test2.c 24458b17ab2f3c90cbc1c8446bd7ffe69be62f88 F src/test3.c 946ea9d1a8c928656e3c70f0a2fcb8e733a15e86 F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25 @@ -118,6 +119,7 @@ F src/test9.c c0f38f7795cc51d37db6c63874d90f40f10d0f0e F src/test_async.c 9d326ceda4306bcab252b8f7e8e480ed45d7ccb6 F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436 F src/test_btree.c 893030a3c49ea36e9b15b01f1609727dfb11c81e +F src/test_config.c 8a66329b3f2fbb17d8ce00716eb611fa49f0887e F src/test_hexio.c 32204b5ce281ebc85f789c69c4ec725129e7e7f5 F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8 F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3 @@ -130,7 +132,7 @@ F src/update.c 3359041db390a8f856d67272f299600e2104f350 F src/utf.c e64a48bc21aa973eb622dd47da87d56a4cdcf528 F src/util.c 5eff5cec4ae43490ca3fb97f10a25aac1a5f9b55 F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef -F src/vdbe.c 725a808e9bdc317aba963f33054db2dbebdfeecd +F src/vdbe.c a839d32a1b95d994cfcf3545d4b6c3d9ec6d4ce6 F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691 F src/vdbeInt.h cb02cbbceddf3b40d49012e9f41576f17bcbec97 F src/vdbeapi.c 37d793559390bec8a00c556f651f21b5f9e589af @@ -144,7 +146,7 @@ F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/all.test a8dca528354b70a52f130e1bb33dedc6848862a1 F test/alter.test 6a956625399c83392671da690f44257a4ccf058b -F test/alter2.test 33fb74e0470455ed6903f8d6e63256c7402cebb1 +F test/alter2.test 50c3f554b8236d179d72511c0a4f23c5eb7f2af3 F test/alter3.test a6eec8f454be9b6ce73d8d7dc711453675a10ce7 F test/altermalloc.test 19323e0f452834044c27a54c6e78554d706de7ba F test/analyze.test 2f55535aa335785db1a2f97d3f3831c16c09f8b0 @@ -483,7 +485,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 3e96105c1f084a4ab4dad4de6f4759e43fc497f7 -R 4b470de41a52b7c4c5d55622dfae106c +P 011e7db253f9a60c19977215eab1687930f15637 +R faa0278e71cd09a73d2214e06a4fda94 U drh -Z e869803811f5c9e61a3f370a5ec07ccf +Z c1e9d01494d36f3a8240dd080ff3a867 diff --git a/manifest.uuid b/manifest.uuid index 0753b9741b..61c15eeba2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -011e7db253f9a60c19977215eab1687930f15637 \ No newline at end of file +93b623b232a43f78d2c90bfa2389dd5b28ad7280 \ No newline at end of file diff --git a/src/attach.c b/src/attach.c index b25eed250c..c5f539a9fc 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 c28f789ab3..60f910fade 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 @@ -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( iDbnDb ); assert( db->aDb[iDb].pBt!=0 || iDb==1 ); - assert( iDbcookieMask & mask)==0 ){ pParse->cookieMask |= mask; diff --git a/src/limits.h b/src/limits.h new file mode 100644 index 0000000000..64b2c2a786 --- /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 506c3c78c6..6e91221042 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 96b0cd342d..59c54255fe 100644 --- a/src/pager.h +++ b/src/pager.h @@ -13,38 +13,12 @@ ** 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 22720d919e..c329ea8f64 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 c711c2f7a5..7b4bfe9639 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 f0f0544fab..2a7c4e9732 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 374f1ebe1f..36079f5b05 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 @@ -81,24 +83,6 @@ # define SQLITE_BIG_DBL (1e99) #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 @@ -124,20 +108,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 @@ -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 59d301933a..bca6ed3983 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 @@ -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 a0917508e6..47f1909380 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" @@ -4219,368 +4219,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 ** @@ -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 0000000000..ff500e302d --- /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 +#include + +/* +** 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 569a6ef256..fef1993b4b 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); } diff --git a/test/alter2.test b/test/alter2.test index edf5db224a..9ff4b2d113 100644 --- a/test/alter2.test +++ b/test/alter2.test @@ -13,7 +13,7 @@ # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # -# $Id: alter2.test,v 1.7 2007/04/02 12:29:01 danielk1977 Exp $ +# $Id: alter2.test,v 1.8 2007/05/08 01:08:49 drh Exp $ # set testdir [file dirname $argv0] @@ -258,7 +258,7 @@ do_test alter2-4.5 { # Check that executing VACUUM on a file with file-format version 2 # resets the file format to 1. # -set default_file_format [expr $sqlite_default_file_format==4 ? 4 : 1] +set default_file_format [expr $SQLITE_DEFAULT_FILE_FORMAT==4 ? 4 : 1] do_test alter2-5.1 { set_file_format 2 get_file_format