Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | More minor changes to accomadate the new btree. All the select* tests pass now. (CVS 1353) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
941d0fdc97ad0a2ba0e823ce40022bde |
User & Date: | danielk1977 2004-05-11 06:55:14.000 |
Context
2004-05-11
| ||
07:11 | Remove code dealing with old file formats. (CVS 1354) (check-in: dfde112116 user: danielk1977 tags: trunk) | |
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) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** ** $Id: build.c,v 1.180 2004/05/11 06:55:14 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** This routine is called when a new SQL statement is beginning to ** be parsed. Check to see if the schema for the database needs |
︙ | ︙ | |||
622 623 624 625 626 627 628 | if( z==0 ) return; for(i=j=0; z[i]; i++){ int c = z[i]; if( isspace(c) ) continue; z[j++] = c; } z[j] = 0; | < | < < < | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | if( z==0 ) return; for(i=j=0; z[i]; i++){ int c = z[i]; if( isspace(c) ) continue; z[j++] = c; } z[j] = 0; pCol->sortOrder = sqlite3CollateType(z, n); } /* ** The given token is the default value for the last column added to ** the table currently under construction. If "minusFlag" is true, it ** means the value token was preceded by a minus sign. ** |
︙ | ︙ |
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.164 2004/05/11 06:55:14 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. |
︙ | ︙ | |||
320 321 322 323 324 325 326 | int order = pOrderBy->a[i].sortOrder; int type; int c; if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_TEXT ){ type = SQLITE_SO_TEXT; }else if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_NUM ){ type = SQLITE_SO_NUM; | | < < | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | int order = pOrderBy->a[i].sortOrder; int type; int c; if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_TEXT ){ type = SQLITE_SO_TEXT; }else if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_NUM ){ type = SQLITE_SO_NUM; }else{ type = sqlite3ExprType(pOrderBy->a[i].pExpr); } if( (order & SQLITE_SO_DIRMASK)==SQLITE_SO_ASC ){ c = type==SQLITE_SO_TEXT ? 'A' : '+'; }else{ c = type==SQLITE_SO_TEXT ? 'D' : '-'; } zSortOrder[i] = c; |
︙ | ︙ | |||
424 425 426 427 428 429 430 | ** part of the result. */ if( distinct>=0 && pEList && pEList->nExpr>0 ){ #if NULL_ALWAYS_DISTINCT sqlite3VdbeAddOp(v, OP_IsNull, -pEList->nExpr, sqlite3VdbeCurrentAddr(v)+7); #endif sqlite3VdbeAddOp(v, OP_MakeKey, pEList->nExpr, 1); | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | ** part of the result. */ if( distinct>=0 && pEList && pEList->nExpr>0 ){ #if NULL_ALWAYS_DISTINCT sqlite3VdbeAddOp(v, OP_IsNull, -pEList->nExpr, sqlite3VdbeCurrentAddr(v)+7); #endif sqlite3VdbeAddOp(v, OP_MakeKey, pEList->nExpr, 1); sqlite3AddKeyType(v, pEList); sqlite3VdbeAddOp(v, OP_Distinct, distinct, sqlite3VdbeCurrentAddr(v)+3); sqlite3VdbeAddOp(v, OP_Pop, pEList->nExpr+1, 0); sqlite3VdbeAddOp(v, OP_Goto, 0, iContinue); sqlite3VdbeAddOp(v, OP_String, 0, 0); sqlite3VdbeAddOp(v, OP_PutStrKey, distinct, 0); } |
︙ | ︙ | |||
2323 2324 2325 2326 2327 2328 2329 | AggExpr *pAgg; if( pGroupBy ){ int lbl1; for(i=0; i<pGroupBy->nExpr; i++){ sqlite3ExprCode(pParse, pGroupBy->a[i].pExpr); } sqlite3VdbeAddOp(v, OP_MakeKey, pGroupBy->nExpr, 0); | | | 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 | AggExpr *pAgg; if( pGroupBy ){ int lbl1; for(i=0; i<pGroupBy->nExpr; i++){ sqlite3ExprCode(pParse, pGroupBy->a[i].pExpr); } sqlite3VdbeAddOp(v, OP_MakeKey, pGroupBy->nExpr, 0); sqlite3AddKeyType(v, pGroupBy); lbl1 = sqlite3VdbeMakeLabel(v); sqlite3VdbeAddOp(v, OP_AggFocus, 0, lbl1); for(i=0, pAgg=pParse->aAgg; i<pParse->nAgg; i++, pAgg++){ if( pAgg->isAgg ) continue; sqlite3ExprCode(pParse, pAgg->pExpr); sqlite3VdbeAddOp(v, OP_AggSet, 0, i); } |
︙ | ︙ |
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.279 2004/05/11 06:55:15 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
2344 2345 2346 2347 2348 2349 2350 | } } if( addRowid ){ i64 iKey; pRec = &pTos[-nField]; assert( pRec>=p->aStack ); Integerify(pRec); | < | 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | } } if( addRowid ){ i64 iKey; pRec = &pTos[-nField]; assert( pRec>=p->aStack ); Integerify(pRec); 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); } |
︙ | ︙ | |||
3038 3039 3040 3041 3042 3043 3044 | */ case OP_NotExists: { int i = pOp->p1; BtCursor *pCrsr; assert( pTos>=p->aStack ); assert( i>=0 && i<p->nCursor ); if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ | | > > | | 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 | */ case OP_NotExists: { int i = pOp->p1; BtCursor *pCrsr; assert( pTos>=p->aStack ); assert( i>=0 && i<p->nCursor ); if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ int res, rx; u64 iKey; assert( pTos->flags & MEM_Int ); assert( p->aCsr[i].intKey ); iKey = intToKey(pTos->i); rx = sqlite3BtreeMoveto(pCrsr, 0, iKey, &res); p->aCsr[i].lastRecno = pTos->i; p->aCsr[i].recnoIsValid = res==0; p->aCsr[i].nullRow = 0; if( rx!=SQLITE_OK || res!=0 ){ pc = pOp->p2 - 1; p->aCsr[i].recnoIsValid = 0; } |
︙ | ︙ | |||
3566 3567 3568 3569 3570 3571 3572 | BtCursor *pCrsr; assert( p->aCsr[i].keyAsData ); assert( !p->aCsr[i].pseudoTable ); assert( i>=0 && i<p->nCursor ); pTos++; if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ | | > | | 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 | BtCursor *pCrsr; assert( p->aCsr[i].keyAsData ); assert( !p->aCsr[i].pseudoTable ); assert( i>=0 && i<p->nCursor ); pTos++; if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ u64 amt; char *z; sqlite3VdbeCursorMoveto(&p->aCsr[i]); assert( p->aCsr[i].intKey==0 ); sqlite3BtreeKeySize(pCrsr, &amt); if( amt<=0 ){ rc = SQLITE_CORRUPT; goto abort_due_to_error; } if( amt>NBFS ){ z = sqliteMallocRaw( amt ); if( z==0 ) goto no_mem; |
︙ | ︙ | |||
3730 3731 3732 3733 3734 3735 3736 | assert( pTos>=p->aStack ); assert( i>=0 && i<p->nCursor ); assert( pTos->flags & MEM_Str ); if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ int nKey = pTos->n; const char *zKey = pTos->z; if( pOp->p2 ){ | | > | | 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 | assert( pTos>=p->aStack ); assert( i>=0 && i<p->nCursor ); assert( pTos->flags & MEM_Str ); if( (pCrsr = p->aCsr[i].pCursor)!=0 ){ int nKey = pTos->n; const char *zKey = pTos->z; if( pOp->p2 ){ int res; u64 n; assert( nKey >= 4 ); rc = sqlite3BtreeMoveto(pCrsr, zKey, nKey-4, &res); if( rc!=SQLITE_OK ) goto abort_due_to_error; while( res!=0 ){ int c; sqlite3BtreeKeySize(pCrsr, &n); if( n==nKey /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */ && sqlite2BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &c)==SQLITE_OK && c==0 ){ rc = SQLITE_CONSTRAINT; if( pOp->p3 && pOp->p3[0] ){ |
︙ | ︙ |