-C Better\serror\smessage\son\san\sSQLITE_RANGE\serror.\s\sTicket\s#991.\s(CVS\s2124)
-D 2004-11-20T20:18:55
+C Correct\suse\sof\susableSize\sversus\spageSize\sin\sbtree.c.\s\sTicket\s#1010.\s(CVS\s2125)
+D 2004-11-20T20:31:12
F Makefile.in e747bb5ba34ccbdd81f79dcf1b2b33c02817c21d
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
-F src/btree.c 49b09718cd988d1c7c981b03e94679bc10b5f711
+F src/btree.c c65849bd85dc8188c045bc6b44e70a470e624bbc
F src/btree.h 861e40b759a195ba63819740e484390012cf81ab
F src/build.c c7dd57fdbb330d65df241277291cad8e58687a46
F src/date.c 65536e7ea04fdde6e0551264fca15966966e171f
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
-P 297559c6d1a8c1172bb0c35cf538f6f2958c7820
-R e1b70aa789cac7356bd9698812787a2b
+P accd432e4d9626353e555e63298fb7a56a41e53d
+R 1ccf4dda121470590ad512e7b345f98d
U drh
-Z 1b775c53c7601d773da3bf83ca1cbe67
+Z c6333e370a3a5a96836061f6165224d0
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.220 2004/11/17 10:22:03 danielk1977 Exp $
+** $Id: btree.c,v 1.221 2004/11/20 20:31:12 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
#ifndef SQLITE_OMIT_AUTOVACUUM
/*
-** These two macros define the location of the pointer-map entry for a
-** database page. The first argument to each is the page size used
-** by the database (often 1024). The second is the page number to look
-** up in the pointer map.
+** These macros define the location of the pointer-map entry for a
+** database page. The first argument to each is the number of usable
+** bytes on each page of the database (often 1024). The second is the
+** page number to look up in the pointer map.
**
** PTRMAP_PAGENO returns the database page number of the pointer-map
** page that stores the required pointer. PTRMAP_PTROFFSET returns
int rc;
assert( key!=0 );
- iPtrmap = PTRMAP_PAGENO(pBt->pageSize, key);
+ iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key);
rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap);
if( rc!=SQLITE_OK ){
return rc;
}
- offset = PTRMAP_PTROFFSET(pBt->pageSize, key);
+ offset = PTRMAP_PTROFFSET(pBt->usableSize, key);
if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=pgno ){
rc = sqlite3pager_write(pPtrmap);
int offset; /* Offset of entry in pointer map */
int rc;
- iPtrmap = PTRMAP_PAGENO(pBt->pageSize, key);
+ iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key);
rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap);
if( rc!=0 ){
return rc;
}
- offset = PTRMAP_PTROFFSET(pBt->pageSize, key);
+ offset = PTRMAP_PTROFFSET(pBt->usableSize, key);
if( pEType ) *pEType = pPtrmap[offset];
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
finSize = origSize - nFreeList - nPtrMap;
if( origSize>PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){
finSize--;
- if( PTRMAP_ISPAGE(pBt->pageSize, finSize) ){
+ if( PTRMAP_ISPAGE(pBt->usableSize, finSize) ){
finSize--;
}
}
*pPgno = sqlite3pager_pagecount(pBt->pPager) + 1;
#ifndef SQLITE_OMIT_AUTOVACUUM
- if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt->pageSize, *pPgno) ){
+ if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt->usableSize, *pPgno) ){
/* If *pPgno refers to a pointer-map page, allocate two new pages
** at the end of the file instead of one. The first allocated page
** becomes a new pointer-map page, the second is used by the caller.
/* The new root-page may not be allocated on a pointer-map page, or the
** PENDING_BYTE page.
*/
- if( pgnoRoot==PTRMAP_PAGENO(pBt->pageSize, pgnoRoot) ||
+ if( pgnoRoot==PTRMAP_PAGENO(pBt->usableSize, pgnoRoot) ||
pgnoRoot==PENDING_BYTE_PAGE(pBt) ){
pgnoRoot++;
}
if( maxRootPgno==PENDING_BYTE_PAGE(pBt) ){
maxRootPgno--;
}
- if( maxRootPgno==PTRMAP_PAGENO(pBt->pageSize, maxRootPgno) ){
+ if( maxRootPgno==PTRMAP_PAGENO(pBt->usableSize, maxRootPgno) ){
maxRootPgno--;
}
assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) );
}
sCheck.anRef = sqliteMallocRaw( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );
for(i=0; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }
- i = PENDING_BYTE/pBt->pageSize + 1;
+ i = PENDING_BYTE_PAGE(pBt);
if( i<=sCheck.nPage ){
sCheck.anRef[i] = 1;
}
** references to pointer-map pages.
*/
if( sCheck.anRef[i]==0 &&
- (PTRMAP_PAGENO(pBt->pageSize, i)!=i || !pBt->autoVacuum) ){
+ (PTRMAP_PAGENO(pBt->usableSize, i)!=i || !pBt->autoVacuum) ){
checkAppendMsg(&sCheck, 0, "Page %d is never used", i);
}
if( sCheck.anRef[i]!=0 &&
- (PTRMAP_PAGENO(pBt->pageSize, i)==i && pBt->autoVacuum) ){
+ (PTRMAP_PAGENO(pBt->usableSize, i)==i && pBt->autoVacuum) ){
checkAppendMsg(&sCheck, 0, "Pointer map page %d is referenced", i);
}
#endif