mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Do not call the xDisconnect method on a virtual table while xUpdate is
pending. Instead, defer the xDisconnect until after xUpdate completes. (CVS 3387) FossilOrigin-Name: 61148f4c36255c4ed3552f888fa75252b300589d
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Test\sfor\sbusted\sTCL\sbuilds\sthat\sdo\snot\ssupport\s64-bit\sintegers\sand\sprint\na\swarning\smessage\sto\susers\sthat\stest\sfailures\smay\sbe\sa\sresult\sof\sthe\sbad\nTCL\sbuild\sand\snot\ssome\sproblem\swith\sSQLite.\s\sTicket\s#1953.\s(CVS\s3386)
|
C Do\snot\scall\sthe\sxDisconnect\smethod\son\sa\svirtual\stable\swhile\sxUpdate\sis\npending.\s\sInstead,\sdefer\sthe\sxDisconnect\suntil\safter\sxUpdate\scompletes.\s(CVS\s3387)
|
||||||
D 2006-09-02T14:50:24
|
D 2006-09-02T20:57:52
|
||||||
F Makefile.in 659b63368cfbb95a224c9d2f2a9897802d96a4ea
|
F Makefile.in 659b63368cfbb95a224c9d2f2a9897802d96a4ea
|
||||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -88,7 +88,7 @@ F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
|||||||
F src/shell.c 3496a1b0a23a6b77f90231b9e2f521fd93dcb5b1
|
F src/shell.c 3496a1b0a23a6b77f90231b9e2f521fd93dcb5b1
|
||||||
F src/sqlite.h.in 84ac26ca94a84dd603fb57a27d862f51bfd9f687
|
F src/sqlite.h.in 84ac26ca94a84dd603fb57a27d862f51bfd9f687
|
||||||
F src/sqlite3ext.h 11a046b3519c4b9b7709e6d6a95c3a36366f684a
|
F src/sqlite3ext.h 11a046b3519c4b9b7709e6d6a95c3a36366f684a
|
||||||
F src/sqliteInt.h 325a2d45be2b22c1e21ad649e0a898c74eaec7de
|
F src/sqliteInt.h 259adce944cc3b28da1fa3df9beb9ba86017a45d
|
||||||
F src/table.c d8817f43a6c6bf139487db161760b9e1e02da3f1
|
F src/table.c d8817f43a6c6bf139487db161760b9e1e02da3f1
|
||||||
F src/tclsqlite.c e029f739bed90071789fe81a226d53e97a80a4d8
|
F src/tclsqlite.c e029f739bed90071789fe81a226d53e97a80a4d8
|
||||||
F src/test1.c cb3688f5d2094dc708a7959bd99aed411e096e49
|
F src/test1.c cb3688f5d2094dc708a7959bd99aed411e096e49
|
||||||
@@ -112,14 +112,14 @@ F src/update.c 951f95ef044cf6d28557c48dc35cb0711a0b9129
|
|||||||
F src/utf.c 4459801e9b00cfd69993bfca58545d3775682d6e
|
F src/utf.c 4459801e9b00cfd69993bfca58545d3775682d6e
|
||||||
F src/util.c 5409031819ee4672c5f9c3ac7cf517e267a25845
|
F src/util.c 5409031819ee4672c5f9c3ac7cf517e267a25845
|
||||||
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
|
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
|
||||||
F src/vdbe.c 24c2cc3b08223140b45d15d05644210ac4363573
|
F src/vdbe.c a77869949ddd0afe01443611edb949e24e67c91c
|
||||||
F src/vdbe.h 258b5d1c0aaa72192f09ff0568ce42b383f156fa
|
F src/vdbe.h 258b5d1c0aaa72192f09ff0568ce42b383f156fa
|
||||||
F src/vdbeInt.h e3eaab262b67b84474625cfc38aec1125c32834b
|
F src/vdbeInt.h e3eaab262b67b84474625cfc38aec1125c32834b
|
||||||
F src/vdbeapi.c 81f531d7dc5c898131b02ef85f6c6144ab2892cf
|
F src/vdbeapi.c 81f531d7dc5c898131b02ef85f6c6144ab2892cf
|
||||||
F src/vdbeaux.c 9fab61427a0741c9c123e8ff16e349b1f90397be
|
F src/vdbeaux.c 9fab61427a0741c9c123e8ff16e349b1f90397be
|
||||||
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
||||||
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
|
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
|
||||||
F src/vtab.c 6067f9ec011880fadb04be1ca24dbe30c575a5bf
|
F src/vtab.c 7fc0624c2bb6156c3d99e2ce706f2a5b54094e36
|
||||||
F src/where.c 75a89957fcb8c068bec55caa4e9d2ed5fa0b0724
|
F src/where.c 75a89957fcb8c068bec55caa4e9d2ed5fa0b0724
|
||||||
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
|
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
@@ -395,7 +395,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||||
P 098cbafcd6dcf57142b0417e796d27ffddcc0920
|
P ca864ee913ea5ae88761e617bcac300ffa339369
|
||||||
R a457dec7946d047fe968e63a72fc157e
|
R a007e2ad3282d7bf3c46df0a1cb84279
|
||||||
U drh
|
U drh
|
||||||
Z f4d682ad54f7e32ce0b41ddbb807a8aa
|
Z cb0935641e94f4c2fc376bd17950fce1
|
||||||
|
@@ -1 +1 @@
|
|||||||
ca864ee913ea5ae88761e617bcac300ffa339369
|
61148f4c36255c4ed3552f888fa75252b300589d
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.524 2006/08/23 20:07:22 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.525 2006/09/02 20:57:52 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@@ -1862,6 +1862,8 @@ int sqlite3OpenTempDatabase(Parse *);
|
|||||||
int sqlite3VtabRollback(sqlite3 *db);
|
int sqlite3VtabRollback(sqlite3 *db);
|
||||||
int sqlite3VtabCommit(sqlite3 *db);
|
int sqlite3VtabCommit(sqlite3 *db);
|
||||||
#endif
|
#endif
|
||||||
|
void sqlite3VtabLock(sqlite3_vtab*);
|
||||||
|
void sqlite3VtabUnlock(sqlite3_vtab*);
|
||||||
void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*);
|
void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*);
|
||||||
void sqlite3VtabFinishParse(Parse*, Token*);
|
void sqlite3VtabFinishParse(Parse*, Token*);
|
||||||
void sqlite3VtabArgInit(Parse*);
|
void sqlite3VtabArgInit(Parse*);
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
** in this file for details. If in doubt, do not deviate from existing
|
** in this file for details. If in doubt, do not deviate from existing
|
||||||
** commenting and indentation practices when changing or adding code.
|
** commenting and indentation practices when changing or adding code.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.574 2006/08/15 14:21:16 drh Exp $
|
** $Id: vdbe.c,v 1.575 2006/09/02 20:57:52 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -4857,7 +4857,9 @@ case OP_VUpdate: { /* no-push */
|
|||||||
apArg[i] = pX;
|
apArg[i] = pX;
|
||||||
}
|
}
|
||||||
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
|
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
|
||||||
|
sqlite3VtabLock(pVtab);
|
||||||
rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
|
rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
|
||||||
|
sqlite3VtabUnlock(pVtab);
|
||||||
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
|
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
|
||||||
if( pOp->p1 && rc==SQLITE_OK ){
|
if( pOp->p1 && rc==SQLITE_OK ){
|
||||||
assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );
|
assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );
|
||||||
|
37
src/vtab.c
37
src/vtab.c
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file contains code used to help implement virtual tables.
|
** This file contains code used to help implement virtual tables.
|
||||||
**
|
**
|
||||||
** $Id: vtab.c,v 1.30 2006/09/02 14:17:00 drh Exp $
|
** $Id: vtab.c,v 1.31 2006/09/02 20:57:52 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -40,6 +40,29 @@ int sqlite3_create_module(
|
|||||||
return sqlite3ApiExit(db, SQLITE_OK);
|
return sqlite3ApiExit(db, SQLITE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Lock the virtual table so that it cannot be disconnected.
|
||||||
|
** Locks nest. Every lock should have a corresponding unlock.
|
||||||
|
** If an unlock is omitted, resources leaks will occur.
|
||||||
|
**
|
||||||
|
** If a disconnect is attempted while a virtual table is locked,
|
||||||
|
** the disconnect is deferred until all locks have been removed.
|
||||||
|
*/
|
||||||
|
void sqlite3VtabLock(sqlite3_vtab *pVtab){
|
||||||
|
pVtab->nRef++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Unlock a virtual table. When the last lock is removed,
|
||||||
|
** disconnect the virtual table.
|
||||||
|
*/
|
||||||
|
void sqlite3VtabUnlock(sqlite3_vtab *pVtab){
|
||||||
|
pVtab->nRef--;
|
||||||
|
if( pVtab->nRef==0 ){
|
||||||
|
pVtab->pModule->xDisconnect(pVtab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Clear any and all virtual-table information from the Table record.
|
** Clear any and all virtual-table information from the Table record.
|
||||||
** This routine is called, for example, just before deleting the Table
|
** This routine is called, for example, just before deleting the Table
|
||||||
@@ -49,10 +72,7 @@ void sqlite3VtabClear(Table *p){
|
|||||||
sqlite3_vtab *pVtab = p->pVtab;
|
sqlite3_vtab *pVtab = p->pVtab;
|
||||||
if( pVtab ){
|
if( pVtab ){
|
||||||
assert( p->pMod && p->pMod->pModule );
|
assert( p->pMod && p->pMod->pModule );
|
||||||
pVtab->nRef--;
|
sqlite3VtabUnlock(pVtab);
|
||||||
if( pVtab->nRef==0 ){
|
|
||||||
pVtab->pModule->xDisconnect(pVtab);
|
|
||||||
}
|
|
||||||
p->pVtab = 0;
|
p->pVtab = 0;
|
||||||
}
|
}
|
||||||
if( p->azModuleArg ){
|
if( p->azModuleArg ){
|
||||||
@@ -359,7 +379,7 @@ static int addToVTrans(sqlite3 *db, sqlite3_vtab *pVtab){
|
|||||||
|
|
||||||
/* Add pVtab to the end of sqlite3.aVTrans */
|
/* Add pVtab to the end of sqlite3.aVTrans */
|
||||||
db->aVTrans[db->nVTrans++] = pVtab;
|
db->aVTrans[db->nVTrans++] = pVtab;
|
||||||
pVtab->nRef++;
|
sqlite3VtabLock(pVtab);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,10 +512,7 @@ static void callFinaliser(sqlite3 *db, int offset){
|
|||||||
int (*x)(sqlite3_vtab *);
|
int (*x)(sqlite3_vtab *);
|
||||||
x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
|
x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
|
||||||
if( x ) x(pVtab);
|
if( x ) x(pVtab);
|
||||||
pVtab->nRef--;
|
sqlite3VtabUnlock(pVtab);
|
||||||
if( pVtab->nRef==0 ){
|
|
||||||
pVtab->pModule->xDisconnect(pVtab);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sqliteFree(db->aVTrans);
|
sqliteFree(db->aVTrans);
|
||||||
db->nVTrans = 0;
|
db->nVTrans = 0;
|
||||||
|
Reference in New Issue
Block a user