From 6490bebd6227c8616388c8e69e1c51e66e469a2d Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Tue, 11 May 2004 06:17:21 +0000 Subject: [PATCH] Minor changes to the vdbe so that more tests pass. (CVS 1352) FossilOrigin-Name: 16078fe0ea146537f75b869e6b0cce202af6781b --- main.mk | 9 +++++++++ manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/tclsqlite.c | 4 ++-- src/test1.c | 10 +++++----- src/util.c | 4 ++-- src/vdbe.c | 29 +++++++++++++++++------------ src/vdbeaux.c | 6 +++++- 8 files changed, 52 insertions(+), 34 deletions(-) diff --git a/main.mk b/main.mk index 82f3a41ad6..0c580567cb 100644 --- a/main.mk +++ b/main.mk @@ -110,6 +110,15 @@ SRC = \ # Source code to the test files. # TESTSRC = \ + $(TOP)/src/os.c \ + $(TOP)/src/pager.c \ + $(TOP)/src/test1.c \ + $(TOP)/src/test2.c \ + $(TOP)/src/test3.c \ + $(TOP)/src/test5.c \ + $(TOP)/src/md5.c + +TESTSRC_ORIG = \ $(TOP)/src/btree.c \ $(TOP)/src/func.c \ $(TOP)/src/os.c \ diff --git a/manifest b/manifest index 95175d67b7..45dbac2af3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sup\sa\scouple\sof\slittle\sthings\sin\sthe\svdbe.\sselect1.test\spasses\snow.\s(CVS\s1351) -D 2004-05-11T04:54:49 +C Minor\schanges\sto\sthe\svdbe\sso\sthat\smore\stests\spass.\s(CVS\s1352) +D 2004-05-11T06:17:22 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -15,7 +15,7 @@ F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538 F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826 -F main.mk 167a4c8759531ce5d4eece431c3b962534eee157 +F main.mk 08bc0f1706964e029ef0319af0271ad79427cc71 F publish.sh 1cd5c982388560fa91eedf6a338e210f713b35c8 F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea @@ -51,8 +51,8 @@ F src/shell.c 255b8b9023cb5274f56d87df437e8ce6ef810b91 F src/sqlite.h.in 799c5e726296ec7bc20e6407cdf4df0e0bc00c0c F src/sqliteInt.h 16365a1a4cb28a9edcaada45d40d104112b3544c F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 -F src/tclsqlite.c a38bf2263a097fcc9603e818c291151de1782c11 -F src/test1.c 79956f70dddd1a28f8577bbd61c8cf28e5875eb8 +F src/tclsqlite.c fbf0fac73624ae246551a6c671f1de0235b5faa1 +F src/test1.c ba4c25985916a82cfa375145a90e2c8d4b0a6a20 F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872 F src/test3.c 1b3ac2199169fb331685c7bef15ad54721db278b F src/test4.c b3fab9aea7a8940a8a7386ce1c7e2157b09bd296 @@ -61,12 +61,12 @@ F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847 F src/trigger.c 8df308e09113410bb895e88a2db65b55490268db F src/update.c 6ca82fc4a0fb4d7f134e961921c906f6f3c8bc74 F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f -F src/util.c 74ee316594f68c41aed1884d737ab4085d479455 +F src/util.c 778a8cd03ad6e52778602d20a3132c7d2d1b0a0c F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476 -F src/vdbe.c 7ac68210a0cba08918ec62fb2aa6c9c8b5354a7d +F src/vdbe.c 06986aa8bbc244c51db532009649653161308721 F src/vdbe.h 2dc4d1161b64f5684faa6a2d292e318a185ecb2e F src/vdbeInt.h ff85e432a43eb7533b17c9cece2baaf813ba8711 -F src/vdbeaux.c 7162f1390620257e25070da1ac2b4ec83e472752 +F src/vdbeaux.c feee0e94cd5fe520cd024287446d8b387a221a4b F src/where.c 487e55b1f64c8fbf0f46a9a90c2247fc45ae6a9a F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/attach.test 76f096f384221f775cc0a856e51d5a35f9ee1541 @@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 2fffd133a5e0058f02c20c498875093261e9ee19 -R d171f27f9b6b82ac42b288cfd79095c1 +P 9ba0df4d7792dccb67782113751c0e5807348d62 +R 27fbbe84d40cb05d543d6a157e6083bd U danielk1977 -Z db84b4c7f4e2ad4c5507de4c7ea2b708 +Z 22184866a2212de63e75bbfdcd50c70f diff --git a/manifest.uuid b/manifest.uuid index 50adf8181a..f2afcec920 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ba0df4d7792dccb67782113751c0e5807348d62 \ No newline at end of file +16078fe0ea146537f75b869e6b0cce202af6781b \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 2c3b9211d4..5d880f80e1 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.64 2004/05/10 10:34:53 danielk1977 Exp $ +** $Id: tclsqlite.c,v 1.65 2004/05/11 06:17:22 danielk1977 Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -1208,7 +1208,7 @@ int TCLSH_MAIN(int argc, char **argv){ extern int Sqlitetest4_Init(Tcl_Interp*); extern int Sqlitetest5_Init(Tcl_Interp*); extern int Md5_Init(Tcl_Interp*); -/* Sqlitetest1_Init(interp); */ + Sqlitetest1_Init(interp); Sqlitetest2_Init(interp); Sqlitetest3_Init(interp); /* Sqlitetest4_Init(interp); */ diff --git a/src/test1.c b/src/test1.c index 109beb9790..22f4587f86 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.38 2004/05/10 10:34:53 danielk1977 Exp $ +** $Id: test1.c,v 1.39 2004/05/11 06:17:22 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -1010,13 +1010,13 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ for(i=0; i @@ -1148,7 +1148,7 @@ int sqlite3GetVarint(const unsigned char *p, u64 *v){ u64 x = p[0] & 0x7f; int n = 0; while( (p[n++]&0x80)!=0 ){ - x |= (p[n]&0x7f)<<(n*7); + x |= ((u64)(p[n]&0x7f))<<(n*7); } *v = x; return n; diff --git a/src/vdbe.c b/src/vdbe.c index b7d0f1559b..44282df3e2 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.277 2004/05/11 04:54:49 danielk1977 Exp $ +** $Id: vdbe.c,v 1.278 2004/05/11 06:17:22 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -2245,8 +2245,8 @@ case OP_MakeRecord: { ** ** Convert the top P1 entries of the stack into a single entry suitable ** for use as the key in an index. In addition, take one additional integer -** off of the stack, treat that integer as a four-byte record number, and -** append the four bytes to the key. Thus a total of P1+1 entries are +** off of the stack, treat that integer as an eight-byte record number, and +** append the integer to the key. Thus a total of P1+1 entries are ** popped from the stack for this instruction and a single entry is pushed ** back. The first P1 entries that are popped are strings and the last ** entry (the lowest on the stack) is an integer record number. @@ -2319,7 +2319,7 @@ case OP_MakeKey: { rc = SQLITE_TOOBIG; goto abort_due_to_error; } - if( addRowid ) nByte += sizeof(u32); + if( addRowid ) nByte += sizeof(i64); if( nByte<=NBFS ){ zNewKey = zTemp; }else{ @@ -2344,12 +2344,13 @@ case OP_MakeKey: { } } if( addRowid ){ - u32 iKey; + i64 iKey; pRec = &pTos[-nField]; assert( pRec>=p->aStack ); Integerify(pRec); + /* TODO */ iKey = intToKey(pRec->i); - memcpy(&zNewKey[j], &iKey, sizeof(u32)); + memcpy(&zNewKey[j], &iKey, sizeof(i64)); popStack(&pTos, nField+1); if( pOp->p2 && containsNull ) pc = pOp->p2 - 1; }else{ @@ -3355,7 +3356,10 @@ case OP_RowData: { pTos->flags = MEM_Null; break; }else if( pC->keyAsData || pOp->opcode==OP_RowKey ){ - /* TODO: sqlite3BtreeKeySize(pCrsr, &n); */ + i64 n64; + assert( !pC->intKey ); + sqlite3BtreeKeySize(pCrsr, &n64); + n = n64; }else{ sqlite3BtreeDataSize(pCrsr, &n); } @@ -3804,14 +3808,15 @@ case OP_IdxRecno: { assert( i>=0 && inCursor ); pTos++; if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ - int v; - int sz; + i64 v; + u64 sz; assert( p->aCsr[i].deferredMoveto==0 ); - /* TODO: sqlite3BtreeKeySize(pCrsr, &sz); */ - if( szaCsr[i].intKey==0 ); + sqlite3BtreeKeySize(pCrsr, &sz); + if( szflags = MEM_Null; }else{ - sqlite3BtreeKey(pCrsr, sz - sizeof(u32), sizeof(u32), (char*)&v); + sqlite3BtreeKey(pCrsr, sz - sizeof(i64), sizeof(i64), (char*)&v); v = keyToInt(v); pTos->i = v; pTos->flags = MEM_Int; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 16ff2d7195..f58bbef545 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1048,7 +1048,11 @@ int sqlite3VdbeCursorMoveto(Cursor *p){ if( p->deferredMoveto ){ int res; extern int sqlite3_search_count; - sqlite3BtreeMoveto(p->pCursor, (char*)&p->movetoTarget, sizeof(int), &res); + if( p->intKey ){ + sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, &res); + }else{ + sqlite3BtreeMoveto(p->pCursor,(char*)&p->movetoTarget,sizeof(i64),&res); + } p->lastRecno = keyToInt(p->movetoTarget); p->recnoIsValid = res==0; if( res<0 ){