SQLite

Check-in [30c26c3b13]
Login

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

Overview
Comment:The previous check-in with changes to the max_page_count pragma was not quite correct. This check-in fixes the problem.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 30c26c3b13b29ce57683e91ac11641d4eb4d678f
User & Date: drh 2010-11-23 20:25:09.000
Context
2010-11-23
20:55
Cherry-pick the lemon.c updates out of the lemon-update-2010 branch into the trunk. (check-in: 1541ae3fbd user: drh tags: trunk)
20:25
The previous check-in with changes to the max_page_count pragma was not quite correct. This check-in fixes the problem. (check-in: 30c26c3b13 user: drh tags: trunk)
18:59
Fix the max_page_count pragma so that it will not set to a value smaller than the current database size, as the documentation requires. Also, remove all occurances of atoi() from the core. (check-in: 2031974b60 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/pager.c.
3479
3480
3481
3482
3483
3484
3485
3486
3487


3488
3489
3490
3491
3492
3493
3494
3495
3479
3480
3481
3482
3483
3484
3485


3486
3487

3488
3489
3490
3491
3492
3493
3494







-
-
+
+
-







**
** Regardless of mxPage, return the current maximum page count.
*/
int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
  if( mxPage>0 ){
    pPager->mxPgno = mxPage;
  }
  if( pPager->eState!=PAGER_OPEN && pPager->mxPgno<pPager->dbSize ){
    pPager->mxPgno = pPager->dbSize;
  assert( pPager->eState!=PAGER_OPEN );      /* Called only by OP_MaxPgcnt */
  assert( pPager->mxPgno>=pPager->dbSize );  /* OP_MaxPgcnt enforces this */
  }
  return pPager->mxPgno;
}

/*
** The following set of routines are used to disable the simulated
** I/O error mechanism.  These routines are used to avoid simulated
** errors in places where we do not care about errors.
Changes to src/vdbe.c.
5789
5790
5791
5792
5793
5794
5795
5796



5797
5798
5799
5800

5801
5802
5803


5804
5805




5806
5807
5808
5809
5810
5811
5812
5789
5790
5791
5792
5793
5794
5795

5796
5797
5798
5799
5800
5801

5802
5803
5804
5805
5806
5807


5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818







-
+
+
+



-
+



+
+
-
-
+
+
+
+







#endif


#ifndef  SQLITE_OMIT_PAGER_PRAGMAS
/* Opcode: MaxPgcnt P1 P2 P3 * *
**
** Try to set the maximum page count for database P1 to the value in P3.
** Do not let the maximum page count fall below the current page count.
** Do not let the maximum page count fall below the current page count and
** do not change the maximum page count value if P3==0.
**
** Store the maximum page count after the change in register P2.
*/
case OP_MaxPgcnt: {            /* out2-prerelease */
  unsigned int pgcnt;
  unsigned int newMax;
  Btree *pBt;

  pBt = db->aDb[pOp->p1].pBt;
  newMax = 0;
  if( pOp->p3 ){
  pgcnt = sqlite3BtreeLastPage(pBt);
  pOut->u.i = sqlite3BtreeMaxPageCount(pBt, pOp->p3<pgcnt ? pgcnt : pOp->p3);
    newMax = sqlite3BtreeLastPage(pBt);
    if( pOp->p3>newMax ) newMax = pOp->p3;
  }
  pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax);
  break;
}
#endif


#ifndef SQLITE_OMIT_TRACE
/* Opcode: Trace * * * P4 *