aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-01-30 16:59:56 +0000
committerdrh <drh@noemail.net>2016-01-30 16:59:56 +0000
commit784c1b93fbf5f206878d9fec62dd3d418b0e678d (patch)
tree44fcac662d47f23f98d5c7620eac66335e842423 /src/wherecode.c
parentb8d66dc4ec99cfd3d82afe5b6243a000d0d409cb (diff)
downloadsqlite-784c1b93fbf5f206878d9fec62dd3d418b0e678d.tar.gz
sqlite-784c1b93fbf5f206878d9fec62dd3d418b0e678d.zip
Merge the implementation of OP_IdxRowid and OP_Seek so that OP_Seek no longer
requires the rowid register and a separate OP_IdxRowid call. Shorter and faster prepared statements result. FossilOrigin-Name: 9bec50a1e7796a6e038db9b1cc7cc1e7e350bf74
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index d59020315..3fbd198e3 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -768,7 +768,6 @@ static void codeDeferredSeek(
WhereInfo *pWInfo, /* Where clause context */
Index *pIdx, /* Index scan is using */
int iCur, /* Cursor for IPK b-tree */
- int iRowid, /* Register containing rowid to seek to */
int iIdxCur /* Index cursor */
){
Parse *pParse = pWInfo->pParse; /* Parse context */
@@ -777,7 +776,7 @@ static void codeDeferredSeek(
assert( iIdxCur>0 );
assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 );
- sqlite3VdbeAddOp3(v, OP_Seek, iCur, iRowid, iIdxCur);
+ sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur);
if( (pWInfo->wctrlFlags & WHERE_FORCE_TABLE)
&& sqlite3ParseToplevel(pParse)->writeMask==0
){
@@ -1274,14 +1273,14 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( omitTable ){
/* pIdx is a covering index. No need to access the main table. */
}else if( HasRowid(pIdx->pTable) ){
- iRowidReg = ++pParse->nMem;
- sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
- sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
if( pWInfo->eOnePass!=ONEPASS_OFF ){
+ iRowidReg = ++pParse->nMem;
+ sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
+ sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
VdbeCoverage(v);
}else{
- codeDeferredSeek(pWInfo, pIdx, iCur, iRowidReg, iIdxCur);
+ codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);
}
}else if( iCur!=iIdxCur ){
Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable);