1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

When doing a one-pass UPDATE or DELETE on virtual tables, close the cursor

prior to running VUpdate.  This allows one-pass to work on virtual tables
that do not allow concurrent reads and writes.  Enhance rtree to take
advantage of this new capability.

FossilOrigin-Name: b816023ce07d01024d5769e16db924374a49bf909edd12dc1344a0a1ef693db5
This commit is contained in:
drh
2018-05-24 23:51:57 +00:00
parent 30fc7f8009
commit 338e311acb
6 changed files with 32 additions and 24 deletions

View File

@@ -553,13 +553,16 @@ void sqlite3DeleteFrom(
if( IsVirtual(pTab) ){
const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
sqlite3VtabMakeWritable(pParse, pTab);
sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB);
sqlite3VdbeChangeP5(v, OE_Abort);
assert( eOnePass==ONEPASS_OFF || eOnePass==ONEPASS_SINGLE );
sqlite3MayAbort(pParse);
if( eOnePass==ONEPASS_SINGLE && sqlite3IsToplevel(pParse) ){
pParse->isMultiWrite = 0;
if( eOnePass==ONEPASS_SINGLE ){
sqlite3VdbeAddOp1(v, OP_Close, iTabCur);
if( sqlite3IsToplevel(pParse) ){
pParse->isMultiWrite = 0;
}
}
sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB);
sqlite3VdbeChangeP5(v, OE_Abort);
}else
#endif
{