/ Check-in [acbed338]
Login

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

Overview
Comment:Changes so that sqlite3_ckpt_open() works with zipvfs databases.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ota-update
Files: files | file ages | folders
SHA1: acbed3380d8a35bf2f1ec133540cb5e9fccb9b42
User & Date: dan 2014-11-17 17:57:06
Context
2014-11-17
18:35
Add tests for WITHOUT ROWID tables with composite primary keys. check-in: 712d413d user: dan tags: ota-update
17:57
Changes so that sqlite3_ckpt_open() works with zipvfs databases. check-in: acbed338 user: dan tags: ota-update
15:07
Fix a problem with the parameters to an OP_Affinity in one of the VM programs generated by sqlite3_index_writer() that was causing an OOB read. check-in: 447b33b3 user: dan tags: ota-update
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

  1777   1777   ** Open an incremental checkpoint handle.
  1778   1778   */
  1779   1779   int sqlite3_ckpt_open(
  1780   1780     sqlite3 *db, 
  1781   1781     unsigned char *a, int n, 
  1782   1782     sqlite3_ckpt **ppCkpt
  1783   1783   ){
  1784         -  Pager *pPager;
  1785         -  Btree *pBt;
         1784  +  Pager *pPager = 0;
  1786   1785     int rc;
  1787   1786   
  1788   1787     *ppCkpt = 0;
  1789   1788     sqlite3_mutex_enter(db->mutex);
  1790         -  pBt = db->aDb[0].pBt;
  1791         -  pPager = sqlite3BtreePager(pBt);
         1789  +
         1790  +  /* Find the Pager object. */
         1791  +  rc = sqlite3_file_control(db,"main",SQLITE_FCNTL_ZIPVFS_PAGER,(void*)&pPager);
         1792  +  if( rc!=SQLITE_OK ){
         1793  +    pPager = sqlite3BtreePager(db->aDb[0].pBt);
         1794  +  }
         1795  +
  1792   1796     rc = sqlite3PagerWalCheckpointStart(db, pPager, a, n, ppCkpt);
  1793   1797     sqlite3_mutex_leave(db->mutex);
  1794   1798     return rc;
  1795   1799   }
  1796   1800   
  1797   1801   
  1798   1802   /*

Changes to src/sqlite.h.in.

   937    937   **
   938    938   ** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
   939    939   ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This
   940    940   ** opcode causes the xFileControl method to swap the file handle with the one
   941    941   ** pointed to by the pArg argument.  This capability is used during testing
   942    942   ** and only needs to be supported when SQLITE_TEST is defined.
   943    943   **
          944  +** <li>[[SQLITE_FCNTL_ZIPVFS_PAGER]]
          945  +** The [SQLITE_FCNTL_ZIPVFS_PAGER] opcode is used by the OTA extension when
          946  +** updating a zipvfs database.
          947  +**
   944    948   ** </ul>
   945    949   */
   946    950   #define SQLITE_FCNTL_LOCKSTATE               1
   947    951   #define SQLITE_GET_LOCKPROXYFILE             2
   948    952   #define SQLITE_SET_LOCKPROXYFILE             3
   949    953   #define SQLITE_LAST_ERRNO                    4
   950    954   #define SQLITE_FCNTL_SIZE_HINT               5
................................................................................
   961    965   #define SQLITE_FCNTL_TEMPFILENAME           16
   962    966   #define SQLITE_FCNTL_MMAP_SIZE              18
   963    967   #define SQLITE_FCNTL_TRACE                  19
   964    968   #define SQLITE_FCNTL_HAS_MOVED              20
   965    969   #define SQLITE_FCNTL_SYNC                   21
   966    970   #define SQLITE_FCNTL_COMMIT_PHASETWO        22
   967    971   #define SQLITE_FCNTL_WIN32_SET_HANDLE       23
          972  +#define SQLITE_FCNTL_ZIPVFS_PAGER           24
   968    973   
   969    974   /*
   970    975   ** CAPI3REF: Mutex Handle
   971    976   **
   972    977   ** The mutex module within SQLite defines [sqlite3_mutex] to be an
   973    978   ** abstract type for a mutex object.  The SQLite core never looks
   974    979   ** at the internal representation of an [sqlite3_mutex].  It only