diff options
author | drh <drh@noemail.net> | 2018-04-20 00:40:19 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-04-20 00:40:19 +0000 |
commit | 2ac4e5cca9b882d142fd21c83a0e930f9bbd56da (patch) | |
tree | db6d260bb2d42d3a4d5623d341fdeb7286d6e9a3 /src | |
parent | 796369131419dac03306ee3d2275cf68dab4b1b8 (diff) | |
download | sqlite-2ac4e5cca9b882d142fd21c83a0e930f9bbd56da.tar.gz sqlite-2ac4e5cca9b882d142fd21c83a0e930f9bbd56da.zip |
Minor simplification of the cursor allocation logic for update.
FossilOrigin-Name: fdf71be65835e7e8915d16dd64114de35c4754ef5b94a2af6cac88a94817fb75
Diffstat (limited to 'src')
-rw-r--r-- | src/update.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/update.c b/src/update.c index c817153e8..dd08b1668 100644 --- a/src/update.c +++ b/src/update.c @@ -201,16 +201,17 @@ void sqlite3Update( ** need to occur right after the database cursor. So go ahead and ** allocate enough space, just in case. */ - pTabList->a[0].iCursor = iBaseCur = iDataCur = pParse->nTab++; + iBaseCur = iDataCur = pParse->nTab++; iIdxCur = iDataCur+1; pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); + testcase( pPk!=0 && pPk!=pTab->pIndex ); for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ - if( IsPrimaryKeyIndex(pIdx) && pPk!=0 ){ + if( pPk==pIdx ){ iDataCur = pParse->nTab; - pTabList->a[0].iCursor = iDataCur; } pParse->nTab++; } + pTabList->a[0].iCursor = iDataCur; /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. ** Initialize aXRef[] and aToOpen[] to their default values. |