-C Patches\sto\sget\sthings\sworking\sbetter\sfor\sOS2.\s\sTicket\s#1836.\s(CVS\s3217)
-D 2006-06-12T12:57:46
+C Add\scode\sto\sinvoke\sthe\sxDestroy\smethod\sof\sa\svirtual\stable\swhen\sit\sis\sdropped.\s(CVS\s3218)
+D 2006-06-12T16:01:22
F Makefile.in 56fd6261e83f60724e6dcd764e06ab68cbd53909
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c ed343b3dbcbc7da9ac481ef2b98c4239fe6d9629
F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d
-F src/build.c 0781f85451caefe6419eaa8d04b65fd3150cef2c
+F src/build.c 133a046cef19c8bc80dafb38bb82229caefd6fff
F src/callback.c fd9bb39f7ff6b52bad8365617abc61c720640429
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
F src/shell.c 55bf6335dae7146f7a300039f5d6bb35010f1996
F src/sqlite.h.in cad97e59cfad8337f9f43ea9662714a256ca80b2
F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75
-F src/sqliteInt.h b77822681ec59f3ec57b921a1d8c1b47a8c3e18f
+F src/sqliteInt.h a617f13e11e05f78a8fa55756591eba9a59c9dbc
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
F src/tclsqlite.c 0b2a04cfc1b4298adfbe90a754cfbbe207aca11a
F src/test1.c 88291fa6674dcd409b1c9d76d3119151d4b81a50
F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
F src/util.c ca6ee72772c0f5dc04d2e0ab1973fd3b6a9bf79d
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
-F src/vdbe.c 5c77e8b57c07e7776ec34df8088749c639bbfe7c
+F src/vdbe.c 7002df8e881e4a977c57d504287b5a30f84b8d37
F src/vdbe.h 190d85a37658c2397be75a4c70bbc02ebc4ec0ba
F src/vdbeInt.h 85cd5f81d38edb1b8f4786f407c77a7a3ba636fb
F src/vdbeapi.c 7dc662e7c905ce666bb506dced932e0307115cbf
F src/vdbeaux.c 4002e6b19d7c9719cb81f9797316b9ad118e4370
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
-F src/vtab.c 430228a2c920138d528e9937b3123bedffeb10b6
+F src/vtab.c 4ec6ac7e5e4fccb38401285d0e329d018622859f
F src/where.c 3dc5269ba552c0db39247f6bbc98b312ae786863
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 16e2774fe35e47a07ac4471b7f0bcc948b1aa6d5
-F test/vtab1.test 79369c49f7607300ce62cf8b10ea56eb604f106f
+F test/vtab1.test d3d4d38bd6fccb2ecec25357d9696bfea38d61e4
F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df
F test/where2.test a16476a5913e75cf65b38f2daa6157a6b7791394
F test/where3.test 3b5ad2c58069e12be2bd86bc5e211a82810521aa
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 54b30fe1bdf0c9e690e12f07dcce4382e863bf02
-R c82c985d39a094d0be35353a73bbb871
-U drh
-Z d677de0ba67b5d1d1c7872ed912e52cc
+P 65c6e5e117b9194015e382b1ad9bb9c88704eeb7
+R 5c6b73fe0e6f68c2a41a34bb9e99f68c
+U danielk1977
+Z 4c06df1b2df27b4be5379aebd6a5dbae
-65c6e5e117b9194015e382b1ad9bb9c88704eeb7
\ No newline at end of file
+f0c7c8d12c04376e48c6d53a29cfae3fa13b52cf
\ No newline at end of file
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.398 2006/06/12 12:08:45 danielk1977 Exp $
+** $Id: build.c,v 1.399 2006/06/12 16:01:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
** the schema cookie.
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
- if( pTab->isEphem ){
+ if( pTab->isVirtual ){
sqlite3VdbeOp3(v, OP_VDestroy, iDb, 0, pTab->zName, 0);
- }else
-#endif
- {
- sqlite3VdbeOp3(v, OP_DropTable, iDb, 0, pTab->zName, 0);
}
+#endif
+ sqlite3VdbeOp3(v, OP_DropTable, iDb, 0, pTab->zName, 0);
sqlite3ChangeCookie(db, v, iDb);
}
sqliteViewResetAll(db, iDb);
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.500 2006/06/12 12:08:45 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.501 2006/06/12 16:01:22 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
void sqlite3VtabArgExtend(Parse*, Token*);
int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
int sqlite3VtabCallConnect(Parse*, Table*);
+int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
#ifdef SQLITE_SSE
#include "sseInt.h"
** 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.552 2006/06/12 06:09:19 danielk1977 Exp $
+** $Id: vdbe.c,v 1.553 2006/06/12 16:01:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#endif /* SQLITE_OMIT_VIRTUALTABLE */
#ifndef SQLITE_OMIT_VIRTUALTABLE
-/* Opcode: VDestroy * * P3
+/* Opcode: VDestroy P1 * P3
**
-** P3 is the name of a virtual table. Call the xDestroy method for
-** that table.
+** P3 is the name of a virtual table in database P1. Call the xDestroy method
+** of that table.
*/
case OP_VDestroy: {
+ rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p3);
break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
*************************************************************************
** This file contains code used to help implement virtual tables.
**
-** $Id: vtab.c,v 1.4 2006/06/12 12:08:45 danielk1977 Exp $
+** $Id: vtab.c,v 1.5 2006/06/12 16:01:22 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
return rc;
}
+/*
+** This function is invoked by the vdbe to call the xDestroy method
+** of the virtual table named zTab in database iDb. This occurs
+** when a DROP TABLE is mentioned.
+**
+** This call is a no-op if zTab is not a virtual table.
+*/
+int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab)
+{
+ int rc = SQLITE_OK;
+ Table *pTab;
+ sqlite3_module *pModule;
+
+ pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
+ pModule = pTab->pModule;
+ assert(pTab);
+ if( pTab->pVtab ){
+ rc = sqlite3SafetyOff(db);
+ assert( rc==SQLITE_OK );
+ rc = pModule->xDestroy(pTab->pVtab);
+ sqlite3SafetyOn(db);
+ if( rc==SQLITE_OK ){
+ pTab->pVtab = 0;
+ }
+ }
+
+ return rc;
+}
+
#endif /* SQLITE_OMIT_VIRTUALTABLE */
# This file implements regression tests for SQLite library. The
# focus of this file is creating and dropping virtual tables.
#
-# $Id: vtab1.test,v 1.5 2006/06/12 12:50:23 drh Exp $
+# $Id: vtab1.test,v 1.6 2006/06/12 16:01:23 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
2 c {} 0 {} 0 \
]
+# Drop the table t2. This should cause the xDestroy (but not xDisconnect)
+# method to be invoked.
+do_test vtab1-2.5 {
+ set echo_module [list]
+ execsql {
+ DROP TABLE t2;
+ }
+ set echo_module
+} [list xDestroy]
+do_test vtab1-2.6 {
+ execsql {
+ PRAGMA table_info(t2);
+ }
+} {}
+do_test vtab1-2.7 {
+ execsql {
+ SELECT sql FROM sqlite_master;
+ }
+} [list {CREATE VIRTUAL TABLE t1 USING echo} \
+ {CREATE TABLE template(a, b, c)} \
+]
+
finish_test