/ Check-in [ee110d5a]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix an uninitialized variable and a misuse of memcpy().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stat3-trunk
Files: files | file ages | folders
SHA1: ee110d5a4a6f29400bb632a9a18c7dcd04638657
User & Date: drh 2011-09-22 00:28:55
Context
2011-09-22
18:46
Fix an issue in ANALYZE when STAT3 is disabled but both sqlite_stat2 and sqlite_stat3 tables exist. Also add testability tweaks to the STAT3 code. check-in: 3ca7e449 user: drh tags: stat3-trunk
00:28
Fix an uninitialized variable and a misuse of memcpy(). check-in: ee110d5a user: drh tags: stat3-trunk
2011-09-21
00:09
Pull in the latest changes from trunk. Update the STAT3 documentation. check-in: 63fc3e4b user: drh tags: stat3-trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/analyze.c.

   335    335       if( nEq>p->a[iMin].nEq || (nEq==p->a[iMin].nEq && h>p->a[iMin].iHash) ){
   336    336         doInsert = 1;
   337    337       }
   338    338     }
   339    339     if( !doInsert ) return;
   340    340     if( p->nSample==p->mxSample ){
   341    341       if( iMin<p->nSample ){
   342         -      memcpy(&p->a[iMin], &p->a[iMin+1], sizeof(p->a[0])*(p->nSample-iMin));
          342  +      memmove(&p->a[iMin], &p->a[iMin+1], sizeof(p->a[0])*(p->nSample-iMin-1));
   343    343       }
   344    344       pSample = &p->a[p->nSample-1];
   345    345     }else{
   346    346       pSample = &p->a[p->nSample++];
   347    347     }
   348    348     pSample->iRowid = rowid;
   349    349     pSample->nEq = nEq;

Changes to src/where.c.

  2921   2921   
  2922   2922     /* Loop over all indices looking for the best one to use
  2923   2923     */
  2924   2924     for(; pProbe; pIdx=pProbe=pProbe->pNext){
  2925   2925       const tRowcnt * const aiRowEst = pProbe->aiRowEst;
  2926   2926       double cost;                /* Cost of using pProbe */
  2927   2927       double nRow;                /* Estimated number of rows in result set */
  2928         -    double log10N;              /* base-10 logarithm of nRow (inexact) */
         2928  +    double log10N = (double)1;  /* base-10 logarithm of nRow (inexact) */
  2929   2929       int rev;                    /* True to scan in reverse order */
  2930   2930       int wsFlags = 0;
  2931   2931       Bitmask used = 0;
  2932   2932   
  2933   2933       /* The following variables are populated based on the properties of
  2934   2934       ** index being evaluated. They are then used to determine the expected
  2935   2935       ** cost and number of rows returned.