Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor changes to the vdbe so that more tests pass. (CVS 1352) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
16078fe0ea146537f75b869e6b0cce20 |
User & Date: | danielk1977 2004-05-11 06:17:22.000 |
Context
2004-05-11
| ||
06:55 | More minor changes to accomadate the new btree. All the select* tests pass now. (CVS 1353) (check-in: 941d0fdc97 user: danielk1977 tags: trunk) | |
06:17 | Minor changes to the vdbe so that more tests pass. (CVS 1352) (check-in: 16078fe0ea user: danielk1977 tags: trunk) | |
04:54 | Fix up a couple of little things in the vdbe. select1.test passes now. (CVS 1351) (check-in: 9ba0df4d77 user: danielk1977 tags: trunk) | |
Changes
Changes to main.mk.
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 | $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbeInt.h \ $(TOP)/src/where.c # Source code to the test files. # TESTSRC = \ $(TOP)/src/btree.c \ $(TOP)/src/func.c \ $(TOP)/src/os.c \ $(TOP)/src/pager.c \ $(TOP)/src/test1.c \ $(TOP)/src/test2.c \ $(TOP)/src/test3.c \ | > > > > > > > > > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbeInt.h \ $(TOP)/src/where.c # 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 \ $(TOP)/src/pager.c \ $(TOP)/src/test1.c \ $(TOP)/src/test2.c \ $(TOP)/src/test3.c \ |
︙ | ︙ |
Changes to src/tclsqlite.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** A TCL Interface to SQLite ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** A TCL Interface to SQLite ** ** $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 */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | { extern int Sqlitetest1_Init(Tcl_Interp*); extern int Sqlitetest2_Init(Tcl_Interp*); extern int Sqlitetest3_Init(Tcl_Interp*); extern int Sqlitetest4_Init(Tcl_Interp*); extern int Sqlitetest5_Init(Tcl_Interp*); extern int Md5_Init(Tcl_Interp*); | | | 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | { extern int Sqlitetest1_Init(Tcl_Interp*); extern int Sqlitetest2_Init(Tcl_Interp*); extern int Sqlitetest3_Init(Tcl_Interp*); extern int Sqlitetest4_Init(Tcl_Interp*); extern int Sqlitetest5_Init(Tcl_Interp*); extern int Md5_Init(Tcl_Interp*); Sqlitetest1_Init(interp); Sqlitetest2_Init(interp); Sqlitetest3_Init(interp); /* Sqlitetest4_Init(interp); */ Sqlitetest5_Init(interp); Md5_Init(interp); } #endif |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.39 2004/05/11 06:17:22 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include "os.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | { "breakpoint", (Tcl_CmdProc*)test_breakpoint }, }; int i; for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){ Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0); } | | | | | | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | { "breakpoint", (Tcl_CmdProc*)test_breakpoint }, }; int i; for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){ Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0); } Tcl_LinkVar(interp, "sqlite_search_count", (char*)&sqlite3_search_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_interrupt_count", (char*)&sqlite3_interrupt_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_open_file_count", (char*)&sqlite3_open_file_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_current_time", (char*)&sqlite3_current_time, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_static_bind_value", (char*)&sqlite_static_bind_value, TCL_LINK_STRING); return TCL_OK; } |
Changes to src/util.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** ** $Id: util.c,v 1.80 2004/05/11 06:17:22 danielk1977 Exp $ */ #include "sqliteInt.h" #include <stdarg.h> #include <ctype.h> /* ** If malloc() ever fails, this global variable gets set to 1. |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | return i; } int sqlite3GetVarint(const unsigned char *p, u64 *v){ u64 x = p[0] & 0x7f; int n = 0; while( (p[n++]&0x80)!=0 ){ | | | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | return i; } int sqlite3GetVarint(const unsigned char *p, u64 *v){ u64 x = p[0] & 0x7f; int n = 0; while( (p[n++]&0x80)!=0 ){ x |= ((u64)(p[n]&0x7f))<<(n*7); } *v = x; return n; } int sqlite3VarintLen(u64 v){ int i = 0; |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** 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.278 2004/05/11 06:17:22 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
2241 2242 2243 2244 2245 2246 2247 | ** ** See also: MakeIdxKey, SortMakeKey */ /* Opcode: MakeIdxKey P1 P2 P3 ** ** 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 | | | | 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 | ** ** See also: MakeIdxKey, SortMakeKey */ /* Opcode: MakeIdxKey P1 P2 P3 ** ** 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 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. ** ** The converstion of the first P1 string entries occurs just like in ** MakeKey. Each entry is separated from the others by a null. ** The entire concatenation is null-terminated. The lowest entry |
︙ | ︙ | |||
2315 2316 2317 2318 2319 2320 2321 | nByte += pRec->n+1; } } if( nByte+sizeof(u32)>MAX_BYTES_PER_ROW ){ rc = SQLITE_TOOBIG; goto abort_due_to_error; } | | | 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 | nByte += pRec->n+1; } } if( nByte+sizeof(u32)>MAX_BYTES_PER_ROW ){ rc = SQLITE_TOOBIG; goto abort_due_to_error; } if( addRowid ) nByte += sizeof(i64); if( nByte<=NBFS ){ zNewKey = zTemp; }else{ zNewKey = sqliteMallocRaw( nByte ); if( zNewKey==0 ) goto no_mem; } j = 0; |
︙ | ︙ | |||
2340 2341 2342 2343 2344 2345 2346 | assert( pRec->flags & MEM_Str ); zNewKey[j++] = 'c'; memcpy(&zNewKey[j], pRec->z, pRec->n); j += pRec->n; } } if( addRowid ){ | | > | | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 | assert( pRec->flags & MEM_Str ); zNewKey[j++] = 'c'; memcpy(&zNewKey[j], pRec->z, pRec->n); j += pRec->n; } } if( addRowid ){ i64 iKey; pRec = &pTos[-nField]; assert( pRec>=p->aStack ); Integerify(pRec); /* TODO */ iKey = intToKey(pRec->i); memcpy(&zNewKey[j], &iKey, sizeof(i64)); popStack(&pTos, nField+1); if( pOp->p2 && containsNull ) pc = pOp->p2 - 1; }else{ if( pOp->p2==0 ) popStack(&pTos, nField); } pTos++; pTos->n = nByte; |
︙ | ︙ | |||
3351 3352 3353 3354 3355 3356 3357 | }else if( pC->pCursor!=0 ){ BtCursor *pCrsr = pC->pCursor; sqlite3VdbeCursorMoveto(pC); if( pC->nullRow ){ pTos->flags = MEM_Null; break; }else if( pC->keyAsData || pOp->opcode==OP_RowKey ){ | > > | > | 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 | }else if( pC->pCursor!=0 ){ BtCursor *pCrsr = pC->pCursor; sqlite3VdbeCursorMoveto(pC); if( pC->nullRow ){ pTos->flags = MEM_Null; break; }else if( pC->keyAsData || pOp->opcode==OP_RowKey ){ i64 n64; assert( !pC->intKey ); sqlite3BtreeKeySize(pCrsr, &n64); n = n64; }else{ sqlite3BtreeDataSize(pCrsr, &n); } pTos->n = n; if( n<=NBFS ){ pTos->flags = MEM_Str | MEM_Short; pTos->z = pTos->zShort; |
︙ | ︙ | |||
3800 3801 3802 3803 3804 3805 3806 | case OP_IdxRecno: { int i = pOp->p1; BtCursor *pCrsr; assert( i>=0 && i<p->nCursor ); pTos++; if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ | | | > | | | | 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 | case OP_IdxRecno: { int i = pOp->p1; BtCursor *pCrsr; assert( i>=0 && i<p->nCursor ); pTos++; if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ i64 v; u64 sz; assert( p->aCsr[i].deferredMoveto==0 ); assert( p->aCsr[i].intKey==0 ); sqlite3BtreeKeySize(pCrsr, &sz); if( sz<sizeof(i64) ){ pTos->flags = MEM_Null; }else{ sqlite3BtreeKey(pCrsr, sz - sizeof(i64), sizeof(i64), (char*)&v); v = keyToInt(v); pTos->i = v; pTos->flags = MEM_Int; } }else{ pTos->flags = MEM_Null; } |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
1044 1045 1046 1047 1048 1049 1050 | ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ int sqlite3VdbeCursorMoveto(Cursor *p){ if( p->deferredMoveto ){ int res; extern int sqlite3_search_count; | > | > > > | 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ int sqlite3VdbeCursorMoveto(Cursor *p){ if( p->deferredMoveto ){ int res; extern int sqlite3_search_count; 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 ){ sqlite3BtreeNext(p->pCursor, &res); } sqlite3_search_count++; p->deferredMoveto = 0; |
︙ | ︙ |