1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Minor simplification of the cursor allocation logic for update.

FossilOrigin-Name: fdf71be65835e7e8915d16dd64114de35c4754ef5b94a2af6cac88a94817fb75
This commit is contained in:
drh
2018-04-20 00:40:19 +00:00
parent 7963691314
commit 2ac4e5cca9
3 changed files with 11 additions and 10 deletions

View File

@@ -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.