/ Check-in [ad7c9eed]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ad7c9eed8bbd607babce4f5965f587c873e7bc02
User & Date: dan 2011-10-05 17:36:27
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: fa5ed532 user: drh tags: trunk
17:36
Fix test code related to reporting the size of overflow pages in zipvfs databases. check-in: ad7c9eed 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: 328cc186 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_stat.c.

   351    351           }
   352    352         }
   353    353       }
   354    354     }
   355    355   
   356    356     return SQLITE_OK;
   357    357   }
          358  +
          359  +/*
          360  +** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
          361  +** the current value of pCsr->iPageno.
          362  +*/
          363  +static void statSizeAndOffset(StatCursor *pCsr){
          364  +  StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
          365  +  Btree *pBt = pTab->db->aDb[0].pBt;
          366  +  Pager *pPager = sqlite3BtreePager(pBt);
          367  +  sqlite3_file *fd;
          368  +  sqlite3_int64 x[2];
          369  +
          370  +  /* The default page size and offset */
          371  +  pCsr->szPage = sqlite3BtreeGetPageSize(pBt);
          372  +  pCsr->iOffset = pCsr->szPage * (pCsr->iPageno - 1);
          373  +
          374  +  /* If connected to a ZIPVFS backend, override the page size and
          375  +  ** offset with actual values obtained from ZIPVFS.
          376  +  */
          377  +  fd = sqlite3PagerFile(pPager);
          378  +  x[0] = pCsr->iPageno;
          379  +  if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
          380  +    pCsr->iOffset = x[0];
          381  +    pCsr->szPage = x[1];
          382  +  }
          383  +}
   358    384   
   359    385   /*
   360    386   ** Move a statvfs cursor to the next entry in the file.
   361    387   */
   362    388   static int statNext(sqlite3_vtab_cursor *pCursor){
   363    389     int rc;
   364    390     int nPayload;
................................................................................
   410    436             pCsr->nUnused = 0;
   411    437             pCsr->nPayload = nUsable - 4;
   412    438           }else{
   413    439             pCsr->nPayload = pCell->nLastOvfl;
   414    440             pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
   415    441           }
   416    442           pCell->iOvfl++;
          443  +        statSizeAndOffset(pCsr);
   417    444           return SQLITE_OK;
   418    445         }
   419    446         if( p->iRightChildPg ) break;
   420    447         p->iCell++;
   421    448       }
   422    449   
   423    450       while( !p->iRightChildPg || p->iCell>p->nCell ){
................................................................................
   442    469   
   443    470   
   444    471     /* Populate the StatCursor fields with the values to be returned
   445    472     ** by the xColumn() and xRowid() methods.
   446    473     */
   447    474     if( rc==SQLITE_OK ){
   448    475       int i;
   449         -    sqlite3_file *fd;
   450         -    sqlite3_int64 x[2];
   451    476       StatPage *p = &pCsr->aPage[pCsr->iPage];
   452    477       pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
   453    478       pCsr->iPageno = p->iPgno;
   454    479   
   455    480       statDecodePage(pBt, p);
   456         -
   457         -    /* The default page size and offset */
   458         -    pCsr->szPage = sqlite3BtreeGetPageSize(pBt);
   459         -    pCsr->iOffset = pCsr->szPage * (p->iPgno - 1);
   460         -
   461         -    /* If connected to a ZIPVFS backend, override the page size and
   462         -    ** offset with actual values obtained from ZIPVFS.
   463         -    */
   464         -    fd = sqlite3PagerFile(pPager);
   465         -    x[0] = p->iPgno;
   466         -    if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
   467         -      pCsr->iOffset = x[0];
   468         -      pCsr->szPage = x[1];
   469         -    }
          481  +    statSizeAndOffset(pCsr);
   470    482   
   471    483       switch( p->flags ){
   472    484         case 0x05:             /* table internal */
   473    485         case 0x02:             /* index internal */
   474    486           pCsr->zPagetype = "internal";
   475    487           break;
   476    488         case 0x0D:             /* table leaf */