diff options
author | drh <drh@noemail.net> | 2016-01-18 00:46:11 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-01-18 00:46:11 +0000 |
commit | e617bc8c0cad70a2237f1f9d5870d62314000831 (patch) | |
tree | 1edd7bf5088e75fc7e317d88fccd4f7a763a733b /src/vdbeblob.c | |
parent | dad300d8e1a9e9db9b9be19929e22d6a3c2bcdda (diff) | |
download | sqlite-e617bc8c0cad70a2237f1f9d5870d62314000831.tar.gz sqlite-e617bc8c0cad70a2237f1f9d5870d62314000831.zip |
Simplification of the VDBE bytecode for incremental blob I/O.
FossilOrigin-Name: d23849f64a110e336f26282bf2b961a2a2372468
Diffstat (limited to 'src/vdbeblob.c')
-rw-r--r-- | src/vdbeblob.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/vdbeblob.c b/src/vdbeblob.c index e5f08ce93..f9015ad6f 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -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; |