/ Check-in [2c90276e]
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:Disable code used only by the codec when the codec is not deployed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2c90276e340aa19d78d2e33c9f759f8eda0b82a3
User & Date: drh 2010-06-22 21:15:50
Context
2010-06-23
15:04
Simplifications to the pager_delmaster() implementation. check-in: 8bfbdec6 user: drh tags: trunk
2010-06-22
21:15
Disable code used only by the codec when the codec is not deployed. check-in: 2c90276e user: drh tags: trunk
15:18
Add codec support to wal mode. check-in: 393741eb user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  6111   6111   ** page content. If a malloc fails, this function may return NULL.
  6112   6112   */
  6113   6113   void *sqlite3PagerCodec(PgHdr *pPg){
  6114   6114     void *aData = 0;
  6115   6115     CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData);
  6116   6116     return aData;
  6117   6117   }
  6118         -#endif
         6118  +#endif /* SQLITE_HAS_CODEC */
  6119   6119   
  6120         -#endif
         6120  +#endif /* !SQLITE_OMIT_WAL */
  6121   6121   
  6122   6122   #endif /* SQLITE_OMIT_DISKIO */

Changes to src/pager.h.

   155    155   int sqlite3PagerIsMemdb(Pager*);
   156    156   
   157    157   /* Functions used to truncate the database file. */
   158    158   void sqlite3PagerTruncateImage(Pager*,Pgno);
   159    159   
   160    160   #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
   161    161   void *sqlite3PagerCodec(DbPage *);
   162         -#else
   163         -#define sqlite3PagerCodec(x) (x->pData)
   164    162   #endif
   165    163   
   166    164   /* Functions to support testing and debugging. */
   167    165   #if !defined(NDEBUG) || defined(SQLITE_TEST)
   168    166     Pgno sqlite3PagerPagenumber(DbPage*);
   169    167     int sqlite3PagerIswriteable(DbPage*);
   170    168   #endif

Changes to src/wal.c.

  2289   2289       void *pData;
  2290   2290      
  2291   2291      
  2292   2292       iOffset = walFrameOffset(++iFrame, szPage);
  2293   2293       
  2294   2294       /* Populate and write the frame header */
  2295   2295       nDbsize = (isCommit && p->pDirty==0) ? nTruncate : 0;
         2296  +#if defined(SQLITE_HAS_CODEC)
  2296   2297       if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM;
         2298  +#else
         2299  +    pData = p->pData;
         2300  +#endif
  2297   2301       walEncodeFrame(pWal, p->pgno, nDbsize, pData, aFrame);
  2298   2302       rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOffset);
  2299   2303       if( rc!=SQLITE_OK ){
  2300   2304         return rc;
  2301   2305       }
  2302   2306   
  2303   2307       /* Write the page data */
................................................................................
  2315   2319   
  2316   2320       assert( isCommit );
  2317   2321       assert( iSegment>0 );
  2318   2322   
  2319   2323       iSegment = (((iOffset+iSegment-1)/iSegment) * iSegment);
  2320   2324       while( iOffset<iSegment ){
  2321   2325         void *pData;
         2326  +#if defined(SQLITE_HAS_CODEC)
  2322   2327         if( (pData = sqlite3PagerCodec(pLast))==0 ) return SQLITE_NOMEM;
         2328  +#else
         2329  +      pData = pLast->pData;
         2330  +#endif
  2323   2331         walEncodeFrame(pWal, pLast->pgno, nTruncate, pData, aFrame);
  2324   2332         rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOffset);
  2325   2333         if( rc!=SQLITE_OK ){
  2326   2334           return rc;
  2327   2335         }
  2328   2336         iOffset += WAL_FRAME_HDRSIZE;
  2329   2337         rc = sqlite3OsWrite(pWal->pWalFd, pData, szPage, iOffset);