diff options
author | drh <drh@noemail.net> | 2008-04-28 18:46:43 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-04-28 18:46:43 +0000 |
commit | 4f3dd1502e052b7dd3f1581aec32f294710a84d9 (patch) | |
tree | e4eb1c0c94156658870aeb25f039f66cee405a34 /src/vtab.c | |
parent | 952856ad3a297443dfd175655f1988e275296ff5 (diff) | |
download | sqlite-4f3dd1502e052b7dd3f1581aec32f294710a84d9.tar.gz sqlite-4f3dd1502e052b7dd3f1581aec32f294710a84d9.zip |
Make sure that transactions are started on all virtual tables that
changes in a single statement, not just the first. Ticket #3083.
Need to add test cases. (CVS 5063)
FossilOrigin-Name: 133b7ee50ea6012739ebe0e334374c5d9b1fcc7f
Diffstat (limited to 'src/vtab.c')
-rw-r--r-- | src/vtab.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/vtab.c b/src/vtab.c index 281716262..c3d7ee2db 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.67 2008/04/27 18:40:12 drh Exp $ +** $Id: vtab.c,v 1.68 2008/04/28 18:46:43 drh Exp $ */ #ifndef SQLITE_OMIT_VIRTUALTABLE #include "sqliteInt.h" @@ -802,4 +802,23 @@ FuncDef *sqlite3VtabOverloadFunction( return pNew; } +/* +** Make sure virtual table pTab is contained in the pParse->apVirtualLock[] +** array so that an OP_VBegin will get generated for it. Add pTab to the +** array if it is missing. If pTab is already in the array, this routine +** is a no-op. +*/ +void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ + int i, n; + assert( IsVirtual(pTab) ); + for(i=0; i<pParse->nVtabLock; i++){ + if( pTab==pParse->apVtabLock[i] ) return; + } + n = (pParse->nVtabLock+1)*sizeof(pParse->apVtabLock[0]); + pParse->apVtabLock = sqlite3_realloc(pParse->apVtabLock, n); + if( pParse->apVtabLock ){ + pParse->apVtabLock[pParse->nVtabLock++] = pTab; + } +} + #endif /* SQLITE_OMIT_VIRTUALTABLE */ |