1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Enhance the OP_IdxInsert opcode to optionally accept unpacked key material.

FossilOrigin-Name: 89d958abbac45f2ca5954080cd9e74ec9a07ebb2
This commit is contained in:
drh
2016-11-09 00:10:33 +00:00
parent 3b908d41a0
commit 9b4eaebc68
12 changed files with 60 additions and 36 deletions

View File

@@ -5017,15 +5017,20 @@ next_tail:
goto check_for_interrupt;
}
/* Opcode: IdxInsert P1 P2 P3 * P5
/* Opcode: IdxInsert P1 P2 P3 P4 P5
** Synopsis: key=r[P2]
**
** Register P2 holds an SQL index key made using the
** MakeRecord instructions. This opcode writes that key
** into the index P1. Data for the entry is nil.
**
** P3 is a flag that provides a hint to the b-tree layer that this
** insert is likely to be an append.
** If P4 is not zero, the it is the number of values in the unpacked
** key of reg(P2). In that case, P3 is the index of the first register
** for the unpacked key. The availability of the unpacked key can sometimes
** be an optimization.
**
** If P5 has the OPFLAG_APPEND bit set, that is a hint to the b-tree layer
** that this insert is likely to be an append.
**
** If P5 has the OPFLAG_NCHANGE bit set, then the change counter is
** incremented by this instruction. If the OPFLAG_NCHANGE bit is clear,
@@ -5066,7 +5071,10 @@ case OP_IdxInsert: { /* in2 */
}else{
x.nKey = pIn2->n;
x.pKey = pIn2->z;
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, pOp->p3,
x.aMem = aMem + pOp->p3;
x.nMem = (u16)pOp->p4.i;
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
(pOp->p5 & OPFLAG_APPEND)!=0,
((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
);
assert( pC->deferredMoveto==0 );