/ Check-in [dc7c48cb]
Login

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

Overview
Comment:Clarify the handling of the sqlite_stat1 table by legacy versions of the sessions module.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sessions-stat1
Files: files | file ages | folders
SHA3-256:dc7c48cb4126db9e25c73512cc743155293fe1c4c2516f8c84102228695b6e70
User & Date: dan 2018-01-18 16:56:19
Context
2018-01-18
16:59
Fix sessions module handling of sqlite_stat1 rows with (idx IS NULL). check-in: 0e916416 user: dan tags: trunk
16:56
Clarify the handling of the sqlite_stat1 table by legacy versions of the sessions module. Closed-Leaf check-in: dc7c48cb user: dan tags: sessions-stat1
16:53
Add comments describing the special sqlite_stat1 handling to sqlite3session.h. check-in: 4431a325 user: dan tags: sessions-stat1
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/session/sqlite3session.h.

   146    146   ** in one or more of their PRIMARY KEY columns.
   147    147   **
   148    148   ** SQLITE_OK is returned if the call completes without error. Or, if an error 
   149    149   ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
   150    150   **
   151    151   ** <h3>Special sqlite_stat1 Handling</h3>
   152    152   **
   153         -** The "sqlite_stat1" table is an exception to some of the rules above. In
   154         -** SQLite, the schema of sqlite_stat1 is:
          153  +** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to 
          154  +** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
   155    155   **  <pre>
   156    156   **  &nbsp;     CREATE TABLE sqlite_stat1(tbl,idx,stat)  
   157    157   **  </pre>
   158    158   **
   159    159   ** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are 
   160    160   ** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes 
   161    161   ** are recorded for rows for which (idx IS NULL) is true. However, for such
................................................................................
   167    167   ** The sqlite3changeset_apply() function automatically converts the 
   168    168   ** zero-length blob back to a NULL value when updating the sqlite_stat1
   169    169   ** table. However, if the application calls sqlite3changeset_new(),
   170    170   ** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset 
   171    171   ** iterator directly (including on a changeset iterator passed to a
   172    172   ** conflict-handler callback) then the X'' value is returned. The application
   173    173   ** must translate X'' to NULL itself if required.
          174  +**
          175  +** Legacy (older than 3.22.0) versions of the sessions module cannot capture
          176  +** changes made to the sqlite_stat1 table. Legacy versions of the
          177  +** sqlite3changeset_apply() function silently ignore any modifications to the
          178  +** sqlite_stat1 table that are part of a changeset or patchset.
   174    179   */
   175    180   int sqlite3session_attach(
   176    181     sqlite3_session *pSession,      /* Session object */
   177    182     const char *zTab                /* Table name */
   178    183   );
   179    184   
   180    185   /*