Get the temp_store and default_temp_store pragmas working. Update the
documentation. Also fix a malloc problem that popped up during the regression testing. (CVS 1302) FossilOrigin-Name: 7ace576215367101904677bd69951755ee9cb1a1
This commit is contained in:
parent
932ee8f4bb
commit
1bdd9b5787
28
manifest
28
manifest
@ -1,5 +1,5 @@
|
|||||||
C Fix\swindows\sDLL\ssection\sof\sMakefile.in\sfor\suse\swith\sbuild\sdir.\s(CVS\s1301)
|
C Get\sthe\stemp_store\sand\sdefault_temp_store\spragmas\sworking.\s\sUpdate\sthe\ndocumentation.\s\sAlso\sfix\sa\smalloc\sproblem\sthat\spopped\sup\sduring\sthe\sregression\ntesting.\s(CVS\s1302)
|
||||||
D 2004-03-26T23:16:32
|
D 2004-04-23T17:04:44
|
||||||
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
||||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@ -26,24 +26,24 @@ F src/auth.c 4fa3b05bd19445d1c474d6751c4a508d6ea0abe1
|
|||||||
F src/btree.c 08a05b925b348c05d79b9b062b79e50d565678de
|
F src/btree.c 08a05b925b348c05d79b9b062b79e50d565678de
|
||||||
F src/btree.h 41cb3ff6ebc3f6da2d0a074e39ff8c7a2287469f
|
F src/btree.h 41cb3ff6ebc3f6da2d0a074e39ff8c7a2287469f
|
||||||
F src/btree_rb.c 99feb3ff835106d018a483a1ce403e5cf9c718bc
|
F src/btree_rb.c 99feb3ff835106d018a483a1ce403e5cf9c718bc
|
||||||
F src/build.c c8ab8b467d9a64254b0d4d42083f6313b3a980d1
|
F src/build.c 76fbca30081decd6615dee34b48c927ed5063752
|
||||||
F src/copy.c 750e13828c3e4a293123e36aaa7cf0f22466248a
|
F src/copy.c 750e13828c3e4a293123e36aaa7cf0f22466248a
|
||||||
F src/date.c f055419d602bde622c70f831350b6b52f2235de0
|
F src/date.c f055419d602bde622c70f831350b6b52f2235de0
|
||||||
F src/delete.c 82001c74882319f94dab5f6b92a27311b31092ae
|
F src/delete.c 82001c74882319f94dab5f6b92a27311b31092ae
|
||||||
F src/encode.c fc8c51f0b61bc803ccdec092e130bebe762b0a2f
|
F src/encode.c fc8c51f0b61bc803ccdec092e130bebe762b0a2f
|
||||||
F src/expr.c 938e4d341ce6766a5ee14b31d119ce1f99f478b6
|
F src/expr.c 8c3f5603c3e98b1c146d18076ba3e82cdbb59c11
|
||||||
F src/func.c 34fead7a33e82095f6412d3fafd379d47864b3be
|
F src/func.c 34fead7a33e82095f6412d3fafd379d47864b3be
|
||||||
F src/hash.c 9b56ef3b291e25168f630d5643a4264ec011c70e
|
F src/hash.c 9b56ef3b291e25168f630d5643a4264ec011c70e
|
||||||
F src/hash.h 3247573ab95b9dd90bcca0307a75d9a16da1ccc7
|
F src/hash.h 3247573ab95b9dd90bcca0307a75d9a16da1ccc7
|
||||||
F src/insert.c c0485ee2d1b99322894e2d1e0b576fd05ed75616
|
F src/insert.c c0485ee2d1b99322894e2d1e0b576fd05ed75616
|
||||||
F src/main.c 89a18cfb2a6a832a03fff10b2515da4bbe8f83ef
|
F src/main.c 94dd355768e2a389e184a069b6880f4bac100307
|
||||||
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
|
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
|
||||||
F src/os.c 5f11382733805d4529ec2a30800e117f30995ea8
|
F src/os.c 5f11382733805d4529ec2a30800e117f30995ea8
|
||||||
F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24
|
F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24
|
||||||
F src/pager.c b246986e5ba31b15aa3cf91d3b9ec2e608aceb8e
|
F src/pager.c b246986e5ba31b15aa3cf91d3b9ec2e608aceb8e
|
||||||
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
|
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
|
||||||
F src/parse.y 023720cb8c3bef74e51738bca78335d0dc6d2cfd
|
F src/parse.y 023720cb8c3bef74e51738bca78335d0dc6d2cfd
|
||||||
F src/pragma.c 621d319580e9e23712ec232e8be1786cdae06b36
|
F src/pragma.c f9c157b0591419d2d3407dac90222020d2a6d822
|
||||||
F src/printf.c 8c58b7b6d4069eec6ebe2d46bdbc3a89a367bf95
|
F src/printf.c 8c58b7b6d4069eec6ebe2d46bdbc3a89a367bf95
|
||||||
F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
|
F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
|
||||||
F src/select.c 3833e2b64cc6d249385ee44e13bf49c9ae5b903d
|
F src/select.c 3833e2b64cc6d249385ee44e13bf49c9ae5b903d
|
||||||
@ -55,7 +55,7 @@ F src/tclsqlite.c 819d92d305756c4ea57de023c387d2fa8a256aff
|
|||||||
F src/test1.c 9aa62b89d420e6763b5e7ae89a47f6cf87370477
|
F src/test1.c 9aa62b89d420e6763b5e7ae89a47f6cf87370477
|
||||||
F src/test2.c 75819b0f2c63c6a0fd6995445881f2eb94036996
|
F src/test2.c 75819b0f2c63c6a0fd6995445881f2eb94036996
|
||||||
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
|
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
|
||||||
F src/test4.c dcbbbb382626fd466a7c46907f74db35fc8bad64
|
F src/test4.c 6e3e31acfaf21d66420fc35fda5b17dc0000cc8d
|
||||||
F src/tokenize.c 6676b946fd8825b67ab52140af4fdc57a70bda48
|
F src/tokenize.c 6676b946fd8825b67ab52140af4fdc57a70bda48
|
||||||
F src/trigger.c a9927b57c865b6f3df3fb5e40c9824d722660ded
|
F src/trigger.c a9927b57c865b6f3df3fb5e40c9824d722660ded
|
||||||
F src/update.c 4c50328ebc127852bde8e2950eb8933234802c21
|
F src/update.c 4c50328ebc127852bde8e2950eb8933234802c21
|
||||||
@ -115,7 +115,7 @@ F test/misuse.test 1095f26d1aed406c65e1d2eba651c4bb7c38cbff
|
|||||||
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
|
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
|
||||||
F test/null.test c14d0f4739f21e929b8115b72bf0c765b6bb1721
|
F test/null.test c14d0f4739f21e929b8115b72bf0c765b6bb1721
|
||||||
F test/pager.test 331519008889d45f6df6697395e5bce6ee602fd9
|
F test/pager.test 331519008889d45f6df6697395e5bce6ee602fd9
|
||||||
F test/pragma.test 33011f5741cc4952ff8306ead8a1aeb003fb0786
|
F test/pragma.test 24a3f7a697b45cb90d664ebce5566bec7ac41571
|
||||||
F test/printf.test 46b3d07d59d871d0831b4a657f6dfcafe0574850
|
F test/printf.test 46b3d07d59d871d0831b4a657f6dfcafe0574850
|
||||||
F test/progress.test 701b6115c2613128ececdfe1398a1bd0e1a4cfb3 x
|
F test/progress.test 701b6115c2613128ececdfe1398a1bd0e1a4cfb3 x
|
||||||
F test/quick.test 5a6bccf5c02f16841a79fbac7409a02138880c10
|
F test/quick.test 5a6bccf5c02f16841a79fbac7409a02138880c10
|
||||||
@ -176,8 +176,8 @@ F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
|
|||||||
F www/faq.tcl 88d3b95d9cd8e374772daa3a646c4d107e7f3e9b
|
F www/faq.tcl 88d3b95d9cd8e374772daa3a646c4d107e7f3e9b
|
||||||
F www/fileformat.tcl 56f77e435a6306b337b20b416e3b89500ba2d029
|
F www/fileformat.tcl 56f77e435a6306b337b20b416e3b89500ba2d029
|
||||||
F www/formatchng.tcl ca6cc1cb1bef9bc36f0619049d3c95e749bc6983
|
F www/formatchng.tcl ca6cc1cb1bef9bc36f0619049d3c95e749bc6983
|
||||||
F www/index.tcl b31c15e1b8bffea9a16793bc88d712a9dbbf3d8e
|
F www/index.tcl bacb2a0d052845bbe3bf078765cce907ed7080a4
|
||||||
F www/lang.tcl 6cb027f5483aa831752daeef0c946111af303713
|
F www/lang.tcl 17954f37c8bb1d25e026d97041ff6459fb89ac95
|
||||||
F www/mingw.tcl d96b451568c5d28545fefe0c80bee3431c73f69c
|
F www/mingw.tcl d96b451568c5d28545fefe0c80bee3431c73f69c
|
||||||
F www/nulls.tcl 38117d24afb81efd079b59723b985a6d654cc2e8
|
F www/nulls.tcl 38117d24afb81efd079b59723b985a6d654cc2e8
|
||||||
F www/omitted.tcl 11037a1b557bd01405092d93dfa08898a4c26cd7
|
F www/omitted.tcl 11037a1b557bd01405092d93dfa08898a4c26cd7
|
||||||
@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
|||||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P 85238f06902851dd5085395501a0ab2d6a2b9814
|
P 1e84f70fb98755651e0c04dc2cf0114e2e6fe39c
|
||||||
R 21ef3c09e06057b93271ec18ed7b08b6
|
R 49661129e558c10c6a80ceab2ff48aff
|
||||||
U rdc
|
U drh
|
||||||
Z a0f2c4708b5ae5e7ecb38e2aaf58c2f0
|
Z 3af77926e38ece4579fe3c33c425d46c
|
||||||
|
@ -1 +1 @@
|
|||||||
1e84f70fb98755651e0c04dc2cf0114e2e6fe39c
|
7ace576215367101904677bd69951755ee9cb1a1
|
@ -23,7 +23,7 @@
|
|||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
** PRAGMA
|
** PRAGMA
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.175 2004/02/24 01:04:12 drh Exp $
|
** $Id: build.c,v 1.176 2004/04/23 17:04:44 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -484,7 +484,6 @@ void sqliteStartTable(
|
|||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
sqliteErrorMsg(pParse, "unable to get a write lock on "
|
sqliteErrorMsg(pParse, "unable to get a write lock on "
|
||||||
"the temporary database file");
|
"the temporary database file");
|
||||||
pParse->nErr++;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** for generating VDBE code that evaluates expressions in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: expr.c,v 1.113 2004/03/17 23:32:08 drh Exp $
|
** $Id: expr.c,v 1.114 2004/04/23 17:04:45 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -155,7 +155,8 @@ ExprList *sqliteExprListDup(ExprList *p){
|
|||||||
if( pNew==0 ) return 0;
|
if( pNew==0 ) return 0;
|
||||||
pNew->nExpr = pNew->nAlloc = p->nExpr;
|
pNew->nExpr = pNew->nAlloc = p->nExpr;
|
||||||
pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) );
|
pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) );
|
||||||
for(i=0; pItem && i<p->nExpr; i++, pItem++){
|
if( pItem==0 ) return 0; /* Leaks memory after a malloc failure */
|
||||||
|
for(i=0; i<p->nExpr; i++, pItem++){
|
||||||
Expr *pNewExpr, *pOldExpr;
|
Expr *pNewExpr, *pOldExpr;
|
||||||
pItem->pExpr = pNewExpr = sqliteExprDup(pOldExpr = p->a[i].pExpr);
|
pItem->pExpr = pNewExpr = sqliteExprDup(pOldExpr = p->a[i].pExpr);
|
||||||
if( pOldExpr->span.z!=0 && pNewExpr ){
|
if( pOldExpr->span.z!=0 && pNewExpr ){
|
||||||
@ -278,6 +279,8 @@ ExprList *sqliteExprListAppend(ExprList *pList, Expr *pExpr, Token *pName){
|
|||||||
void sqliteExprListDelete(ExprList *pList){
|
void sqliteExprListDelete(ExprList *pList){
|
||||||
int i;
|
int i;
|
||||||
if( pList==0 ) return;
|
if( pList==0 ) return;
|
||||||
|
assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
|
||||||
|
assert( pList->nExpr<=pList->nAlloc );
|
||||||
for(i=0; i<pList->nExpr; i++){
|
for(i=0; i<pList->nExpr; i++){
|
||||||
sqliteExprDelete(pList->a[i].pExpr);
|
sqliteExprDelete(pList->a[i].pExpr);
|
||||||
sqliteFree(pList->a[i].zName);
|
sqliteFree(pList->a[i].zName);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.163 2004/03/17 18:44:47 drh Exp $
|
** $Id: main.c,v 1.164 2004/04/23 17:04:45 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@ -300,6 +300,9 @@ static int sqliteInitOne(sqlite *db, int iDb, char **pzErrMsg){
|
|||||||
if( size==0 ){ size = MAX_PAGES; }
|
if( size==0 ){ size = MAX_PAGES; }
|
||||||
db->cache_size = size;
|
db->cache_size = size;
|
||||||
db->safety_level = meta[4];
|
db->safety_level = meta[4];
|
||||||
|
if( meta[6]>0 && meta[6]<=2 && db->temp_store==0 ){
|
||||||
|
db->temp_store = meta[6];
|
||||||
|
}
|
||||||
if( db->safety_level==0 ) db->safety_level = 2;
|
if( db->safety_level==0 ) db->safety_level = 2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
55
src/pragma.c
55
src/pragma.c
@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file contains code used to implement the PRAGMA command.
|
** This file contains code used to implement the PRAGMA command.
|
||||||
**
|
**
|
||||||
** $Id: pragma.c,v 1.18 2004/02/22 20:05:01 drh Exp $
|
** $Id: pragma.c,v 1.19 2004/04/23 17:04:45 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -71,8 +71,8 @@ static int getSafetyLevel(char *z){
|
|||||||
** backed temporary databases, 2 for the Red-Black tree in memory database
|
** backed temporary databases, 2 for the Red-Black tree in memory database
|
||||||
** and 0 to use the compile-time default.
|
** and 0 to use the compile-time default.
|
||||||
*/
|
*/
|
||||||
static int getTempStore(char *z){
|
static int getTempStore(const char *z){
|
||||||
if( z[0]>='0' || z[0]<='2' ){
|
if( z[0]>='0' && z[0]<='2' ){
|
||||||
return z[0] - '0';
|
return z[0] - '0';
|
||||||
}else if( sqliteStrICmp(z, "file")==0 ){
|
}else if( sqliteStrICmp(z, "file")==0 ){
|
||||||
return 1;
|
return 1;
|
||||||
@ -83,6 +83,29 @@ static int getTempStore(char *z){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** If the TEMP database is open, close it and mark the database schema
|
||||||
|
** as needing reloading. This must be done when using the TEMP_STORE
|
||||||
|
** or DEFAULT_TEMP_STORE pragmas.
|
||||||
|
*/
|
||||||
|
static int changeTempStorage(Parse *pParse, const char *zStorageType){
|
||||||
|
int ts = getTempStore(zStorageType);
|
||||||
|
sqlite *db = pParse->db;
|
||||||
|
if( db->temp_store==ts ) return SQLITE_OK;
|
||||||
|
if( db->aDb[1].pBt!=0 ){
|
||||||
|
if( db->flags & SQLITE_InTrans ){
|
||||||
|
sqliteErrorMsg(pParse, "temporary storage cannot be changed "
|
||||||
|
"from within a transaction");
|
||||||
|
return SQLITE_ERROR;
|
||||||
|
}
|
||||||
|
sqliteBtreeClose(db->aDb[1].pBt);
|
||||||
|
db->aDb[1].pBt = 0;
|
||||||
|
sqliteResetInternalSchema(db, 0);
|
||||||
|
}
|
||||||
|
db->temp_store = ts;
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Check to see if zRight and zLeft refer to a pragma that queries
|
** Check to see if zRight and zLeft refer to a pragma that queries
|
||||||
** or changes one of the flags in db->flags. Return 1 if so and 0 if not.
|
** or changes one of the flags in db->flags. Return 1 if so and 0 if not.
|
||||||
@ -498,12 +521,7 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
sqliteVdbeAddOp(v, OP_Integer, db->temp_store, 0);
|
sqliteVdbeAddOp(v, OP_Integer, db->temp_store, 0);
|
||||||
sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
|
sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
|
||||||
}else{
|
}else{
|
||||||
if (&db->aDb[1].pBt != 0) {
|
changeTempStorage(pParse, zRight);
|
||||||
sqliteErrorMsg(pParse, "The temporary database already exists - "
|
|
||||||
"its location cannot now be changed");
|
|
||||||
} else {
|
|
||||||
db->temp_store = getTempStore(zRight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
|
|
||||||
@ -511,8 +529,9 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
** PRAGMA default_temp_store
|
** PRAGMA default_temp_store
|
||||||
** PRAGMA default_temp_store = "default"|"memory"|"file"
|
** PRAGMA default_temp_store = "default"|"memory"|"file"
|
||||||
**
|
**
|
||||||
** Return or set the value of the persistent temp_store flag (as
|
** Return or set the value of the persistent temp_store flag. Any
|
||||||
** well as the value currently in force).
|
** change does not take effect until the next time the database is
|
||||||
|
** opened.
|
||||||
**
|
**
|
||||||
** Note that it is possible for the library compile-time options to
|
** Note that it is possible for the library compile-time options to
|
||||||
** override this setting
|
** override this setting
|
||||||
@ -525,16 +544,10 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
if( pRight->z==pLeft->z ){
|
if( pRight->z==pLeft->z ){
|
||||||
sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
|
sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
|
||||||
}else{
|
}else{
|
||||||
if (&db->aDb[1].pBt != 0) {
|
sqliteBeginWriteOperation(pParse, 0, 0);
|
||||||
sqliteErrorMsg(pParse, "The temporary database already exists - "
|
sqliteVdbeAddOp(v, OP_Integer, getTempStore(zRight), 0);
|
||||||
"its location cannot now be changed");
|
sqliteVdbeAddOp(v, OP_SetCookie, 0, 5);
|
||||||
} else {
|
sqliteEndWriteOperation(pParse);
|
||||||
sqliteBeginWriteOperation(pParse, 0, 0);
|
|
||||||
db->temp_store = getTempStore(zRight);
|
|
||||||
sqliteVdbeAddOp(v, OP_Integer, db->temp_store, 0);
|
|
||||||
sqliteVdbeAddOp(v, OP_SetCookie, 0, 5);
|
|
||||||
sqliteEndWriteOperation(pParse);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
|
|
||||||
|
41
src/test4.c
41
src/test4.c
@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Code for testing the the SQLite library in a multithreaded environment.
|
** Code for testing the the SQLite library in a multithreaded environment.
|
||||||
**
|
**
|
||||||
** $Id: test4.c,v 1.2 2003/12/20 04:00:53 drh Exp $
|
** $Id: test4.c,v 1.3 2004/04/23 17:04:45 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
@ -563,6 +563,44 @@ static int tcl_thread_finalize(
|
|||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Usage: thread_swap ID ID
|
||||||
|
**
|
||||||
|
** Interchange the sqlite* pointer between two threads.
|
||||||
|
*/
|
||||||
|
static int tcl_thread_swap(
|
||||||
|
void *NotUsed,
|
||||||
|
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||||
|
int argc, /* Number of arguments */
|
||||||
|
const char **argv /* Text of each argument */
|
||||||
|
){
|
||||||
|
int i, j;
|
||||||
|
sqlite *temp;
|
||||||
|
if( argc!=3 ){
|
||||||
|
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||||
|
" ID1 ID2", 0);
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
i = parse_thread_id(interp, argv[1]);
|
||||||
|
if( i<0 ) return TCL_ERROR;
|
||||||
|
if( !threadset[i].busy ){
|
||||||
|
Tcl_AppendResult(interp, "no such thread", 0);
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
thread_wait(&threadset[i]);
|
||||||
|
j = parse_thread_id(interp, argv[2]);
|
||||||
|
if( j<0 ) return TCL_ERROR;
|
||||||
|
if( !threadset[j].busy ){
|
||||||
|
Tcl_AppendResult(interp, "no such thread", 0);
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
thread_wait(&threadset[j]);
|
||||||
|
temp = threadset[i].db;
|
||||||
|
threadset[i].db = threadset[j].db;
|
||||||
|
threadset[j].db = temp;
|
||||||
|
return TCL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Register commands with the TCL interpreter.
|
** Register commands with the TCL interpreter.
|
||||||
*/
|
*/
|
||||||
@ -582,6 +620,7 @@ int Sqlitetest4_Init(Tcl_Interp *interp){
|
|||||||
{ "thread_compile", (Tcl_CmdProc*)tcl_thread_compile },
|
{ "thread_compile", (Tcl_CmdProc*)tcl_thread_compile },
|
||||||
{ "thread_step", (Tcl_CmdProc*)tcl_thread_step },
|
{ "thread_step", (Tcl_CmdProc*)tcl_thread_step },
|
||||||
{ "thread_finalize", (Tcl_CmdProc*)tcl_thread_finalize },
|
{ "thread_finalize", (Tcl_CmdProc*)tcl_thread_finalize },
|
||||||
|
{ "thread_swap", (Tcl_CmdProc*)tcl_thread_swap },
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
148
test/pragma.test
148
test/pragma.test
@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
# This file implements tests for the PRAGMA command.
|
# This file implements tests for the PRAGMA command.
|
||||||
#
|
#
|
||||||
# $Id: pragma.test,v 1.8 2004/02/11 02:18:07 drh Exp $
|
# $Id: pragma.test,v 1.9 2004/04/23 17:04:45 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -268,4 +268,150 @@ do_test pragma-3.2 {
|
|||||||
} {{rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
} {{rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||||
}; # endif has-codec
|
}; # endif has-codec
|
||||||
|
|
||||||
|
# Test the temp_store and default_temp_store pragmas
|
||||||
|
#
|
||||||
|
do_test pragma-4.2 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store='default';
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {0}
|
||||||
|
do_test pragma-4.3 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store='file';
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test pragma-4.4 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store='memory';
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
do_test pragma-4.5 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store='default';
|
||||||
|
PRAGMA default_temp_store;
|
||||||
|
}
|
||||||
|
} {0}
|
||||||
|
do_test pragma-4.6 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
do_test pragma-4.7 {
|
||||||
|
db close
|
||||||
|
sqlite db test.db
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {0}
|
||||||
|
do_test pragma-4.8 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store;
|
||||||
|
}
|
||||||
|
} {0}
|
||||||
|
do_test pragma-4.9 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store='file';
|
||||||
|
PRAGMA default_temp_store;
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test pragma-4.10 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {0}
|
||||||
|
do_test pragma-4.11 {
|
||||||
|
db close
|
||||||
|
sqlite db test.db
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test pragma-4.12 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store;
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test pragma-4.13 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store='memory';
|
||||||
|
PRAGMA default_temp_store;
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
do_test pragma-4.14 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test pragma-4.15 {
|
||||||
|
db close
|
||||||
|
sqlite db test.db
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store;
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
do_test pragma-4.16 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store;
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
do_test pragma-4.17 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store='file';
|
||||||
|
PRAGMA temp_store
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test pragma-4.18 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA default_temp_store
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
do_test pragma-4.19 {
|
||||||
|
db close
|
||||||
|
sqlite db test.db
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store
|
||||||
|
}
|
||||||
|
} {2}
|
||||||
|
|
||||||
|
# Changing the TEMP_STORE deletes any existing temporary tables
|
||||||
|
#
|
||||||
|
do_test pragma-4.20 {
|
||||||
|
execsql {SELECT name FROM sqlite_temp_master}
|
||||||
|
} {}
|
||||||
|
do_test pragma-4.21 {
|
||||||
|
execsql {
|
||||||
|
CREATE TEMP TABLE test1(a,b,c);
|
||||||
|
SELECT name FROM sqlite_temp_master;
|
||||||
|
}
|
||||||
|
} {test1}
|
||||||
|
do_test pragma-4.22 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store='file';
|
||||||
|
SELECT name FROM sqlite_temp_master;
|
||||||
|
}
|
||||||
|
} {}
|
||||||
|
do_test pragma-4.23 {
|
||||||
|
execsql {
|
||||||
|
CREATE TEMP TABLE test1(a,b,c);
|
||||||
|
SELECT name FROM sqlite_temp_master;
|
||||||
|
}
|
||||||
|
} {test1}
|
||||||
|
do_test pragma-4.24 {
|
||||||
|
execsql {
|
||||||
|
PRAGMA temp_store='memory';
|
||||||
|
SELECT name FROM sqlite_temp_master;
|
||||||
|
}
|
||||||
|
} {}
|
||||||
|
do_test pragma-4.25 {
|
||||||
|
catchsql {
|
||||||
|
BEGIN;
|
||||||
|
PRAGMA temp_store='default';
|
||||||
|
COMMIT;
|
||||||
|
}
|
||||||
|
} {1 {temporary storage cannot be changed from within a transaction}}
|
||||||
|
catchsql {COMMIT}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Run this TCL script to generate HTML for the index.html file.
|
# Run this TCL script to generate HTML for the index.html file.
|
||||||
#
|
#
|
||||||
set rcsid {$Id: index.tcl,v 1.81 2004/01/22 23:38:22 drh Exp $}
|
set rcsid {$Id: index.tcl,v 1.82 2004/04/23 17:04:45 drh Exp $}
|
||||||
|
|
||||||
puts {<html>
|
puts {<html>
|
||||||
<head><title>SQLite: An Embeddable SQL Database Engine</title></head>
|
<head><title>SQLite: An Embeddable SQL Database Engine</title></head>
|
||||||
@ -56,7 +56,8 @@ puts {<h2>Features</h2>
|
|||||||
<li>Database files can be freely shared between machines with
|
<li>Database files can be freely shared between machines with
|
||||||
different byte orders.</li>
|
different byte orders.</li>
|
||||||
<li>Supports databases up to 2 terabytes (2^41 bytes) in size.</li>
|
<li>Supports databases up to 2 terabytes (2^41 bytes) in size.</li>
|
||||||
<li>Small memory footprint: less than 25K lines of C code.</li>
|
<li>A zero-configuration database engine - no DBA needed.</li>
|
||||||
|
<li>Small memory footprint: less than 30K lines of C code.</li>
|
||||||
<li><a href="speed.html">Two times faster</a> than PostgreSQL and
|
<li><a href="speed.html">Two times faster</a> than PostgreSQL and
|
||||||
MySQL for many common operations.</li>
|
MySQL for many common operations.</li>
|
||||||
<li>Very simple
|
<li>Very simple
|
||||||
|
18
www/lang.tcl
18
www/lang.tcl
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Run this Tcl script to generate the sqlite.html file.
|
# Run this Tcl script to generate the sqlite.html file.
|
||||||
#
|
#
|
||||||
set rcsid {$Id: lang.tcl,v 1.66 2004/01/19 05:09:24 jplyon Exp $}
|
set rcsid {$Id: lang.tcl,v 1.67 2004/04/23 17:04:45 drh Exp $}
|
||||||
|
|
||||||
puts {<html>
|
puts {<html>
|
||||||
<head>
|
<head>
|
||||||
@ -1323,8 +1323,7 @@ is returned it is as an integer.</p>
|
|||||||
the database. When temp_store is DEFAULT (0), the compile-time value
|
the database. When temp_store is DEFAULT (0), the compile-time value
|
||||||
of the symbol TEMP_STORE is used for the temporary database.
|
of the symbol TEMP_STORE is used for the temporary database.
|
||||||
When temp_store is MEMORY (2), an in-memory database is used.
|
When temp_store is MEMORY (2), an in-memory database is used.
|
||||||
When temp_store is FILE (1), a temporary database file on disk will be used.
|
When temp_store is FILE (1), a temporary database file on disk will be used.
|
||||||
Once the temporary database is in use, its location cannot be changed.
|
|
||||||
It is possible for the library compile-time symbol TEMP_STORE to override
|
It is possible for the library compile-time symbol TEMP_STORE to override
|
||||||
this setting. The following table summarizes this:</p>
|
this setting. The following table summarizes this:</p>
|
||||||
|
|
||||||
@ -1340,10 +1339,11 @@ is returned it is as an integer.</p>
|
|||||||
<tr><td align="center">3</td><td align="center"><em>any</em></td><td align="center">memory</td></tr>
|
<tr><td align="center">3</td><td align="center"><em>any</em></td><td align="center">memory</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>This pragma changes the temp_store mode persistently. Once changed,
|
<p>This pragma changes the temp_store mode for whenever the database
|
||||||
the mode stays set even if the database is closed and reopened. The
|
is opened in the future. The temp_store mode for the current session
|
||||||
<a href="#pragma_temp_store"><b>temp_store</b></a> pragma does the same
|
is unchanged. Use the
|
||||||
thing but only applies the setting to the current session.</p></li>
|
<a href="#pragma_temp_store"><b>temp_store</b></a> pragma to change the
|
||||||
|
temp_store mode for the current session.</p></li>
|
||||||
|
|
||||||
<a name="pragma_empty_result_callbacks"></a>
|
<a name="pragma_empty_result_callbacks"></a>
|
||||||
<li><p><b>PRAGMA empty_result_callbacks = ON; </b>(1)<b>
|
<li><p><b>PRAGMA empty_result_callbacks = ON; </b>(1)<b>
|
||||||
@ -1460,6 +1460,10 @@ is returned it is as an integer.</p>
|
|||||||
flag, see the description of the <a href="#pragma_default_temp_store">
|
flag, see the description of the <a href="#pragma_default_temp_store">
|
||||||
<b>default_temp_store</b></a> pragma. Note that it is possible for
|
<b>default_temp_store</b></a> pragma. Note that it is possible for
|
||||||
the library compile-time options to override this setting. </p>
|
the library compile-time options to override this setting. </p>
|
||||||
|
|
||||||
|
<p>When the temp_store setting is changed, all existing temporary
|
||||||
|
tables, indices, triggers, and viewers are immediately deleted.
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<a name="pragma_vdbe_trace"></a>
|
<a name="pragma_vdbe_trace"></a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user