Small performance tweaks.
FossilOrigin-Name: 5321d60c575ef8f888d1b315df02cf9ed96a3ffc61babbc1429aa73b2a61a190
This commit is contained in:
parent
ed4c54699d
commit
d3e21a1098
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Bug\sfixes\sso\sthat\slegacy\stests\spass.\s\sNew\stests\sfor\snew\sfunctionality\shave\nnot\syet\sbeen\sadded.
|
||||
D 2020-12-11T16:49:51.732
|
||||
C Small\sperformance\stweaks.
|
||||
D 2020-12-11T17:11:56.302
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -501,7 +501,7 @@ F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
|
||||
F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
|
||||
F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144
|
||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 3f90efe0afbbf4a64f7fe37cb061527a86445f0a1b85a78038ae406b41fbf806
|
||||
F src/insert.c 2b9b6a9cae187bf6c1d4220726511459a23d6089dd4025c4cb00657195c81ba8
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 8c9c8cd2bd8eecdb06d9b6e89de7e9e65bae45cc8fc33609cc74023a5c296067
|
||||
F src/main.c 97e9f137354bc1f76dc9bb60a0a24f8c45cf73b33e80d3ee4c64155336fb820d
|
||||
@ -1888,7 +1888,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 155142314feb007d526f8f67723636fd50dc52d1cd4d3a67dd93b105c9d5c2be
|
||||
R 63e742ce65925663b08e2a758de8f6e2
|
||||
P aa76790e58cea9a2b707f5912fd66c76545e7417442553fc13c87f773a2fe1dd
|
||||
R facb33fc25631aa36550b455921f2f42
|
||||
U drh
|
||||
Z 0aa452b6f5f81d99a0b8c06fa6b89e8a
|
||||
Z 1d9f47d8176ed5a99b3ef4efb5d1d2d4
|
||||
|
@ -1 +1 @@
|
||||
aa76790e58cea9a2b707f5912fd66c76545e7417442553fc13c87f773a2fe1dd
|
||||
5321d60c575ef8f888d1b315df02cf9ed96a3ffc61babbc1429aa73b2a61a190
|
17
src/insert.c
17
src/insert.c
@ -1453,8 +1453,8 @@ static Index *indexIteratorFirst(IndexIterator *pIter, int *pIx){
|
||||
|
||||
/* Return the next index from the list. Return NULL when out of indexes */
|
||||
static Index *indexIteratorNext(IndexIterator *pIter, int *pIx){
|
||||
int i = ++pIter->i;
|
||||
if( pIter->eType ){
|
||||
int i = ++pIter->i;
|
||||
if( i>=pIter->u.ax.nIdx ){
|
||||
*pIx = i;
|
||||
return 0;
|
||||
@ -1462,7 +1462,7 @@ static Index *indexIteratorNext(IndexIterator *pIter, int *pIx){
|
||||
*pIx = pIter->u.ax.aIdx[i].ix;
|
||||
return pIter->u.ax.aIdx[i].p;
|
||||
}else{
|
||||
*pIx = i;
|
||||
++(*pIx);
|
||||
pIter->u.lx.pIdx = pIter->u.lx.pIdx->pNext;
|
||||
return pIter->u.lx.pIdx;
|
||||
}
|
||||
@ -1798,6 +1798,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
*/
|
||||
sIdxIter.eType = 0;
|
||||
sIdxIter.i = 0;
|
||||
sIdxIter.u.ax.aIdx = 0; /* Silence harmless compiler warning */
|
||||
sIdxIter.u.lx.pIdx = pTab->pIndex;
|
||||
if( pUpsert ){
|
||||
if( pUpsert->pUpsertTarget==0 ){
|
||||
@ -2120,7 +2121,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
** of a WITHOUT ROWID table and there has been no change the
|
||||
** primary key, then no collision is possible. The collision detection
|
||||
** logic below can all be skipped. */
|
||||
if( isUpdate && pPk && pPk->zName==pIdx->zName && pkChng==0 ){
|
||||
if( isUpdate && pPk==pIdx && pkChng==0 ){
|
||||
sqlite3VdbeResolveLabel(v, addrUniqueOk);
|
||||
continue;
|
||||
}
|
||||
@ -2158,7 +2159,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
** is invoked. */
|
||||
#ifndef SQLITE_ENABLE_PREUPDATE_HOOK
|
||||
if( (ix==0 && pIdx->pNext==0) /* Condition 3 */
|
||||
&& pPk && pPk->zName==pIdx->zName /* Condition 2 */
|
||||
&& pPk==pIdx /* Condition 2 */
|
||||
&& onError==OE_Replace /* Condition 1 */
|
||||
&& ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */
|
||||
0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0))
|
||||
@ -2177,8 +2178,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
|
||||
|
||||
/* Generate code to handle collisions */
|
||||
regR = (pPk && pIdx->zName==pPk->zName) ?
|
||||
regIdx : sqlite3GetTempRange(pParse, nPkField);
|
||||
regR = pIdx==pPk ? regIdx : sqlite3GetTempRange(pParse, nPkField);
|
||||
if( isUpdate || onError==OE_Replace ){
|
||||
if( HasRowid(pTab) ){
|
||||
sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
|
||||
@ -2193,7 +2193,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
int x;
|
||||
/* Extract the PRIMARY KEY from the end of the index entry and
|
||||
** store it in registers regR..regR+nPk-1 */
|
||||
if( pPk && pIdx->zName!=pPk->zName ){
|
||||
if( pIdx!=pPk ){
|
||||
for(i=0; i<pPk->nKeyCol; i++){
|
||||
assert( pPk->aiColumn[i]>=0 );
|
||||
x = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]);
|
||||
@ -2274,8 +2274,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
}
|
||||
sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
|
||||
regR, nPkField, 0, OE_Replace,
|
||||
(pPk && pIdx->zName==pPk->zName ? ONEPASS_SINGLE : ONEPASS_OFF),
|
||||
iThisCur);
|
||||
(pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur);
|
||||
if( pTrigger && isUpdate ){
|
||||
sqlite3VdbeAddOp1(v, OP_CursorUnlock, iDataCur);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user