From 3914aed1de102062f8d41585c7c21451c75f8917 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 31 Jan 2004 20:40:42 +0000 Subject: [PATCH] Fix a bug introduced by the previous check-in. (CVS 1205) FossilOrigin-Name: 04cf22785e68fcd4098e6c10a89386108cd0bf07 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbe.c | 40 +++++++++++++++++++++++++++++++--------- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 0e83576f0d..ece5381fde 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\sfew\smore\soptimizations\sto\sthe\sVDBE.\s(CVS\s1204) -D 2004-01-31T20:20:30 +C Fix\sa\sbug\sintroduced\sby\sthe\sprevious\scheck-in.\s(CVS\s1205) +D 2004-01-31T20:40:42 F Makefile.in 0515ff9218ad8d5a8f6220f0494b8ef94c67013b F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -61,7 +61,7 @@ F src/trigger.c ce83e017b407d046e909d05373d7f8ee70f9f7f9 F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397 F src/util.c 64995b5949a5d377629ffd2598747bc771cade1e F src/vacuum.c 77485a64a6e4e358170f150fff681c1624a092b0 -F src/vdbe.c cdfe403fca26d94d5dc4e71203430a9b4868f474 +F src/vdbe.c fe0375e2301dae608a0ca8059c71557b0f5047a2 F src/vdbe.h 3957844e46fea71fd030e78f6a3bd2f7e320fb43 F src/vdbeInt.h 8a3baf749115cba81a810b7a52208aef055eda7b F src/vdbeaux.c c55d87d6658487e87ef09ca80c1aa2f314024fed @@ -182,7 +182,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 8273c74bd09d1a044cb5154498b0a39939f6e3ed -R 5979f6a29680231f50461ce8d475a67c +P 06e7ff4cb8c73fd690c6d5b5f530a30d83f4f10c +R ff7fd92d976b4f09b582d8f23eb657e9 U drh -Z 0a73371f8b29d88670c381a23920fe41 +Z 2fd2d1288462765557d2cdab9570e192 diff --git a/manifest.uuid b/manifest.uuid index 35dad5e90a..baaf37f24a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -06e7ff4cb8c73fd690c6d5b5f530a30d83f4f10c \ No newline at end of file +04cf22785e68fcd4098e6c10a89386108cd0bf07 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index a0af8b7596..f738b743fb 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.254 2004/01/31 20:20:30 drh Exp $ +** $Id: vdbe.c,v 1.255 2004/01/31 20:40:42 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -524,14 +524,16 @@ int sqliteVdbeExec( ** If the progress callback returns non-zero, exit the virtual machine with ** a return code SQLITE_ABORT. */ - if( db->xProgress && (db->nProgressOps==nProgressOps) ){ - if( db->xProgress(db->pProgressArg)!=0 ){ - rc = SQLITE_ABORT; - continue; /* skip to the next iteration of the for loop */ + if( db->xProgress ){ + if( db->nProgressOps==nProgressOps ){ + if( db->xProgress(db->pProgressArg)!=0 ){ + rc = SQLITE_ABORT; + continue; /* skip to the next iteration of the for loop */ + } + nProgressOps = 0; } - nProgressOps = 0; + nProgressOps++; } - nProgressOps++; #endif switch( pOp->opcode ){ @@ -4488,8 +4490,10 @@ case OP_AggGet: { pTos++; pMem = &pFocus->aMem[i]; *pTos = *pMem; - pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short); - pTos->flags |= MEM_Ephem; + if( pTos->flags & MEM_Str ){ + pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short); + pTos->flags |= MEM_Ephem; + } break; } @@ -4703,6 +4707,24 @@ default: { ** the evaluator loop. So we can leave it out when NDEBUG is defined. */ #ifndef NDEBUG + /* Sanity checking on the top element of the stack */ + if( pTos>=p->aStack ){ + assert( pTos->flags!=0 ); /* Must define some type */ + if( pTos->flags & MEM_Str ){ + int x = pTos->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short); + assert( x!=0 ); /* Strings must define a string subtype */ + assert( (x & (x-1))==0 ); /* Only one string subtype can be defined */ + assert( pTos->z!=0 ); /* Strings must have a value */ + /* Mem.z points to Mem.zShort iff the subtype is MEM_Short */ + assert( (pTos->flags & MEM_Short)==0 || pTos->z==pTos->zShort ); + assert( (pTos->flags & MEM_Short)!=0 || pTos->z!=pTos->zShort ); + }else{ + /* Cannot define a string subtype for non-string objects */ + assert( (pTos->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short))==0 ); + } + /* MEM_Null excludes all other types */ + assert( pTos->flags==MEM_Null || (pTos->flags&MEM_Null)==0 ); + } if( pc<-1 || pc>=p->nOp ){ sqliteSetString(&p->zErrMsg, "jump destination out of range", (char*)0); rc = SQLITE_INTERNAL;