-C The\spager\snow\shandles\sfile\s":memory:"\scomplete\sin\smemory\swith\sno\sdisk\sI/O.\s(CVS\s1363)
-D 2004-05-12T13:30:08
+C Btree\suses\ssigned\sintegers\sfor\sthe\srowid.\s\sThe\sintToKey()\sand\skeyToInt()\smacros\nare\snow\sno-ops.\s(CVS\s1364)
+D 2004-05-12T15:15:47
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
F src/attach.c c315c58cb16fd6e913b3bfa6412aedecb4567fa5
F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
-F src/btree.c 35df9e6d3a30bbe2d32d6b08f51e2a16b835c6e8
-F src/btree.h 578dc465c801cf4e7666efbb0fa1c46a54758008
+F src/btree.c 62a870f24d3fa067d206596c7a8686192edf8deb
+F src/btree.h 5549569274a78d31c941845e0771b878755b07e5
F src/btree_rb.c 9d7973e266ee6f9c61ce592f68742ce9cd5b10e5
F src/build.c f25e4ac9f102efd70188bc09a459c2b461fe2135
F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29
F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
F src/vdbe.c 9b82d9ed192729e00581ae08d1cd71a27a698fe0
F src/vdbe.h 71c02a75d506a3ce9f6bdfc78101528d5edf319b
-F src/vdbeInt.h 3610b51a3207f1d4e780748a6d8f13cfe98ce2f7
+F src/vdbeInt.h 608a0b092a2ab3ab7538384e5e3da09ae512d50c
F src/vdbeaux.c c976c7fe334a1d1c102dda410546e880549a6060
F src/where.c 487e55b1f64c8fbf0f46a9a90c2247fc45ae6a9a
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 2f16c9ef3c101c4280991ce3cb0c3bea7b6ed439
-R 34cbf66e13c9fd717a5c35355887a263
+P 97de9f7ceebab859ef984d155808575ad321afc0
+R 2679bc087b647fe5d90e5a7c20264be0
U drh
-Z fff149a4adda820449b55f8e9ff0bdd9
+Z bf6ca6f575d739fe1938b329ef825f50
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.127 2004/05/11 09:31:32 drh Exp $
+** $Id: btree.c,v 1.128 2004/05/12 15:15:47 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
MemPage *pPage, /* Page containing the cell */
unsigned char *pCell, /* The cell */
u64 *pnData, /* Number of bytes of data in payload */
- u64 *pnKey, /* Number of bytes of key, or key value for intKey */
+ i64 *pnKey, /* Number of bytes of key, or key value for intKey */
int *pnHeader /* Size of header in bytes. Offset to payload */
){
int n;
}else{
n += getVarint(&pCell[n], pnData);
}
- n += getVarint(&pCell[n], pnKey);
+ n += getVarint(&pCell[n], (u64*)pnKey);
*pnHeader = n;
}
*/
static int cellSize(MemPage *pPage, unsigned char *pCell){
int n;
- u64 nData, nKey;
+ u64 nData;
+ i64 nKey;
int nPayload, maxPayload;
parseCellHeader(pPage, pCell, &nData, &nKey, &n);
** the right size. This is to guard against size changes that result
** when compiling on a different architecture.
*/
+ assert( sizeof(i64)==8 );
assert( sizeof(u64)==8 );
assert( sizeof(u32)==4 );
assert( sizeof(u16)==2 );
** For a table with the INTKEY flag set, this routine returns the key
** itself, not the number of bytes in the key.
*/
-int sqlite3BtreeKeySize(BtCursor *pCur, u64 *pSize){
+int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
MemPage *pPage;
unsigned char *cell;
int rc;
MemPage *pPage;
Btree *pBt;
- u64 nData, nKey;
+ u64 nData;
+ i64 nKey;
int maxLocal, ovflSize;
assert( pCur!=0 && pCur->pPage!=0 );
}else{
aPayload += getVarint(aPayload, &nData);
}
- aPayload += getVarint(aPayload, &nKey);
+ aPayload += getVarint(aPayload, (u64*)&nKey);
if( pPage->intKey ){
nKey = 0;
}
unsigned char *aPayload;
MemPage *pPage;
Btree *pBt;
- u64 nData, nKey;
+ u64 nData;
+ i64 nKey;
int maxLocal;
assert( pCur!=0 && pCur->pPage!=0 );
}else{
aPayload += getVarint(aPayload, &nData);
}
- aPayload += getVarint(aPayload, &nKey);
+ aPayload += getVarint(aPayload, (u64*)&nKey);
if( pPage->intKey ){
nKey = 0;
}
** *pRes>0 The cursor is left pointing at an entry that
** is larger than pKey.
*/
-int sqlite3BtreeMoveto(BtCursor *pCur, const void *pKey, u64 nKey, int *pRes){
+int sqlite3BtreeMoveto(BtCursor *pCur, const void *pKey, i64 nKey, int *pRes){
int rc;
if( pCur->status ){
pageIntegrity(pPage);
while( lwr<=upr ){
const void *pCellKey;
- u64 nCellKey;
+ i64 nCellKey;
pCur->idx = (lwr+upr)/2;
sqlite3BtreeKeySize(pCur, &nCellKey);
if( pPage->intKey ){
static int clearCell(MemPage *pPage, unsigned char *pCell){
Btree *pBt = pPage->pBt;
int rc, n, nPayload;
- u64 nData, nKey;
+ u64 nData;
+ i64 nKey;
Pgno ovflPgno;
parseCellHeader(pPage, pCell, &nData, &nKey, &n);
static int fillInCell(
MemPage *pPage, /* The page that contains the cell */
unsigned char *pCell, /* Complete text of the cell */
- const void *pKey, u64 nKey, /* The key */
+ const void *pKey, i64 nKey, /* The key */
const void *pData,int nData, /* The data */
int *pnSize /* Write cell size here */
){
if( !pPage->zeroData ){
nHeader += putVarint(&pCell[nHeader], nData);
}
- nHeader += putVarint(&pCell[nHeader], nKey);
+ nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey);
/* Fill in the payload */
if( pPage->zeroData ){
*/
int sqlite3BtreeInsert(
BtCursor *pCur, /* Insert data into the table of this cursor */
- const void *pKey, u64 nKey, /* The key of the new record */
+ const void *pKey, i64 nKey, /* The key of the new record */
const void *pData, int nData /* The data of the new record */
){
int rc;
rc = sqlite3BtreeMoveto(pCur, pKey, nKey, &loc);
if( rc ) return rc;
pPage = pCur->pPage;
+ assert( pPage->intKey || nKey>=0 );
TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
pCur->pgnoRoot, nKey, nData, pPage->pgno,
loc==0 ? "overwrite" : "new entry"));
assert( hdr == (pgno==1 ? 100 : 0) );
idx = get2byte(&data[hdr+3]);
while( idx>0 && idx<=pBt->pageSize ){
- u64 nData, nKey;
+ u64 nData;
+ i64 nKey;
int nHeader;
Pgno child;
unsigned char *pCell = &data[idx];
cur.pPage = pPage;
for(i=0; i<pPage->nCell; i++){
u8 *pCell = pPage->aCell[i];
- u64 nKey, nData;
+ i64 nKey;
+ u64 nData;
int sz, nHeader;
/* Check payload overflow pages
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
**
-** @(#) $Id: btree.h,v 1.45 2004/05/11 00:58:56 drh Exp $
+** @(#) $Id: btree.h,v 1.46 2004/05/12 15:15:47 drh Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_
);
int sqlite3BtreeCloseCursor(BtCursor*);
-int sqlite3BtreeMoveto(BtCursor*, const void *pKey, u64 nKey, int *pRes);
+int sqlite3BtreeMoveto(BtCursor*, const void *pKey, i64 nKey, int *pRes);
int sqlite3BtreeDelete(BtCursor*);
-int sqlite3BtreeInsert(BtCursor*, const void *pKey, u64 nKey,
+int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
const void *pData, int nData);
int sqlite3BtreeFirst(BtCursor*, int *pRes);
int sqlite3BtreeLast(BtCursor*, int *pRes);
int sqlite3BtreeEof(BtCursor*);
int sqlite3BtreeFlags(BtCursor*);
int sqlite3BtreePrevious(BtCursor*, int *pRes);
-int sqlite3BtreeKeySize(BtCursor*, u64 *pSize);
+int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
const void *sqlite3BtreeKeyFetch(BtCursor*, int amt);
const void *sqlite3BtreeDataFetch(BtCursor*, int amt);