aboutsummaryrefslogtreecommitdiff
path: root/src/vtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vtab.c')
-rw-r--r--src/vtab.c21
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 */