1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

The previous check-in with changes to the max_page_count pragma was not

quite correct.  This check-in fixes the problem.

FossilOrigin-Name: 30c26c3b13b29ce57683e91ac11641d4eb4d678f
This commit is contained in:
drh
2010-11-23 20:25:08 +00:00
parent 60ac3f426c
commit c84e033c92
4 changed files with 23 additions and 18 deletions

View File

@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hash: SHA1
C Fix\sthe\smax_page_count\spragma\sso\sthat\sit\swill\snot\sset\sto\sa\svalue\ssmaller\nthan\sthe\scurrent\sdatabase\ssize,\sas\sthe\sdocumentation\srequires.\s\sAlso,\nremove\sall\soccurances\sof\satoi()\sfrom\sthe\score. C The\sprevious\scheck-in\swith\schanges\sto\sthe\smax_page_count\spragma\swas\snot\nquite\scorrect.\s\sThis\scheck-in\sfixes\sthe\sproblem.
D 2010-11-23T18:59:28 D 2010-11-23T20:25:09
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in e7a59672eaeb04408d1fa8501618d7501a3c5e39 F Makefile.in e7a59672eaeb04408d1fa8501618d7501a3c5e39
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -165,7 +165,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
F src/os_unix.c 6bbb2ac121efad111c8955d03d667946c73b1b42 F src/os_unix.c 6bbb2ac121efad111c8955d03d667946c73b1b42
F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad
F src/pager.c a8b36940ca8afcb45224e0017669782b3b2c90a3 F src/pager.c c0aca5c733c15a16fe158c3215d857841a4e5381
F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76 F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa
@@ -231,7 +231,7 @@ F src/update.c 227e6cd512108b84f69421fc6c7aa1b83d60d6e0
F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685 F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685
F src/util.c ab1c92426494f499f42b9e307537b03e923d75c1 F src/util.c ab1c92426494f499f42b9e307537b03e923d75c1
F src/vacuum.c 924bd1bcee2dfb05376f79845bd3b4cec7b54b2f F src/vacuum.c 924bd1bcee2dfb05376f79845bd3b4cec7b54b2f
F src/vdbe.c c7e4f78c4dd263241b24d164351b8d9cdb50e3c8 F src/vdbe.c 7aef0a9e174099a0b2d6b940ca9d3ae9833fd014
F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2 F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2
F src/vdbeInt.h 7f4cf1b2b69bef3a432b1f23dfebef57275436b4 F src/vdbeInt.h 7f4cf1b2b69bef3a432b1f23dfebef57275436b4
F src/vdbeapi.c fb0036185b3c56e15916a5ee96309cd4acf6818f F src/vdbeapi.c fb0036185b3c56e15916a5ee96309cd4acf6818f
@@ -892,14 +892,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 3df3e79b56821201b4f5ecd23f94d485745c48c3 P 2031974b606ef713b5f34522b2221470d98687c5
R d6d12a53ba894b3f7fea4dc3bcc807a0 R d34b2457d9d1035e2a60e5eb06d21569
U drh U drh
Z 1d6a40ca5db70d8ab4bdb6ba9632081d Z fbb01e8d56a3856140a9dad516cc6382
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux) Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFM7A8UoxKgR168RlERAiLFAJwN4OTIE38FGud8XoxtDlxqTpHsigCfT9xh iD8DBQFM7CMooxKgR168RlERArRvAJwMEwsEjVQudcr0WDhJNGbD2Xz8awCggZh7
qywgx7z1po++UXATymbWvhQ= Kv4Hy5tb/qCjHMEPNCrNPgI=
=FWyf =AK9d
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@@ -1 +1 @@
2031974b606ef713b5f34522b2221470d98687c5 30c26c3b13b29ce57683e91ac11641d4eb4d678f

View File

@@ -3483,9 +3483,8 @@ int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
if( mxPage>0 ){ if( mxPage>0 ){
pPager->mxPgno = mxPage; pPager->mxPgno = mxPage;
} }
if( pPager->eState!=PAGER_OPEN && pPager->mxPgno<pPager->dbSize ){ assert( pPager->eState!=PAGER_OPEN ); /* Called only by OP_MaxPgcnt */
pPager->mxPgno = pPager->dbSize; assert( pPager->mxPgno>=pPager->dbSize ); /* OP_MaxPgcnt enforces this */
}
return pPager->mxPgno; return pPager->mxPgno;
} }

View File

@@ -5793,16 +5793,22 @@ case OP_Pagecount: { /* out2-prerelease */
/* Opcode: MaxPgcnt P1 P2 P3 * * /* Opcode: MaxPgcnt P1 P2 P3 * *
** **
** Try to set the maximum page count for database P1 to the value in 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. ** Store the maximum page count after the change in register P2.
*/ */
case OP_MaxPgcnt: { /* out2-prerelease */ case OP_MaxPgcnt: { /* out2-prerelease */
unsigned int pgcnt; unsigned int newMax;
Btree *pBt; Btree *pBt;
pBt = db->aDb[pOp->p1].pBt; pBt = db->aDb[pOp->p1].pBt;
pgcnt = sqlite3BtreeLastPage(pBt); newMax = 0;
pOut->u.i = sqlite3BtreeMaxPageCount(pBt, pOp->p3<pgcnt ? pgcnt : pOp->p3); if( pOp->p3 ){
newMax = sqlite3BtreeLastPage(pBt);
if( pOp->p3>newMax ) newMax = pOp->p3;
}
pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax);
break; break;
} }
#endif #endif