Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f3a5a57ddb | |||
| 1832890357 | |||
| 97117601d2 | |||
| f9ec81c84d | |||
| 45041e263a | |||
| 3e5c826219 | |||
| 4e0e4d7a9e | |||
| 064cf76bb1 | |||
| a38518d673 |
@@ -1,9 +1,9 @@
|
||||
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-04-23T17:04:44
|
||||
C Version\s2.8.14\s(CVS\s1554)
|
||||
D 2004-06-09T23:20:06
|
||||
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
F VERSION 4328de2a5fb5000699b907ca405cb9d84ba4e097
|
||||
F VERSION f97edce65ceac3b00185ca009ed810a470837a50
|
||||
F aclocal.m4 7daea4c35e88de30d5a3f6f7a2ab99720e803bbd
|
||||
F art/SQLite.eps 9b43cc99cfd2be687d386faea6862ea68d6a72b2
|
||||
F art/SQLite.gif 1bbb94484963f1382e27e1c5e86dd0c1061eba2b
|
||||
@@ -21,7 +21,7 @@ F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b
|
||||
F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
|
||||
F sqlite.def fc4f5734786fe4743cfe2aa98eb2da4b089edb5f
|
||||
F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
|
||||
F src/attach.c b01db0d3211f673d8e670abf7eaad04591d40d14
|
||||
F src/attach.c 026702566f941bf2bb158a0aaa86bfeb65910aa6
|
||||
F src/auth.c 4fa3b05bd19445d1c474d6751c4a508d6ea0abe1
|
||||
F src/btree.c 08a05b925b348c05d79b9b062b79e50d565678de
|
||||
F src/btree.h 41cb3ff6ebc3f6da2d0a074e39ff8c7a2287469f
|
||||
@@ -38,7 +38,7 @@ F src/hash.h 3247573ab95b9dd90bcca0307a75d9a16da1ccc7
|
||||
F src/insert.c c0485ee2d1b99322894e2d1e0b576fd05ed75616
|
||||
F src/main.c 94dd355768e2a389e184a069b6880f4bac100307
|
||||
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
|
||||
F src/os.c 5f11382733805d4529ec2a30800e117f30995ea8
|
||||
F src/os.c edcd42ad1cf13e7322f814c50a3e6eb09d3915bb
|
||||
F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24
|
||||
F src/pager.c b246986e5ba31b15aa3cf91d3b9ec2e608aceb8e
|
||||
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
|
||||
@@ -52,16 +52,16 @@ F src/sqlite.h.in 35bec264dfb4965bbfeb7e75221f8658f210c30d
|
||||
F src/sqliteInt.h 235ce244b62bb26cc9ab394fb7a0724dd4e65c83
|
||||
F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
|
||||
F src/tclsqlite.c 819d92d305756c4ea57de023c387d2fa8a256aff
|
||||
F src/test1.c 9aa62b89d420e6763b5e7ae89a47f6cf87370477
|
||||
F src/test1.c 4ae20bc125b1a7d7824cccca55d538d81f0b4949
|
||||
F src/test2.c 75819b0f2c63c6a0fd6995445881f2eb94036996
|
||||
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
|
||||
F src/test4.c 6e3e31acfaf21d66420fc35fda5b17dc0000cc8d
|
||||
F src/tokenize.c 6676b946fd8825b67ab52140af4fdc57a70bda48
|
||||
F src/trigger.c a9927b57c865b6f3df3fb5e40c9824d722660ded
|
||||
F src/update.c 4c50328ebc127852bde8e2950eb8933234802c21
|
||||
F src/update.c bd391079138e67d09c9af34528ca4137c29242d1
|
||||
F src/util.c 122bc174f6c8c2eb6a9127d9f13c4c74f83b85e4
|
||||
F src/vacuum.c a4e8464c9f6d60659c5343e9d62c742463227820
|
||||
F src/vdbe.c 7c33f761fdc799633468766fb53eda4301daa6b3
|
||||
F src/vacuum.c 36a19aa877c696c4ec8b78300c19f4059d2617a7
|
||||
F src/vdbe.c 0853ab9983b7adbba8c012bb8b152d8453bf8a97
|
||||
F src/vdbe.h ac987945e4dd6f987bca534c6005899f089fc270
|
||||
F src/vdbeInt.h b40ff02ce39fd076e6ff3369e19c1bbfe1986682
|
||||
F src/vdbeaux.c e2cdd1ab63604a390612c73e26bdd2ef910e9438
|
||||
@@ -94,7 +94,7 @@ F test/in.test 0de39b02ceeca90993b096822fb5a884661c5b47
|
||||
F test/index.test 9295deefbdb6dedbe01be8905f0c448fe5bd4079
|
||||
F test/insert.test a17b7f7017097afb2727aa5b67ceeb7ab0a120a1
|
||||
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
|
||||
F test/interrupt.test 9142ce4448605127640eda5e283952f75f67ed91
|
||||
F test/interrupt.test 0d50985f1aa6c39fe2cca4cf4a272c79ff1648e8
|
||||
F test/intpkey.test 9320af48415c594afd4e15f8ef0daa272e05502e
|
||||
F test/ioerr.test 5dbaf09f96b56ee01cf3edd762b96eb4ad2c9ca4
|
||||
F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd
|
||||
@@ -149,7 +149,7 @@ F test/version.test 92adee5d98cf6e3eb0d1cf5186952e8114931bf6
|
||||
F test/view.test 1ee12c6f8f4791a2c0655120d5562a49400cfe53
|
||||
F test/where.test cb3a2ed062ce4b5f08aff2d08027c6a46d68c47b
|
||||
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
|
||||
F tool/lemon.c 38a39c623df325bcbd67152d6f92e09edbee8b83
|
||||
F tool/lemon.c db6a3bfaf3388c0f7aea3adb5e05acddcd427016
|
||||
F tool/lempar.c 0b5e7a58634e0d448929b8e85f7981c2aa708d57
|
||||
F tool/memleak.awk b744b6109566206c746d826f6ecdba34662216bc
|
||||
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
|
||||
@@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 1e84f70fb98755651e0c04dc2cf0114e2e6fe39c
|
||||
R 49661129e558c10c6a80ceab2ff48aff
|
||||
P 7538d2e5297bdeaf07c6d6e37053c654501ef286
|
||||
R 4b97b7f3ad71d7fa0ea85a53f9d1556a
|
||||
U drh
|
||||
Z 3af77926e38ece4579fe3c33c425d46c
|
||||
Z 6e7d236761f1e0f27c9fd9bb6ff1ebec
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
7ace576215367101904677bd69951755ee9cb1a1
|
||||
7d3937743f88acad8859fbbbb1c03271a939bc0b
|
||||
+10
-7
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the ATTACH and DETACH commands.
|
||||
**
|
||||
** $Id: attach.c,v 1.10 2004/02/12 18:46:39 drh Exp $
|
||||
** $Id: attach.c,v 1.10.2.1 2004/05/07 01:46:01 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -137,15 +137,17 @@ void sqliteDetach(Parse *pParse, Token *pDbname){
|
||||
int i;
|
||||
sqlite *db;
|
||||
Vdbe *v;
|
||||
Db *pDb;
|
||||
|
||||
v = sqliteGetVdbe(pParse);
|
||||
sqliteVdbeAddOp(v, OP_Halt, 0, 0);
|
||||
if( pParse->explain ) return;
|
||||
db = pParse->db;
|
||||
for(i=0; i<db->nDb; i++){
|
||||
if( db->aDb[i].pBt==0 || db->aDb[i].zName==0 ) continue;
|
||||
if( strlen(db->aDb[i].zName)!=pDbname->n ) continue;
|
||||
if( sqliteStrNICmp(db->aDb[i].zName, pDbname->z, pDbname->n)==0 ) break;
|
||||
pDb = &db->aDb[i];
|
||||
if( pDb->pBt==0 || pDb->zName==0 ) continue;
|
||||
if( strlen(pDb->zName)!=pDbname->n ) continue;
|
||||
if( sqliteStrNICmp(pDb->zName, pDbname->z, pDbname->n)==0 ) break;
|
||||
}
|
||||
if( i>=db->nDb ){
|
||||
sqliteErrorMsg(pParse, "no such database: %T", pDbname);
|
||||
@@ -160,10 +162,11 @@ void sqliteDetach(Parse *pParse, Token *pDbname){
|
||||
return;
|
||||
}
|
||||
#endif /* SQLITE_OMIT_AUTHORIZATION */
|
||||
sqliteBtreeClose(db->aDb[i].pBt);
|
||||
db->aDb[i].pBt = 0;
|
||||
sqliteFree(db->aDb[i].zName);
|
||||
sqliteBtreeClose(pDb->pBt);
|
||||
pDb->pBt = 0;
|
||||
sqliteFree(pDb->zName);
|
||||
sqliteResetInternalSchema(db, i);
|
||||
if( pDb->pAux && pDb->xFreeAux ) pDb->xFreeAux(pDb->pAux);
|
||||
db->nDb--;
|
||||
if( i<db->nDb ){
|
||||
db->aDb[i] = db->aDb[db->nDb];
|
||||
|
||||
@@ -773,6 +773,13 @@ int sqliteOsOpenDirectory(
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** If the following global variable points to a string which is the
|
||||
** name of a directory, then that directory will be used to store
|
||||
** temporary files.
|
||||
*/
|
||||
const char *sqlite_temp_directory = 0;
|
||||
|
||||
/*
|
||||
** Create a temporary file name in zBuf. zBuf must be big enough to
|
||||
** hold at least SQLITE_TEMPNAME_SIZE characters.
|
||||
@@ -780,6 +787,7 @@ int sqliteOsOpenDirectory(
|
||||
int sqliteOsTempFileName(char *zBuf){
|
||||
#if OS_UNIX
|
||||
static const char *azDirs[] = {
|
||||
0,
|
||||
"/var/tmp",
|
||||
"/usr/tmp",
|
||||
"/tmp",
|
||||
@@ -792,7 +800,9 @@ int sqliteOsTempFileName(char *zBuf){
|
||||
int i, j;
|
||||
struct stat buf;
|
||||
const char *zDir = ".";
|
||||
azDirs[0] = sqlite_temp_directory;
|
||||
for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
|
||||
if( azDirs[i]==0 ) continue;
|
||||
if( stat(azDirs[i], &buf) ) continue;
|
||||
if( !S_ISDIR(buf.st_mode) ) continue;
|
||||
if( access(azDirs[i], 07) ) continue;
|
||||
@@ -815,12 +825,18 @@ int sqliteOsTempFileName(char *zBuf){
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"0123456789";
|
||||
int i, j;
|
||||
char *zDir;
|
||||
char zTempPath[SQLITE_TEMPNAME_SIZE];
|
||||
GetTempPath(SQLITE_TEMPNAME_SIZE-30, zTempPath);
|
||||
for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
|
||||
zTempPath[i] = 0;
|
||||
if( sqlite_temp_directory==0 ){
|
||||
GetTempPath(SQLITE_TEMPNAME_SIZE-30, zTempPath);
|
||||
for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
|
||||
zTempPath[i] = 0;
|
||||
zDir = zTempPath;
|
||||
}else{
|
||||
zDir = sqlite_temp_directory;
|
||||
}
|
||||
for(;;){
|
||||
sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zTempPath);
|
||||
sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zDir);
|
||||
j = strlen(zBuf);
|
||||
sqliteRandomness(15, &zBuf[j]);
|
||||
for(i=0; i<15; i++, j++){
|
||||
@@ -836,13 +852,16 @@ int sqliteOsTempFileName(char *zBuf){
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"0123456789";
|
||||
int i, j;
|
||||
char *zDir;
|
||||
char zTempPath[SQLITE_TEMPNAME_SIZE];
|
||||
char zdirName[32];
|
||||
CInfoPBRec infoRec;
|
||||
Str31 dirName;
|
||||
memset(&infoRec, 0, sizeof(infoRec));
|
||||
memset(zTempPath, 0, SQLITE_TEMPNAME_SIZE);
|
||||
if( FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder,
|
||||
if( sqlite_temp_directory!=0 ){
|
||||
zDir = sqlite_temp_directory;
|
||||
}else if( FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder,
|
||||
&(infoRec.dirInfo.ioVRefNum), &(infoRec.dirInfo.ioDrParID)) == noErr ){
|
||||
infoRec.dirInfo.ioNamePtr = dirName;
|
||||
do{
|
||||
@@ -859,11 +878,14 @@ int sqliteOsTempFileName(char *zBuf){
|
||||
break;
|
||||
}
|
||||
} while( infoRec.dirInfo.ioDrDirID != fsRtDirID );
|
||||
zDir = zTempPath;
|
||||
}
|
||||
if( *zTempPath == 0 )
|
||||
if( zDir[0]==0 ){
|
||||
getcwd(zTempPath, SQLITE_TEMPNAME_SIZE-24);
|
||||
zDir = zTempPath;
|
||||
}
|
||||
for(;;){
|
||||
sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zTempPath);
|
||||
sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zDir);
|
||||
j = strlen(zBuf);
|
||||
sqliteRandomness(15, &zBuf[j]);
|
||||
for(i=0; i<15; i++, j++){
|
||||
|
||||
+4
-1
@@ -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.36 2004/02/22 17:49:34 drh Exp $
|
||||
** $Id: test1.c,v 1.36.2.1 2004/05/07 00:57:06 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@@ -975,6 +975,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
extern int sqlite_interrupt_count;
|
||||
extern int sqlite_open_file_count;
|
||||
extern int sqlite_current_time;
|
||||
extern int sqlite_temp_directory;
|
||||
static struct {
|
||||
char *zName;
|
||||
Tcl_CmdProc *xProc;
|
||||
@@ -1020,5 +1021,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
(char*)&sqlite_current_time, TCL_LINK_INT);
|
||||
Tcl_LinkVar(interp, "sqlite_static_bind_value",
|
||||
(char*)&sqlite_static_bind_value, TCL_LINK_STRING);
|
||||
Tcl_LinkVar(interp, "sqlite_temp_directory",
|
||||
(char*)&sqlite_temp_directory, TCL_LINK_STRING);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
+17
-10
@@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle UPDATE statements.
|
||||
**
|
||||
** $Id: update.c,v 1.70 2004/02/22 20:05:02 drh Exp $
|
||||
** $Id: update.c,v 1.70.2.1 2004/04/29 16:16:29 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -32,7 +32,8 @@ void sqliteUpdate(
|
||||
){
|
||||
int i, j; /* Loop counters */
|
||||
Table *pTab; /* The table to be updated */
|
||||
int addr; /* VDBE instruction address of the start of the loop */
|
||||
int loopStart; /* VDBE instruction address of the start of the loop */
|
||||
int jumpInst; /* Addr of VDBE instruction to jump out of loop */
|
||||
WhereInfo *pWInfo; /* Information about the WHERE clause */
|
||||
Vdbe *v; /* The virtual database engine */
|
||||
Index *pIdx; /* For looping over indices */
|
||||
@@ -49,6 +50,7 @@ void sqliteUpdate(
|
||||
Expr *pRecnoExpr; /* Expression defining the new record number */
|
||||
int openAll; /* True if all indices need to be opened */
|
||||
int isView; /* Trying to update a view */
|
||||
int iStackDepth; /* Index of memory cell holding stack depth */
|
||||
AuthContext sContext; /* The authorization context */
|
||||
|
||||
int before_triggers; /* True if there are any BEFORE triggers */
|
||||
@@ -62,6 +64,7 @@ void sqliteUpdate(
|
||||
if( pParse->nErr || sqlite_malloc_failed ) goto update_cleanup;
|
||||
db = pParse->db;
|
||||
assert( pTabList->nSrc==1 );
|
||||
iStackDepth = pParse->nMem++;
|
||||
|
||||
/* Locate the table which we want to update.
|
||||
*/
|
||||
@@ -248,7 +251,11 @@ void sqliteUpdate(
|
||||
/* The top of the update loop for when there are triggers.
|
||||
*/
|
||||
sqliteVdbeAddOp(v, OP_ListRewind, 0, 0);
|
||||
addr = sqliteVdbeAddOp(v, OP_ListRead, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_StackDepth, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_MemStore, iStackDepth, 1);
|
||||
loopStart = sqliteVdbeAddOp(v, OP_MemLoad, iStackDepth, 0);
|
||||
sqliteVdbeAddOp(v, OP_StackReset, 0, 0);
|
||||
jumpInst = sqliteVdbeAddOp(v, OP_ListRead, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_Dup, 0, 0);
|
||||
|
||||
/* Open a cursor and make it point to the record that is
|
||||
@@ -295,7 +302,7 @@ void sqliteUpdate(
|
||||
/* Fire the BEFORE and INSTEAD OF triggers
|
||||
*/
|
||||
if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab,
|
||||
newIdx, oldIdx, onError, addr) ){
|
||||
newIdx, oldIdx, onError, loopStart) ){
|
||||
goto update_cleanup;
|
||||
}
|
||||
}
|
||||
@@ -336,10 +343,10 @@ void sqliteUpdate(
|
||||
*/
|
||||
if( !row_triggers_exist ){
|
||||
sqliteVdbeAddOp(v, OP_ListRewind, 0, 0);
|
||||
addr = sqliteVdbeAddOp(v, OP_ListRead, 0, 0);
|
||||
jumpInst = loopStart = sqliteVdbeAddOp(v, OP_ListRead, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_Dup, 0, 0);
|
||||
}
|
||||
sqliteVdbeAddOp(v, OP_NotExists, iCur, addr);
|
||||
sqliteVdbeAddOp(v, OP_NotExists, iCur, loopStart);
|
||||
|
||||
/* If the record number will change, push the record number as it
|
||||
** will be after the update. (The old record number is currently
|
||||
@@ -368,7 +375,7 @@ void sqliteUpdate(
|
||||
/* Do constraint checks
|
||||
*/
|
||||
sqliteGenerateConstraintChecks(pParse, pTab, iCur, aIdxUsed, chngRecno, 1,
|
||||
onError, addr);
|
||||
onError, loopStart);
|
||||
|
||||
/* Delete the old indices for the current record.
|
||||
*/
|
||||
@@ -404,7 +411,7 @@ void sqliteUpdate(
|
||||
pParse->nTab = iCur;
|
||||
}
|
||||
if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab,
|
||||
newIdx, oldIdx, onError, addr) ){
|
||||
newIdx, oldIdx, onError, loopStart) ){
|
||||
goto update_cleanup;
|
||||
}
|
||||
}
|
||||
@@ -412,8 +419,8 @@ void sqliteUpdate(
|
||||
/* Repeat the above with the next record to be updated, until
|
||||
** all record selected by the WHERE clause have been updated.
|
||||
*/
|
||||
sqliteVdbeAddOp(v, OP_Goto, 0, addr);
|
||||
sqliteVdbeChangeP2(v, addr, sqliteVdbeCurrentAddr(v));
|
||||
sqliteVdbeAddOp(v, OP_Goto, 0, loopStart);
|
||||
sqliteVdbeChangeP2(v, jumpInst, sqliteVdbeCurrentAddr(v));
|
||||
sqliteVdbeAddOp(v, OP_ListReset, 0, 0);
|
||||
|
||||
/* Close all tables if there were no FOR EACH ROW triggers */
|
||||
|
||||
+9
-2
@@ -14,7 +14,7 @@
|
||||
** Most of the code in this file may be omitted by defining the
|
||||
** SQLITE_OMIT_VACUUM macro.
|
||||
**
|
||||
** $Id: vacuum.c,v 1.13 2004/03/10 18:57:32 drh Exp $
|
||||
** $Id: vacuum.c,v 1.13.2.2 2004/06/04 19:07:54 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -239,6 +239,9 @@ int sqliteRunVacuum(char **pzErrMsg, sqlite *db){
|
||||
(char*)0);
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
if( db->flags & SQLITE_Interrupt ){
|
||||
return SQLITE_INTERRUPT;
|
||||
}
|
||||
memset(&sVac, 0, sizeof(sVac));
|
||||
|
||||
/* Get the full pathname of the database file and create two
|
||||
@@ -308,13 +311,17 @@ end_of_vacuum:
|
||||
zErrMsg, (char*)0);
|
||||
}
|
||||
sqlite_exec(db, "ROLLBACK", 0, 0, 0);
|
||||
if( (dbNew && (dbNew->flags & SQLITE_Interrupt))
|
||||
|| (db->flags & SQLITE_Interrupt) ){
|
||||
rc = SQLITE_INTERRUPT;
|
||||
}
|
||||
if( dbNew ) sqlite_close(dbNew);
|
||||
sqliteOsDelete(zTemp);
|
||||
sqliteFree(zTemp);
|
||||
sqliteFree(sVac.s1.z);
|
||||
sqliteFree(sVac.s2.z);
|
||||
if( zErrMsg ) sqlite_freemem(zErrMsg);
|
||||
if( rc==SQLITE_ABORT ) sVac.rc = SQLITE_ERROR;
|
||||
if( rc==SQLITE_ABORT && sVac.rc!=SQLITE_INTERRUPT ) sVac.rc = SQLITE_ERROR;
|
||||
return sVac.rc;
|
||||
#endif
|
||||
}
|
||||
|
||||
+33
-2
@@ -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.268 2004/03/03 01:51:25 drh Exp $
|
||||
** $Id: vdbe.c,v 1.268.2.2 2004/05/10 20:27:41 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -62,7 +62,7 @@ int sqlite_search_count = 0;
|
||||
/*
|
||||
** When this global variable is positive, it gets decremented once before
|
||||
** each instruction in the VDBE. When reaches zero, the SQLITE_Interrupt
|
||||
** of the db.flags field is set in order to simulate and interrupt.
|
||||
** of the db.flags field is set in order to simulate an interrupt.
|
||||
**
|
||||
** This facility is used for testing purposes only. It does not function
|
||||
** in an ordinary build.
|
||||
@@ -4723,6 +4723,36 @@ case OP_Vacuum: {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: StackDepth * * *
|
||||
**
|
||||
** Push an integer onto the stack which is the depth of the stack prior
|
||||
** to that integer being pushed.
|
||||
*/
|
||||
case OP_StackDepth: {
|
||||
int depth = (&pTos[1]) - p->aStack;
|
||||
pTos++;
|
||||
pTos->i = depth;
|
||||
pTos->flags = MEM_Int;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: StackReset * * *
|
||||
**
|
||||
** Pop a single integer off of the stack. Then pop the stack
|
||||
** as many times as necessary to get the depth of the stack down
|
||||
** to the value of the integer that was popped.
|
||||
*/
|
||||
case OP_StackReset: {
|
||||
int depth, goal;
|
||||
assert( pTos>=p->aStack );
|
||||
Integerify(pTos);
|
||||
goal = pTos->i;
|
||||
depth = (&pTos[1]) - p->aStack;
|
||||
assert( goal<depth );
|
||||
popStack(&pTos, depth-goal);
|
||||
break;
|
||||
}
|
||||
|
||||
/* An other opcode is illegal...
|
||||
*/
|
||||
default: {
|
||||
@@ -4835,6 +4865,7 @@ default: {
|
||||
/* If we reach this point, it means that execution is finished.
|
||||
*/
|
||||
vdbe_halt:
|
||||
CHECK_FOR_INTERRUPT
|
||||
if( rc ){
|
||||
p->rc = rc;
|
||||
rc = SQLITE_ERROR;
|
||||
|
||||
+9
-7
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is the sqlite_interrupt() API.
|
||||
#
|
||||
# $Id: interrupt.test,v 1.4 2004/02/18 16:57:23 drh Exp $
|
||||
# $Id: interrupt.test,v 1.4.2.1 2004/05/10 20:27:42 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@@ -37,12 +37,13 @@ proc cksum {{db db}} {
|
||||
# and checks to make sure SQLITE_INTERRUPT is returned. Eventually,
|
||||
# the routine completes successfully.
|
||||
#
|
||||
proc interrupt_test {testid sql result {initcnt 0}} {
|
||||
proc interrupt_test {testid sql result {initcnt 0} {maxcnt 1000000}} {
|
||||
set orig_sum [cksum]
|
||||
set i $initcnt
|
||||
while 1 {
|
||||
global sqlite_interrupt_count
|
||||
while {$i<$maxcnt} {
|
||||
incr i
|
||||
set ::sqlite_interrupt_count $i
|
||||
set sqlite_interrupt_count $i
|
||||
do_test $testid.$i.1 [format {
|
||||
set ::r [catchsql %s]
|
||||
set ::code [db errorcode]
|
||||
@@ -52,14 +53,14 @@ proc interrupt_test {testid sql result {initcnt 0}} {
|
||||
do_test $testid.$i.2 {
|
||||
cksum
|
||||
} $orig_sum
|
||||
} else {
|
||||
} elseif {$sqlite_interrupt_count>0} {
|
||||
do_test $testid.$i.99 {
|
||||
set ::r
|
||||
} [list 0 $result]
|
||||
break
|
||||
}
|
||||
}
|
||||
set ::sqlite_interrupt_count 0
|
||||
set sqlite_interrupt_count 0
|
||||
}
|
||||
|
||||
do_test interrupt-1.1 {
|
||||
@@ -68,7 +69,7 @@ do_test interrupt-1.1 {
|
||||
SELECT name FROM sqlite_master;
|
||||
}
|
||||
} {t1}
|
||||
interrupt_test interrupt-1.2 {DROP TABLE t1} {}
|
||||
interrupt_test interrupt-1.2 {DROP TABLE t1} {} 1 14
|
||||
do_test interrupt-1.3 {
|
||||
execsql {
|
||||
SELECT name FROM sqlite_master;
|
||||
@@ -162,4 +163,5 @@ for {set i 1} {$i<$max_count-5} {incr i 1} {
|
||||
} {1 interrupted}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
+9
-14
@@ -12,13 +12,6 @@
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern void qsort();
|
||||
extern double strtod();
|
||||
extern long strtol();
|
||||
extern void free();
|
||||
extern int access();
|
||||
extern int atoi();
|
||||
|
||||
#ifndef __WIN32__
|
||||
# if defined(_WIN32) || defined(WIN32)
|
||||
# define __WIN32__
|
||||
@@ -40,7 +33,6 @@ extern void *malloc();
|
||||
/******** From the file "action.h" *************************************/
|
||||
struct action *Action_new();
|
||||
struct action *Action_sort();
|
||||
void Action_add();
|
||||
|
||||
/********* From the file "assert.h" ************************************/
|
||||
void myassert();
|
||||
@@ -374,7 +366,7 @@ struct action *ap2;
|
||||
struct action *Action_sort(ap)
|
||||
struct action *ap;
|
||||
{
|
||||
ap = (struct action *)msort(ap,&ap->next,actioncmp);
|
||||
ap = (struct action *)msort((char *)ap,(char **)&ap->next,actioncmp);
|
||||
return ap;
|
||||
}
|
||||
|
||||
@@ -811,7 +803,7 @@ struct state *stp; /* The state from which successors are computed */
|
||||
|
||||
/* The state "newstp" is reached from the state "stp" by a shift action
|
||||
** on the symbol "sp" */
|
||||
Action_add(&stp->ap,SHIFT,sp,newstp);
|
||||
Action_add(&stp->ap,SHIFT,sp,(char *)newstp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,7 +904,7 @@ struct lemon *lemp;
|
||||
if( SetFind(cfp->fws,j) ){
|
||||
/* Add a reduce action to the state "stp" which will reduce by the
|
||||
** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */
|
||||
Action_add(&stp->ap,REDUCE,lemp->symbols[j],cfp->rp);
|
||||
Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1188,14 +1180,14 @@ struct lemon *lemp;
|
||||
|
||||
/* Sort the configuration list */
|
||||
void Configlist_sort(){
|
||||
current = (struct config *)msort(current,&(current->next),Configcmp);
|
||||
current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp);
|
||||
currentend = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Sort the basis configuration list */
|
||||
void Configlist_sortbasis(){
|
||||
basis = (struct config *)msort(current,&(current->bp),Configcmp);
|
||||
basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp);
|
||||
basisend = 0;
|
||||
return;
|
||||
}
|
||||
@@ -1447,6 +1439,7 @@ char **argv;
|
||||
fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict);
|
||||
}
|
||||
exit(lem.errorcnt + lem.nconflict);
|
||||
return (lem.errorcnt + lem.nconflict);
|
||||
}
|
||||
/******************** From the file "msort.c" *******************************/
|
||||
/*
|
||||
@@ -2876,7 +2869,7 @@ struct symbol *sp;
|
||||
struct lemon *lemp;
|
||||
int *lineno;
|
||||
{
|
||||
char *cp;
|
||||
char *cp = 0;
|
||||
|
||||
int linecnt = 0;
|
||||
if( sp->type==TERMINAL ){
|
||||
@@ -2890,6 +2883,8 @@ int *lineno;
|
||||
cp = lemp->vardest;
|
||||
if( cp==0 ) return;
|
||||
fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename);
|
||||
}else{
|
||||
assert( 0 ); /* Cannot happen */
|
||||
}
|
||||
for(; *cp; cp++){
|
||||
if( *cp=='$' && cp[1]=='$' ){
|
||||
|
||||
Reference in New Issue
Block a user