/ Check-in [9779c7a9]
Login

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

Overview
Comment:Update comments in the ANALYZE command that describe how the Stat4Accum objecct is passed around within the VDBE. No changes to functional code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9779c7a9eb1e2bd36e9286331a9314f064014d80
User & Date: drh 2014-09-01 23:06:44
Context
2014-09-05
05:58
Fix harmless compiler warning. check-in: 73311906 user: mistachkin tags: trunk
2014-09-02
19:59
Add an experimental extension for applying bulk updates to databases. check-in: 2954ab50 user: dan tags: ota-update
15:57
Merge the latest trunk changes into the apple-osx branch. check-in: 696dc935 user: drh tags: apple-osx
15:49
Merge the latest trunk changes, including the multi-threaded sorter, into the sessions branch. check-in: d4cce2c7 user: drh tags: sessions
2014-09-01
23:06
Update comments in the ANALYZE command that describe how the Stat4Accum objecct is passed around within the VDBE. No changes to functional code. check-in: 9779c7a9 user: drh tags: trunk
22:34
Avoid a confusing (though correct) argument to the sqlite3_result_blob() function in the implementation of ANALYZE. check-in: 4cae93f8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/analyze.c.

   383    383   **
   384    384   ** For indexes on ordinary rowid tables, N==K+1.  But for indexes on
   385    385   ** WITHOUT ROWID tables, N=K+P where P is the number of columns in the
   386    386   ** PRIMARY KEY of the table.  The covering index that implements the
   387    387   ** original WITHOUT ROWID table as N==K as a special case.
   388    388   **
   389    389   ** This routine allocates the Stat4Accum object in heap memory. The return 
   390         -** value is a pointer to the the Stat4Accum object encoded as a blob (i.e. 
   391         -** the size of the blob is sizeof(void*) bytes). 
          390  +** value is a pointer to the the Stat4Accum object.  The datatype of the
          391  +** return value is BLOB, but it is really just a pointer to the Stat4Accum
          392  +** object.
   392    393   */
   393    394   static void statInit(
   394    395     sqlite3_context *context,
   395    396     int argc,
   396    397     sqlite3_value **argv
   397    398   ){
   398    399     Stat4Accum *p;
................................................................................
   462    463     
   463    464       for(i=0; i<nCol; i++){
   464    465         p->aBest[i].iCol = i;
   465    466       }
   466    467     }
   467    468   #endif
   468    469   
   469         -  /* Return a pointer to the allocated object to the caller */
          470  +  /* Return a pointer to the allocated object to the caller.  Note that
          471  +  ** only the pointer (the 2nd parameter) matters.  The size of the object
          472  +  ** (given by the 3rd parameter) is never used and can be any positive
          473  +  ** value. */
   470    474     sqlite3_result_blob(context, p, sizeof(*p), stat4Destructor);
   471    475   }
   472    476   static const FuncDef statInitFuncdef = {
   473    477     2+IsStat34,      /* nArg */
   474    478     SQLITE_UTF8,     /* funcFlags */
   475    479     0,               /* pUserData */
   476    480     0,               /* pNext */
................................................................................
   789    793   #define STAT_GET_NLT   3          /* "nlt" column of stat[34] entry */
   790    794   #define STAT_GET_NDLT  4          /* "ndlt" column of stat[34] entry */
   791    795   
   792    796   /*
   793    797   ** Implementation of the stat_get(P,J) SQL function.  This routine is
   794    798   ** used to query statistical information that has been gathered into
   795    799   ** the Stat4Accum object by prior calls to stat_push().  The P parameter
   796         -** is a BLOB which is decoded into a pointer to the Stat4Accum objects.
          800  +** has type BLOB but it is really just a pointer to the Stat4Accum object.
   797    801   ** The content to returned is determined by the parameter J
   798    802   ** which is one of the STAT_GET_xxxx values defined above.
   799    803   **
   800    804   ** If neither STAT3 nor STAT4 are enabled, then J is always
   801    805   ** STAT_GET_STAT1 and is hence omitted and this routine becomes
   802    806   ** a one-parameter function, stat_get(P), that always returns the
   803    807   ** stat1 table entry information.