diff options
author | drh <drh@noemail.net> | 2016-11-11 18:19:05 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-11-11 18:19:05 +0000 |
commit | d95ef5cb5a6ef94211463d18e22259bcc48d7266 (patch) | |
tree | 40682b25c07ee1cc6b087cb8472260bc79554e85 /src | |
parent | 79297d1d5979a82655590db1c53f76942ebc4b40 (diff) | |
download | sqlite-d95ef5cb5a6ef94211463d18e22259bcc48d7266.tar.gz sqlite-d95ef5cb5a6ef94211463d18e22259bcc48d7266.zip |
Remove obselete and unused logic in the update code generator.
Fix the sqlite3BtreeMovetoUnpacked() routine so that it remembers the
rowid of the row that it landed on.
FossilOrigin-Name: 1a587d72f981cb7064cfd8916a52a83ad9ba6074
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 12 | ||||
-rw-r--r-- | src/insert.c | 3 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/btree.c b/src/btree.c index 78c4677d2..283f37b79 100644 --- a/src/btree.c +++ b/src/btree.c @@ -5165,16 +5165,16 @@ int sqlite3BtreeMovetoUnpacked( if( lwr>upr ){ c = +1; break; } }else{ assert( nCellKey==intKey ); - pCur->curFlags |= BTCF_ValidNKey; - pCur->info.nKey = nCellKey; pCur->aiIdx[pCur->iPage] = (u16)idx; if( !pPage->leaf ){ lwr = idx; goto moveto_next_layer; }else{ + pCur->curFlags |= BTCF_ValidNKey; + pCur->info.nKey = nCellKey; + pCur->info.nSize = 0; *pRes = 0; - rc = SQLITE_OK; - goto moveto_finish; + return SQLITE_OK; } } assert( lwr+upr>=0 ); @@ -5285,7 +5285,7 @@ moveto_next_layer: } moveto_finish: pCur->info.nSize = 0; - pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); + assert( (pCur->curFlags & BTCF_ValidOvfl)==0 ); return rc; } @@ -5483,7 +5483,7 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){ moveToParent(pCur); } assert( pCur->info.nSize==0 ); - assert( (pCur->curFlags & (BTCF_ValidNKey|BTCF_ValidOvfl))==0 ); + assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 ); pCur->aiIdx[pCur->iPage]--; pPage = pCur->apPage[pCur->iPage]; diff --git a/src/insert.c b/src/insert.c index a5852fd32..59bc99b52 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1260,7 +1260,6 @@ void sqlite3GenerateConstraintChecks( int ipkBottom = 0; /* Bottom of the rowid change constraint check */ u8 isUpdate; /* True if this is an UPDATE operation */ u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */ - int regRowid = -1; /* Register holding ROWID value */ isUpdate = regOldData!=0; db = pParse->db; @@ -1526,9 +1525,7 @@ void sqlite3GenerateConstraintChecks( VdbeComment((v, "%s column %d", pIdx->zName, i)); }else{ if( iField==XN_ROWID || iField==pTab->iPKey ){ - if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */ x = regNewData; - regRowid = pIdx->pPartIdxWhere ? -1 : regIdx+i; }else{ x = iField + regNewData + 1; } |