aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-02-02 02:22:30 +0000
committerdrh <drh@noemail.net>2016-02-02 02:22:30 +0000
commit33c1eb64772caf48a33d92e1a3c5a577c9ba1aa9 (patch)
treee820c4a4276381c4c71f8cf891e75dc67302fa8b /src/insert.c
parente1ed0bb6077cc223fa54f58ae835f133d1c4aa59 (diff)
parentb8db549832d2acc2fc30327e6fb5c0474820f122 (diff)
downloadsqlite-33c1eb64772caf48a33d92e1a3c5a577c9ba1aa9.tar.gz
sqlite-33c1eb64772caf48a33d92e1a3c5a577c9ba1aa9.zip
Merge all recent enhancements from trunk.
FossilOrigin-Name: f3f9200115caf4b356f90ec97c351d1afbcb9bf6
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/insert.c b/src/insert.c
index 910216b8b..d89ab4e0d 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1656,7 +1656,7 @@ int sqlite3OpenTableAndIndices(
Parse *pParse, /* Parsing context */
Table *pTab, /* Table to be opened */
int op, /* OP_OpenRead or OP_OpenWrite */
- u8 p5, /* P5 value for OP_Open* instructions */
+ u8 p5, /* P5 value for OP_Open* opcodes (except on WITHOUT ROWID) */
int iBase, /* Use this for the table cursor, if there is one */
u8 *aToOpen, /* If not NULL: boolean for each table and index */
int *piDataCur, /* Write the database source cursor number here */
@@ -1691,15 +1691,16 @@ int sqlite3OpenTableAndIndices(
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
int iIdxCur = iBase++;
assert( pIdx->pSchema==pTab->pSchema );
- if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) && piDataCur ){
- *piDataCur = iIdxCur;
- }
if( aToOpen==0 || aToOpen[i+1] ){
sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
- sqlite3VdbeChangeP5(v, p5);
VdbeComment((v, "%s", pIdx->zName));
}
+ if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
+ if( piDataCur ) *piDataCur = iIdxCur;
+ }else{
+ sqlite3VdbeChangeP5(v, p5);
+ }
}
if( iBase>pParse->nTab ) pParse->nTab = iBase;
return i;