/ Check-in [55d43adc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Always use the symbolic name SQLITE_IDXTYPE_PRIMARYKEY rather than a hard-coded magic number 2.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 55d43adc894a6b1e0f77bf481dad6dd604a0dc0022e72bbf2e3037f97351971e
User & Date: drh 2019-02-19 13:08:35
Context
2019-02-19
13:51
New assert() to verify the TF_HasprimaryKey flag. check-in: 0abace8a user: drh tags: trunk
13:08
Always use the symbolic name SQLITE_IDXTYPE_PRIMARYKEY rather than a hard-coded magic number 2. check-in: 55d43adc user: drh tags: trunk
2019-02-18
12:16
Fix an assert() that might not be true if the %_segdir table of FTS3 contains corrupt entries. check-in: a6509ca3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/insert.c.

  1665   1665           sqlite3VdbeAddOp2(v, iField<0 ? OP_IntCopy : OP_SCopy, x, regIdx+i);
  1666   1666           VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
  1667   1667         }
  1668   1668       }
  1669   1669       sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
  1670   1670       VdbeComment((v, "for %s", pIdx->zName));
  1671   1671   #ifdef SQLITE_ENABLE_NULL_TRIM
  1672         -    if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable);
         1672  +    if( pIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
         1673  +      sqlite3SetMakeRecordP5(v, pIdx->pTable);
         1674  +    }
  1673   1675   #endif
  1674   1676   
  1675   1677       /* In an UPDATE operation, if this index is the PRIMARY KEY index 
  1676   1678       ** of a WITHOUT ROWID table and there has been no change the
  1677   1679       ** primary key, then no collision is possible.  The collision detection
  1678   1680       ** logic below can all be skipped. */
  1679   1681       if( isUpdate && pPk==pIdx && pkChng==0 ){
................................................................................
  2406   2408           if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
  2407   2409         }
  2408   2410         if( i==pSrcIdx->nColumn ){
  2409   2411           idxInsFlags = OPFLAG_USESEEKRESULT;
  2410   2412           sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
  2411   2413         }
  2412   2414       }
  2413         -    if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
         2415  +    if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
  2414   2416         idxInsFlags |= OPFLAG_NCHANGE;
  2415   2417       }
  2416   2418       sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
  2417   2419       sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
  2418   2420       sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
  2419   2421       sqlite3VdbeJumpHere(v, addr1);
  2420   2422       sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);