SQLite

Check-in [dbc2c3c014]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dbc2c3c0144d2c76aec04f80892302c532947dc8
User & Date: drh 2010-03-31 02:31:34.000
Context
2010-03-31
11:52
Include shell.c and sqlite3.def in the amalgamation ZIP archive. Ticket [e063139eb3f8] (check-in: 0077ed5cf4 user: drh tags: trunk)
02:31
Increase test coverage following the introduction of the new filesize-in-header logic. (check-in: dbc2c3c014 user: drh tags: trunk)
2010-03-30
22:58
Continuing refinements to the filesize-in-header enhancement. (check-in: 79e22b9503 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
2248
2249
2250
2251
2252
2253
2254

2255



2256

2257
2258
2259
2260
2261
2262
2263
2264
  rc = btreeGetPage(pBt, 1, &pPage1, 0);
  if( rc!=SQLITE_OK ) return rc;

  /* Do some checking to help insure the file we opened really is
  ** a valid database file. 
  */
  nPage = get4byte(28+(u8*)pPage1->aData);

  if( nPage==0 && (rc = sqlite3PagerPagecount(pBt->pPager, &nPage))!=0 ){



    goto page1_init_failed;

  }else if( nPage>0 ){
    int pageSize;
    int usableSize;
    u8 *page1 = pPage1->aData;
    rc = SQLITE_NOTADB;
    if( memcmp(page1, zMagicHeader, 16)!=0 ){
      goto page1_init_failed;
    }







>
|
>
>
>
|
>
|







2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
  rc = btreeGetPage(pBt, 1, &pPage1, 0);
  if( rc!=SQLITE_OK ) return rc;

  /* Do some checking to help insure the file we opened really is
  ** a valid database file. 
  */
  nPage = get4byte(28+(u8*)pPage1->aData);
  if( nPage==0 ){
    rc = sqlite3PagerPagecount(pBt->pPager, &nPage);
    /* The sqlite3PagerSharedLock() call above has already determined
    ** the database file size, so this call to sqlite3PagerPagecount()
    ** cannot fail. */
    if( NEVER(rc) ) goto page1_init_failed;
  }
  if( nPage>0 ){
    int pageSize;
    int usableSize;
    u8 *page1 = pPage1->aData;
    rc = SQLITE_NOTADB;
    if( memcmp(page1, zMagicHeader, 16)!=0 ){
      goto page1_init_failed;
    }
Changes to src/pager.c.
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
** Otherwise, if everything is successful, then SQLITE_OK is returned
** and *pnPage is set to the number of pages in the database.
*/
int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
  Pgno nPage;               /* Value to return via *pnPage */

  /* If the pager is already in the error state, return the error code. */
  if( pPager->errCode ){
    return pPager->errCode;
  }

  /* Determine the number of pages in the file. Store this in nPage. */
  if( pPager->dbSizeValid ){
    nPage = pPager->dbSize;
  }else{







|







2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
** Otherwise, if everything is successful, then SQLITE_OK is returned
** and *pnPage is set to the number of pages in the database.
*/
int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
  Pgno nPage;               /* Value to return via *pnPage */

  /* If the pager is already in the error state, return the error code. */
  if( NEVER(pPager->errCode) ){
    return pPager->errCode;
  }

  /* Determine the number of pages in the file. Store this in nPage. */
  if( pPager->dbSizeValid ){
    nPage = pPager->dbSize;
  }else{