/ Check-in [dbc2c3c0]
Login

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

Overview
Comment:Increase test coverage following the introduction of the new filesize-in-header logic.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dbc2c3c0144d2c76aec04f80892302c532947dc8
User & Date: drh 2010-03-31 02:31:34
Context
2010-03-31
11:52
Include shell.c and sqlite3.def in the amalgamation ZIP archive. Ticket [e063139eb3f8] check-in: 0077ed5c user: drh tags: trunk
02:31
Increase test coverage following the introduction of the new filesize-in-header logic. check-in: dbc2c3c0 user: drh tags: trunk
2010-03-30
22:58
Continuing refinements to the filesize-in-header enhancement. check-in: 79e22b95 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  2248   2248     rc = btreeGetPage(pBt, 1, &pPage1, 0);
  2249   2249     if( rc!=SQLITE_OK ) return rc;
  2250   2250   
  2251   2251     /* Do some checking to help insure the file we opened really is
  2252   2252     ** a valid database file. 
  2253   2253     */
  2254   2254     nPage = get4byte(28+(u8*)pPage1->aData);
  2255         -  if( nPage==0 && (rc = sqlite3PagerPagecount(pBt->pPager, &nPage))!=0 ){
  2256         -    goto page1_init_failed;
  2257         -  }else if( nPage>0 ){
         2255  +  if( nPage==0 ){
         2256  +    rc = sqlite3PagerPagecount(pBt->pPager, &nPage);
         2257  +    /* The sqlite3PagerSharedLock() call above has already determined
         2258  +    ** the database file size, so this call to sqlite3PagerPagecount()
         2259  +    ** cannot fail. */
         2260  +    if( NEVER(rc) ) goto page1_init_failed;
         2261  +  }
         2262  +  if( nPage>0 ){
  2258   2263       int pageSize;
  2259   2264       int usableSize;
  2260   2265       u8 *page1 = pPage1->aData;
  2261   2266       rc = SQLITE_NOTADB;
  2262   2267       if( memcmp(page1, zMagicHeader, 16)!=0 ){
  2263   2268         goto page1_init_failed;
  2264   2269       }

Changes to src/pager.c.

  2459   2459   ** Otherwise, if everything is successful, then SQLITE_OK is returned
  2460   2460   ** and *pnPage is set to the number of pages in the database.
  2461   2461   */
  2462   2462   int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
  2463   2463     Pgno nPage;               /* Value to return via *pnPage */
  2464   2464   
  2465   2465     /* If the pager is already in the error state, return the error code. */
  2466         -  if( pPager->errCode ){
         2466  +  if( NEVER(pPager->errCode) ){
  2467   2467       return pPager->errCode;
  2468   2468     }
  2469   2469   
  2470   2470     /* Determine the number of pages in the file. Store this in nPage. */
  2471   2471     if( pPager->dbSizeValid ){
  2472   2472       nPage = pPager->dbSize;
  2473   2473     }else{