]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Replace the Vdbe.inVtabMethod field with the sqlite3.nVDestroy counter.
authordrh <drh@noemail.net>
Tue, 24 Mar 2015 12:51:52 +0000 (12:51 +0000)
committerdrh <drh@noemail.net>
Tue, 24 Mar 2015 12:51:52 +0000 (12:51 +0000)
FossilOrigin-Name: 9faefb96272967e731e83ef516a8c1e1b876391b

manifest
manifest.uuid
src/sqliteInt.h
src/vdbe.c
src/vdbeInt.h
src/vdbeaux.c

index 9bc40202193c5d01eb999349fbcf2480172cd255..5c9a4c03305c1b136fa75e29efdf1ea38d637431 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Disable\sloadable\sextensions\sin\sthe\scommand-line\sshell\son\sVxWorks\suser-space.
-D 2015-03-23T21:32:50.879
+C Replace\sthe\sVdbe.inVtabMethod\sfield\swith\sthe\ssqlite3.nVDestroy\scounter.
+D 2015-03-24T12:51:52.656
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 88a3e6261286db378fdffa1124cad11b3c05f5bb
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -235,7 +235,7 @@ F src/shell.c 3ae1e53878d2804fe77b8c8f1f6ca287a0e5d80e
 F src/sqlite.h.in df180ecc3215e4b87dbd536507869511bec88841
 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
 F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
-F src/sqliteInt.h e22a2bfbeed55ed3addff5e0ef34366e93ad0874
+F src/sqliteInt.h bedf15914c09bfb5fe3ec4e3f211a4a6fc42cd33
 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
 F src/status.c 2e5c86866ff2f30988ce10ddbaa7ba2eaf6d4146
 F src/table.c e7a09215315a978057fb42c640f890160dbcc45e
@@ -293,11 +293,11 @@ F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13
 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
 F src/util.c 98a7627ca48ad3265b6940915a1d08355eb3fc7e
 F src/vacuum.c 9460b9de7b2d4e34b0d374894aa6c8a0632be8ec
-F src/vdbe.c bd793ed436edccaf264ec969ac92c9b5f4b41d64
+F src/vdbe.c 884faa91c44023891d0992311fd0feed0df060fc
 F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3
-F src/vdbeInt.h bb56fd199d8af1a2c1b9639ee2f70724b4338e3a
+F src/vdbeInt.h 9cbaa84f53ddd2d09a0cf61a94337a3a035d08a0
 F src/vdbeapi.c 583d56b129dd27f12bed518270de9ebe521e6a75
-F src/vdbeaux.c 23390670e64f011f3fed8f38a2f25aaccacb74d2
+F src/vdbeaux.c d62823d72b8f69a3e64deb03c30e959af285e488
 F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
 F src/vdbemem.c c0dc81285b7571b0a31c40f17846fe2397ec1cd9
 F src/vdbesort.c 919717d7599fa31d343ec28bffd0f9e91a4ff5f6
@@ -1246,7 +1246,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 6fc4e79a2350295a15ac464593ad39d904953041
-R f88d42f63f5075e0fafdf77b9c8623bb
+P 0ee2d38deb35aefc55395e86984a9a773caf6218
+R 8a156978483ce9f9262ab29d0045e64e
+T *branch * nVDestroy
+T *sym-nVDestroy *
+T -sym-trunk *
 U drh
-Z b5778fea5ecdfe311fd40aa2979f5026
+Z 795f6417c17436a4fbd09f9a73f096f4
index 4f62d697cbd8d5fd353b92f4e42900fce0630b44..9e51355abe286a4d13202252f3da15b2899d0ba0 100644 (file)
@@ -1 +1 @@
-0ee2d38deb35aefc55395e86984a9a773caf6218
\ No newline at end of file
+9faefb96272967e731e83ef516a8c1e1b876391b
\ No newline at end of file
index 2b1d7ebc6e8df4afceaffcff5083f195d1ded8e5..9df6d1bc4e795e71892567d56026b45485daced5 100644 (file)
@@ -1112,6 +1112,7 @@ struct sqlite3 {
   int nVdbeRead;                /* Number of active VDBEs that read or write */
   int nVdbeWrite;               /* Number of active VDBEs that read and write */
   int nVdbeExec;                /* Number of nested calls to VdbeExec() */
+  int nVDestroy;                /* Number of active OP_VDestroy operations */
   int nExtension;               /* Number of loaded extensions */
   void **aExtension;            /* Array of shared library handles */
   void (*xTrace)(void*,const char*);        /* Trace function */
index 7d6d2b4f5d439d40b697b7321ad6b39dadc93216..bba6a90bf4dbf742a89d111989a4308610b964cb 100644 (file)
@@ -4946,30 +4946,15 @@ case OP_IdxGE:  {       /* jump */
 */
 case OP_Destroy: {     /* out2-prerelease */
   int iMoved;
-  int iCnt;
-  Vdbe *pVdbe;
   int iDb;
 
   assert( p->readOnly==0 );
-#ifndef SQLITE_OMIT_VIRTUALTABLE
-  iCnt = 0;
-  for(pVdbe=db->pVdbe; pVdbe; pVdbe = pVdbe->pNext){
-    if( pVdbe->magic==VDBE_MAGIC_RUN && pVdbe->bIsReader 
-     && pVdbe->inVtabMethod<2 && pVdbe->pc>=0 
-    ){
-      iCnt++;
-    }
-  }
-#else
-  iCnt = db->nVdbeRead;
-#endif
   pOut->flags = MEM_Null;
-  if( iCnt>1 ){
+  if( db->nVdbeRead > db->nVDestroy+1 ){
     rc = SQLITE_LOCKED;
     p->errorAction = OE_Abort;
   }else{
     iDb = pOp->p3;
-    assert( iCnt==1 );
     assert( DbMaskTest(p->btreeMask, iDb) );
     iMoved = 0;  /* Not needed.  Only to silence a warning. */
     rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);
@@ -6060,9 +6045,9 @@ case OP_VCreate: {
 ** of that table.
 */
 case OP_VDestroy: {
-  p->inVtabMethod = 2;
+  db->nVDestroy++;
   rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);
-  p->inVtabMethod = 0;
+  db->nVDestroy--;
   break;
 }
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -6161,9 +6146,7 @@ case OP_VFilter: {   /* jump */
       apArg[i] = &pArgc[i+1];
     }
 
-    p->inVtabMethod = 1;
     rc = pModule->xFilter(pVtabCursor, iQuery, pOp->p4.z, nArg, apArg);
-    p->inVtabMethod = 0;
     sqlite3VtabImportErrmsg(p, pVtab);
     if( rc==SQLITE_OK ){
       res = pModule->xEof(pVtabCursor);
@@ -6253,9 +6236,7 @@ case OP_VNext: {   /* jump */
   ** data is available) and the error code returned when xColumn or
   ** some other method is next invoked on the save virtual table cursor.
   */
-  p->inVtabMethod = 1;
   rc = pModule->xNext(pCur->pVtabCursor);
-  p->inVtabMethod = 0;
   sqlite3VtabImportErrmsg(p, pVtab);
   if( rc==SQLITE_OK ){
     res = pModule->xEof(pCur->pVtabCursor);
index 877da1143ca6a1e44c9716b542814337e36552b0..d3955af31e86b28802e7060b684d116d548cac2d 100644 (file)
@@ -313,14 +313,6 @@ struct ScanStatus {
 **
 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
 ** is really a pointer to an instance of this structure.
-**
-** The Vdbe.inVtabMethod variable is set to non-zero for the duration of
-** any virtual table method invocations made by the vdbe program. It is
-** set to 2 for xDestroy method calls and 1 for all other methods. This
-** variable is used for two purposes: to allow xDestroy methods to execute
-** "DROP TABLE" statements and to prevent some nasty side effects of
-** malloc failure when SQLite is invoked recursively by a virtual table 
-** method function.
 */
 struct Vdbe {
   sqlite3 *db;            /* The database connection that owns this statement */
@@ -351,7 +343,6 @@ struct Vdbe {
   u8 errorAction;         /* Recovery action to do in case of an error */
   u8 minWriteFileFormat;  /* Minimum file format for writable database files */
   bft explain:2;          /* True if EXPLAIN present on SQL command */
-  bft inVtabMethod:2;     /* See comments above */
   bft changeCntOn:1;      /* True to update the change-counter */
   bft expired:1;          /* True if the VM needs to be recompiled */
   bft runOnlyOnce:1;      /* Automatically expire on reset */
index 9c105cc9e7ff0192a042374d5749f62d73f31eaf..8397fbc10d059b2e60decd772cea53249b582e8c 100644 (file)
@@ -1782,9 +1782,7 @@ void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
   else if( pCx->pVtabCursor ){
     sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor;
     const sqlite3_module *pModule = pVtabCursor->pVtab->pModule;
-    p->inVtabMethod = 1;
     pModule->xClose(pVtabCursor);
-    p->inVtabMethod = 0;
   }
 #endif
 }