SQLite

Check-in [474555002d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Have the OP_NoConflict opcode set the VdbeCursor.seekResult variable. This speeds up subsequent OP_Insert and OP_IdxInsert opcodes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | omit-rowid
Files: files | file ages | folders
SHA1: 474555002d45f8741faceea599c057eef4e7931e
User & Date: dan 2013-11-06 16:28:59.136
Context
2013-11-06
19:59
Reference count the KeyInfo object. Cache a copy of an appropriate KeyInfo for each index in the Index object, and reuse that one copy as much as possible. (check-in: defd5205a7 user: drh tags: omit-rowid)
16:28
Have the OP_NoConflict opcode set the VdbeCursor.seekResult variable. This speeds up subsequent OP_Insert and OP_IdxInsert opcodes. (check-in: 474555002d user: dan tags: omit-rowid)
14:52
Use ansi escape codes to use different colored text for opcode names in the output of [explain_i]: Red for opcodes that insert or delete b-tree elements, blue for opcodes that move cursors and green for the ResultRow opcode. (check-in: 4be2b64b3e user: dan tags: omit-rowid)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/build.c.
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
    sqlite3StrAccumAppend(&errMsg, pTab->zName, -1);
    sqlite3StrAccumAppend(&errMsg, ".", 1);
    sqlite3StrAccumAppend(&errMsg, zCol, -1);
  }
  zErr = sqlite3StrAccumFinish(&errMsg);
  sqlite3HaltConstraint(pParse, 
    (pIdx->autoIndex==2)?SQLITE_CONSTRAINT_PRIMARYKEY:SQLITE_CONSTRAINT_UNIQUE,
    onError, zErr, 0, P5_ConstraintUnique);
  sqlite3DbFree(errMsg.db, zErr);
}


/*
** Code an OP_Halt due to non-unique rowid.
*/
void sqlite3RowidConstraint(







|
<







3982
3983
3984
3985
3986
3987
3988
3989

3990
3991
3992
3993
3994
3995
3996
    sqlite3StrAccumAppend(&errMsg, pTab->zName, -1);
    sqlite3StrAccumAppend(&errMsg, ".", 1);
    sqlite3StrAccumAppend(&errMsg, zCol, -1);
  }
  zErr = sqlite3StrAccumFinish(&errMsg);
  sqlite3HaltConstraint(pParse, 
    (pIdx->autoIndex==2)?SQLITE_CONSTRAINT_PRIMARYKEY:SQLITE_CONSTRAINT_UNIQUE,
    onError, zErr, P4_DYNAMIC, P5_ConstraintUnique);

}


/*
** Code an OP_Halt due to non-unique rowid.
*/
void sqlite3RowidConstraint(
Changes to src/vdbe.c.
3797
3798
3799
3800
3801
3802
3803

3804
3805
3806
3807
3808
3809
3810
    rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res);
    if( pOp->p4.i==0 ){
      sqlite3DbFree(db, pFree);
    }
    if( rc!=SQLITE_OK ){
      break;
    }

    alreadyExists = (res==0);
    pC->nullRow = 1-alreadyExists;
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
  }
  if( pOp->opcode==OP_Found ){
    if( alreadyExists ) pc = pOp->p2 - 1;







>







3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
    rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res);
    if( pOp->p4.i==0 ){
      sqlite3DbFree(db, pFree);
    }
    if( rc!=SQLITE_OK ){
      break;
    }
    pC->seekResult = res;
    alreadyExists = (res==0);
    pC->nullRow = 1-alreadyExists;
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
  }
  if( pOp->opcode==OP_Found ){
    if( alreadyExists ) pc = pOp->p2 - 1;