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

Simplification of the VDBE bytecode for incremental blob I/O.

FossilOrigin-Name: d23849f64a110e336f26282bf2b961a2a2372468
This commit is contained in:
drh
2016-01-18 00:46:11 +00:00
parent dad300d8e1
commit e617bc8c0c
3 changed files with 25 additions and 25 deletions

View File

@@ -249,19 +249,19 @@ int sqlite3_blob_open(
** which closes the b-tree cursor and (possibly) commits the
** transaction.
*/
static const int iLn = VDBE_OFFSET_LINENO(3);
static const int iLn = VDBE_OFFSET_LINENO(4);
static const VdbeOpList openBlob[] = {
/* {OP_Transaction, 0, 0, 0}, // inserted separately */
{OP_TableLock, 0, 0, 0}, /* 0: Acquire a read or write lock */
{OP_OpenRead, 0, 0, 0}, /* 1: Open cursor 0 for reading */
{OP_OpenWrite, 0, 0, 0}, /* 2: Open cursor 0 for read/write */
{OP_Variable, 1, 1, 1}, /* 3: Push the rowid to the stack */
{OP_NotExists, 0, 10, 1}, /* 4: Seek the cursor */
{OP_Column, 0, 0, 1}, /* 5 */
{OP_ResultRow, 1, 0, 0}, /* 6 */
{OP_Goto, 0, 4, 0}, /* 7 */
{OP_Close, 0, 0, 0}, /* 8 */
{OP_Halt, 0, 0, 0}, /* 9 */
/* addr/ofst */
/* {OP_Transaction, 0, 0, 0}, // 0/ inserted separately */
{OP_TableLock, 0, 0, 0}, /* 1/0: Acquire a read or write lock */
{OP_OpenRead, 0, 0, 0}, /* 2/1: Open a cursor */
{OP_Variable, 1, 1, 0}, /* 3/2: Move ?1 into reg[1] */
{OP_NotExists, 0, 8, 1}, /* 4/3: Seek the cursor */
{OP_Column, 0, 0, 1}, /* 5/4 */
{OP_ResultRow, 1, 0, 0}, /* 6/5 */
{OP_Goto, 0, 3, 0}, /* 7/6 */
{OP_Close, 0, 0, 0}, /* 8/7 */
{OP_Halt, 0, 0, 0}, /* 9/8 */
};
Vdbe *v = (Vdbe *)pBlob->pStmt;
int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
@@ -292,9 +292,9 @@ int sqlite3_blob_open(
/* Remove either the OP_OpenWrite or OpenRead. Set the P2
** parameter of the other to pTab->tnum. */
aOp[2-flags].opcode = OP_Noop;
aOp[1+flags].p2 = pTab->tnum;
aOp[1+flags].p3 = iDb;
if( flags ) aOp[1].opcode = OP_OpenWrite;
aOp[1].p2 = pTab->tnum;
aOp[1].p3 = iDb;
/* Configure the number of columns. Configure the cursor to
** think that the table has one more column than it really
@@ -303,9 +303,9 @@ int sqlite3_blob_open(
** we can invoke OP_Column to fill in the vdbe cursors type
** and offset cache without causing any IO.
*/
aOp[1+flags].p4type = P4_INT32;
aOp[1+flags].p4.i = pTab->nCol+1;
aOp[5].p2 = pTab->nCol;
aOp[1].p4type = P4_INT32;
aOp[1].p4.i = pTab->nCol+1;
aOp[4].p2 = pTab->nCol;
pParse->nVar = 1;
pParse->nMem = 1;