/ Check-in [946b87a5]
Login

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

Overview
Comment:Improved comments on one routine in the query planner. Improved diagnostic output for ".wheretrace". No production code changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 946b87a5282f00d8c532a51f4390e6de781b9a0d6626cb3c077c5622895dc540
User & Date: drh 2017-05-19 20:55:04
Context
2017-05-19
22:51
Prevent a possible NULL pointer dereference in the OP_Found opcode that can follow an OOM error. Problem found by OSS-Fuzz. check-in: c2de178f user: drh tags: trunk
20:55
Improved comments on one routine in the query planner. Improved diagnostic output for ".wheretrace". No production code changes. check-in: 946b87a5 user: drh tags: trunk
20:47
Fix a documentation typo. No changes to code. check-in: 68942a4f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  1941   1941         pTemplate->nOut = p->nOut + 1;
  1942   1942       }
  1943   1943     }
  1944   1944   }
  1945   1945   
  1946   1946   /*
  1947   1947   ** Search the list of WhereLoops in *ppPrev looking for one that can be
  1948         -** supplanted by pTemplate.
         1948  +** replaced by pTemplate.
  1949   1949   **
  1950         -** Return NULL if the WhereLoop list contains an entry that can supplant
  1951         -** pTemplate, in other words if pTemplate does not belong on the list.
         1950  +** Return NULL if pTemplate does not belong on the WhereLoop list.
         1951  +** In other words if pTemplate ought to be dropped from further consideration.
  1952   1952   **
  1953         -** If pX is a WhereLoop that pTemplate can supplant, then return the
         1953  +** If pX is a WhereLoop that pTemplate can replace, then return the
  1954   1954   ** link that points to pX.
  1955   1955   **
  1956         -** If pTemplate cannot supplant any existing element of the list but needs
  1957         -** to be added to the list, then return a pointer to the tail of the list.
         1956  +** If pTemplate cannot replace any existing element of the list but needs
         1957  +** to be added to the list as a new entry, then return a pointer to the
         1958  +** tail of the list.
  1958   1959   */
  1959   1960   static WhereLoop **whereLoopFindLesser(
  1960   1961     WhereLoop **ppPrev,
  1961   1962     const WhereLoop *pTemplate
  1962   1963   ){
  1963   1964     WhereLoop *p;
  1964   1965     for(p=(*ppPrev); p; ppPrev=&p->pNextLoop, p=*ppPrev){
................................................................................
  2095   2096     ** WhereLoop and insert it.
  2096   2097     */
  2097   2098   #if WHERETRACE_ENABLED /* 0x8 */
  2098   2099     if( sqlite3WhereTrace & 0x8 ){
  2099   2100       if( p!=0 ){
  2100   2101         sqlite3DebugPrintf("replace: ");
  2101   2102         whereLoopPrint(p, pBuilder->pWC);
         2103  +      sqlite3DebugPrintf("   with: ");
         2104  +    }else{
         2105  +      sqlite3DebugPrintf("    add: ");
  2102   2106       }
  2103         -    sqlite3DebugPrintf("    add: ");
  2104   2107       whereLoopPrint(pTemplate, pBuilder->pWC);
  2105   2108     }
  2106   2109   #endif
  2107   2110     if( p==0 ){
  2108   2111       /* Allocate a new WhereLoop to add to the end of the list */
  2109   2112       *ppPrev = p = sqlite3DbMallocRawNN(db, sizeof(WhereLoop));
  2110   2113       if( p==0 ) return SQLITE_NOMEM_BKPT;