From: drh Date: Thu, 10 Apr 2008 18:35:21 +0000 (+0000) Subject: Correctly handle virtual tables that are created and dropped all within X-Git-Tag: version-3.6.10~1192 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=665850fbef9f50e4dd0872fccd098767028bb1c3;p=thirdparty%2Fsqlite.git Correctly handle virtual tables that are created and dropped all within a single transaction. Ticket #2994. (CVS 4985) FossilOrigin-Name: 0acb1b428d1181f597a2a665cae3eef5775f15f1 --- diff --git a/manifest b/manifest index 5557214c1b..600600fb3e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s--ostrace\sand\s--ossummary\soptions\sto\stester.tcl.\sTo\slog\scalls\sthe\svfs\slayer\sfrom\swithin\stest\sscripts.\s(CVS\s4984) -D 2008-04-10T17:27:39 +C Correctly\shandle\svirtual\stables\sthat\sare\screated\sand\sdropped\sall\swithin\na\ssingle\stransaction.\s\sTicket\s#2994.\s(CVS\s4985) +D 2008-04-10T18:35:22 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in b861627d91df5ee422c54237aa38296954dc0151 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -183,7 +183,7 @@ F src/vdbeaux.c 0aa2d8ede6bdb4379c36491c14d9779221bf196d F src/vdbeblob.c cc713c142c3d4952b380c98ee035f850830ddbdb F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736 F src/vdbemem.c 095e18f84b3171a5f2d71fa93a4bfc64220c1cfe -F src/vtab.c 00cd16317b29495c185ff40e4b227917d5a371b2 +F src/vtab.c f5e78bf73df3b0c1b53861109c1b2e0800b108cc F src/where.c a686f1e04f1ce5515a801fb3f3a358ef2cbb6ed2 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -535,6 +535,7 @@ F test/vtab7.test a8c3c3cb3eb60be364991bd714e4927e26c4cd85 F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583 F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b F test/vtabA.test 9cb6b1afead6fdd91bbdf1ca65c44ccfd9b10936 +F test/vtabB.test a02264feac9e41a7696869dbd6f993a8b597f7c3 F test/vtab_alter.test 3a299749fee97ca3d53bd55717f536e4a2284856 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test c19b2555b807ef2ee014c882cdda5bc8d84fcf48 @@ -626,7 +627,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 5be56dbe879f89351239accf5069e4cb166e0792 -R d1764f0c0bff8d613b92eb445b05f051 -U danielk1977 -Z 5ce16846520ccc3e314c2b13bb59694a +P e1322415d0ca2d6b45f35ef9257b37161ec043e2 +R 960260f49432fa437b9ba29c71e0b40e +U drh +Z a3b69fd90c8092644f44487d1febdaf0 diff --git a/manifest.uuid b/manifest.uuid index 78b7774805..d8f456e9f8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e1322415d0ca2d6b45f35ef9257b37161ec043e2 \ No newline at end of file +0acb1b428d1181f597a2a665cae3eef5775f15f1 \ No newline at end of file diff --git a/src/vtab.c b/src/vtab.c index eec604b3c0..e3a9b8bb1d 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to help implement virtual tables. ** -** $Id: vtab.c,v 1.65 2008/03/06 09:58:50 mlcreech Exp $ +** $Id: vtab.c,v 1.66 2008/04/10 18:35:22 drh Exp $ */ #ifndef SQLITE_OMIT_VIRTUALTABLE #include "sqliteInt.h" @@ -596,6 +596,13 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab) } (void)sqlite3SafetyOn(db); if( rc==SQLITE_OK ){ + int i; + for(i=0; inVTrans; i++){ + if( db->aVTrans[i]==pTab->pVtab ){ + db->aVTrans[i] = db->aVTrans[--db->nVTrans]; + break; + } + } pTab->pVtab = 0; } } diff --git a/test/vtabB.test b/test/vtabB.test new file mode 100644 index 0000000000..f3f5d2ce3f --- /dev/null +++ b/test/vtabB.test @@ -0,0 +1,38 @@ +# 2008 April 10 +# +# 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 implements regression tests for SQLite library. The +# focus of this file is is verifying that a virtual table in the +# TEMP database that is created and dropped within a transaction +# is handled correctly. Ticket #2994. + +# +# $Id: vtabB.test,v 1.1 2008/04/10 18:35:22 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +ifcapable !vtab { + finish_test + return +} + +do_test vtabB-1.1 { + register_echo_module [sqlite3_connection_pointer db] + execsql { + CREATE TABLE t1(x); + BEGIN; + CREATE VIRTUAL TABLE temp.echo_test1 USING echo(t1); + DROP TABLE echo_test1; + ROLLBACK; + } +} {} + +finish_test