SQLite

Check-in [ad7c9eed8b]
Login

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

Overview
Comment:Fix test code related to reporting the size of overflow pages in zipvfs databases.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ad7c9eed8bbd607babce4f5965f587c873e7bc02
User & Date: dan 2011-10-05 17:36:27.323
Context
2011-10-05
18:18
Update the sqlite3_analyzer utility program to provide more details about the compression performance of ZIPVFS database files. (check-in: fa5ed53296 user: drh tags: trunk)
17:36
Fix test code related to reporting the size of overflow pages in zipvfs databases. (check-in: ad7c9eed8b user: dan tags: trunk)
15:26
When finding the appropriate file permissions for journal files with SQLITE_ENABLE_8_3_NAMES, ignore "-" characters in the name of the containing directory. (check-in: 328cc1867f user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/test_stat.c.
351
352
353
354
355
356
357


























358
359
360
361
362
363
364
        }
      }
    }
  }

  return SQLITE_OK;
}



























/*
** Move a statvfs cursor to the next entry in the file.
*/
static int statNext(sqlite3_vtab_cursor *pCursor){
  int rc;
  int nPayload;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
        }
      }
    }
  }

  return SQLITE_OK;
}

/*
** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
** the current value of pCsr->iPageno.
*/
static void statSizeAndOffset(StatCursor *pCsr){
  StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
  Btree *pBt = pTab->db->aDb[0].pBt;
  Pager *pPager = sqlite3BtreePager(pBt);
  sqlite3_file *fd;
  sqlite3_int64 x[2];

  /* The default page size and offset */
  pCsr->szPage = sqlite3BtreeGetPageSize(pBt);
  pCsr->iOffset = pCsr->szPage * (pCsr->iPageno - 1);

  /* If connected to a ZIPVFS backend, override the page size and
  ** offset with actual values obtained from ZIPVFS.
  */
  fd = sqlite3PagerFile(pPager);
  x[0] = pCsr->iPageno;
  if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
    pCsr->iOffset = x[0];
    pCsr->szPage = x[1];
  }
}

/*
** Move a statvfs cursor to the next entry in the file.
*/
static int statNext(sqlite3_vtab_cursor *pCursor){
  int rc;
  int nPayload;
410
411
412
413
414
415
416

417
418
419
420
421
422
423
          pCsr->nUnused = 0;
          pCsr->nPayload = nUsable - 4;
        }else{
          pCsr->nPayload = pCell->nLastOvfl;
          pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
        }
        pCell->iOvfl++;

        return SQLITE_OK;
      }
      if( p->iRightChildPg ) break;
      p->iCell++;
    }

    while( !p->iRightChildPg || p->iCell>p->nCell ){







>







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
          pCsr->nUnused = 0;
          pCsr->nPayload = nUsable - 4;
        }else{
          pCsr->nPayload = pCell->nLastOvfl;
          pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
        }
        pCell->iOvfl++;
        statSizeAndOffset(pCsr);
        return SQLITE_OK;
      }
      if( p->iRightChildPg ) break;
      p->iCell++;
    }

    while( !p->iRightChildPg || p->iCell>p->nCell ){
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476


  /* Populate the StatCursor fields with the values to be returned
  ** by the xColumn() and xRowid() methods.
  */
  if( rc==SQLITE_OK ){
    int i;
    sqlite3_file *fd;
    sqlite3_int64 x[2];
    StatPage *p = &pCsr->aPage[pCsr->iPage];
    pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
    pCsr->iPageno = p->iPgno;

    statDecodePage(pBt, p);

    /* The default page size and offset */
    pCsr->szPage = sqlite3BtreeGetPageSize(pBt);
    pCsr->iOffset = pCsr->szPage * (p->iPgno - 1);

    /* If connected to a ZIPVFS backend, override the page size and
    ** offset with actual values obtained from ZIPVFS.
    */
    fd = sqlite3PagerFile(pPager);
    x[0] = p->iPgno;
    if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
      pCsr->iOffset = x[0];
      pCsr->szPage = x[1];
    }

    switch( p->flags ){
      case 0x05:             /* table internal */
      case 0x02:             /* index internal */
        pCsr->zPagetype = "internal";
        break;
      case 0x0D:             /* table leaf */







<
<





|
<
<
<
<
<
<
<
<
<
<
<
<
<







469
470
471
472
473
474
475


476
477
478
479
480
481













482
483
484
485
486
487
488


  /* Populate the StatCursor fields with the values to be returned
  ** by the xColumn() and xRowid() methods.
  */
  if( rc==SQLITE_OK ){
    int i;


    StatPage *p = &pCsr->aPage[pCsr->iPage];
    pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
    pCsr->iPageno = p->iPgno;

    statDecodePage(pBt, p);
    statSizeAndOffset(pCsr);














    switch( p->flags ){
      case 0x05:             /* table internal */
      case 0x02:             /* index internal */
        pCsr->zPagetype = "internal";
        break;
      case 0x0D:             /* table leaf */