From 9df385ec3d1167d6abba905f39fc7cc84a2d24b8 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 19 Feb 2019 13:08:35 +0000 Subject: [PATCH] Always use the symbolic name SQLITE_IDXTYPE_PRIMARYKEY rather than a hard-coded magic number 2. FossilOrigin-Name: 55d43adc894a6b1e0f77bf481dad6dd604a0dc0022e72bbf2e3037f97351971e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/insert.c | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b2fe3366be..1f12f24de1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sassert()\sthat\smight\snot\sbe\strue\sif\sthe\s%_segdir\stable\sof\sFTS3\scontains\ncorrupt\sentries. -D 2019-02-18T12:16:03.611 +C Always\suse\sthe\ssymbolic\sname\sSQLITE_IDXTYPE_PRIMARYKEY\srather\sthan\sa\shard-coded\nmagic\snumber\s2. +D 2019-02-19T13:08:35.738 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 178d8eb6840771149cee40b322d1b3be30d330198c522c903c1b66fb5a1bfca4 @@ -475,7 +475,7 @@ F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4 F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c 4cf069988908f650bec92fd821a082f6eda87c01191047e49a1a5007af93274c +F src/insert.c 305f6ea82a90c3d506ad26d3b6530655bcf08dbff20403ce9f20c21758fbd5c0 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c e6f10875d52aca3b7e57ce1ec174aeafc9b6c00b43000cd30d791f9cb490b7a6 F src/main.c 27d7265625ea6eaccdfe7c53ef41adc179c9357a077702a860c1a3b0a037a16f @@ -1804,7 +1804,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0cfb888723fb8ff0763bbc23acb7d21a53f6d1c40661d8468248644281b29d85 -R 4804fb0a39426f38f5e4fc938e4a29ae +P a6509ca3dc2602c7d0376230ee63c1bb4c4066f007e77e9ac20d8eee966e5e13 +R 704b4d956a0ce2c9b781aab7a71ed157 U drh -Z cb283c5b86f11d6cac5693b69d717c32 +Z b0619f705fb89193b6dad39d43e9fd99 diff --git a/manifest.uuid b/manifest.uuid index d18260ebb1..253003811b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a6509ca3dc2602c7d0376230ee63c1bb4c4066f007e77e9ac20d8eee966e5e13 \ No newline at end of file +55d43adc894a6b1e0f77bf481dad6dd604a0dc0022e72bbf2e3037f97351971e \ No newline at end of file diff --git a/src/insert.c b/src/insert.c index 1b6235d4d0..6f044db5a7 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1669,7 +1669,9 @@ void sqlite3GenerateConstraintChecks( sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); VdbeComment((v, "for %s", pIdx->zName)); #ifdef SQLITE_ENABLE_NULL_TRIM - if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable); + if( pIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){ + sqlite3SetMakeRecordP5(v, pIdx->pTable); + } #endif /* In an UPDATE operation, if this index is the PRIMARY KEY index @@ -2410,7 +2412,7 @@ static int xferOptimization( sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest); } } - if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){ + if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){ idxInsFlags |= OPFLAG_NCHANGE; } sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);