diff options
author | danielk1977 <danielk1977@noemail.net> | 2004-05-18 10:06:24 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2004-05-18 10:06:24 +0000 |
commit | bf3b721fab9d66860e80a598af20a15e1a0ee9bb (patch) | |
tree | ff712f574e2367c9ee48d9b49e1f26db8db45470 /src | |
parent | 84ac9d02dd8ff5d03ce8bc5e91a68c0989633eef (diff) | |
download | sqlite-bf3b721fab9d66860e80a598af20a15e1a0ee9bb.tar.gz sqlite-bf3b721fab9d66860e80a598af20a15e1a0ee9bb.zip |
Fix many problems with manifest types and column affinity. Most things are
working now. (CVS 1393)
FossilOrigin-Name: ad4a964158ba9ca9d221cf7ea0439577f3894890
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 11 | ||||
-rw-r--r-- | src/btree.h | 8 | ||||
-rw-r--r-- | src/expr.c | 20 | ||||
-rw-r--r-- | src/parse.y | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 5 | ||||
-rw-r--r-- | src/trigger.c | 4 | ||||
-rw-r--r-- | src/vdbe.h | 5 | ||||
-rw-r--r-- | src/vdbeInt.h | 2 |
8 files changed, 38 insertions, 21 deletions
diff --git a/src/btree.c b/src/btree.c index b4a5dcb84..cb91dc3a4 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.141 2004/05/16 16:24:37 drh Exp $ +** $Id: btree.c,v 1.142 2004/05/18 10:06:25 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -1406,6 +1406,15 @@ create_cursor_exception: return rc; } +void sqlite3BtreeSetCompare( + BtCursor *pCur, + int(* xCmp)(void*,int,const void*,int,const void*), + void *pArg +){ + pCur->xCompare = xCmp ? xCmp : dfltCompare; + pCur->pArg = pArg; +} + /* ** Close a cursor. The read lock on the database file is released ** when the last cursor is closed. diff --git a/src/btree.h b/src/btree.h index d36f3aa52..78fc61c59 100644 --- a/src/btree.h +++ b/src/btree.h @@ -13,7 +13,7 @@ ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. ** -** @(#) $Id: btree.h,v 1.47 2004/05/12 19:18:17 drh Exp $ +** @(#) $Id: btree.h,v 1.48 2004/05/18 10:06:25 danielk1977 Exp $ */ #ifndef _BTREE_H_ #define _BTREE_H_ @@ -73,6 +73,12 @@ int sqlite3BtreeCursor( BtCursor **ppCursor /* Returned cursor */ ); +void sqlite3BtreeSetCompare( + BtCursor *, + int(*)(void*,int,const void*,int,const void*), + void* +); + int sqlite3BtreeCloseCursor(BtCursor*); int sqlite3BtreeMoveto(BtCursor*, const void *pKey, i64 nKey, int *pRes); int sqlite3BtreeDelete(BtCursor*); diff --git a/src/expr.c b/src/expr.c index be2c26573..a0fff71d8 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.121 2004/05/17 10:48:58 danielk1977 Exp $ +** $Id: expr.c,v 1.122 2004/05/18 10:06:25 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -45,18 +45,18 @@ char const *sqlite3AffinityString(char affinity){ ** SELECT a AS b FROM t1 WHERE b; ** SELECT * FROM t1 WHERE (select a from t1); */ -static char exprAffinity(Expr *pExpr){ +char sqlite3ExprAffinity(Expr *pExpr){ if( pExpr->op==TK_AS ){ - return exprAffinity(pExpr->pLeft); + return sqlite3ExprAffinity(pExpr->pLeft); } if( pExpr->op==TK_SELECT ){ - return exprAffinity(pExpr->pSelect->pEList->a[0].pExpr); + return sqlite3ExprAffinity(pExpr->pSelect->pEList->a[0].pExpr); } return pExpr->affinity; } char sqlite3CompareAffinity(Expr *pExpr, char aff2){ - char aff1 = exprAffinity(pExpr); + char aff1 = sqlite3ExprAffinity(pExpr); if( aff1 && aff2 ){ /* Both sides of the comparison are columns. If one has numeric or ** integer affinity, use that. Otherwise use no affinity. @@ -85,7 +85,7 @@ static char comparisonAffinity(Expr *pExpr){ pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE || pExpr->op==TK_NE ); assert( pExpr->pLeft ); - aff = exprAffinity(pExpr->pLeft); + aff = sqlite3ExprAffinity(pExpr->pLeft); if( pExpr->pRight ){ aff = sqlite3CompareAffinity(pExpr->pRight, aff); } @@ -121,7 +121,7 @@ int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){ ** evaluates to NULL. */ static int binaryCompareP1(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){ - char aff = exprAffinity(pExpr2); + char aff = sqlite3ExprAffinity(pExpr2); return (((int)sqlite3CompareAffinity(pExpr1, aff))<<8)+(jumpIfNull?1:0); } @@ -802,7 +802,7 @@ int sqlite3ExprResolveIds( if( sqlite3ExprResolveIds(pParse, pSrcList, pEList, pExpr->pLeft) ){ return 1; } - affinity = exprAffinity(pExpr->pLeft); + affinity = sqlite3ExprAffinity(pExpr->pLeft); /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)' ** expression it is handled the same way. A temporary table is @@ -828,7 +828,7 @@ int sqlite3ExprResolveIds( */ int iParm = pExpr->iTable + (((int)affinity)<<16); assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); - sqlite3Select(pParse, pExpr->pSelect, SRT_Set, iParm, 0, 0, 0); + sqlite3Select(pParse, pExpr->pSelect, SRT_Set, iParm, 0, 0, 0, 0); }else if( pExpr->pList ){ /* Case 2: expr IN (exprlist) ** @@ -874,7 +874,7 @@ int sqlite3ExprResolveIds( ** of the memory cell in iColumn. */ pExpr->iColumn = pParse->nMem++; - if( sqlite3Select(pParse, pExpr->pSelect, SRT_Mem, pExpr->iColumn,0,0,0) ){ + if(sqlite3Select(pParse, pExpr->pSelect, SRT_Mem,pExpr->iColumn,0,0,0,0)){ return 1; } break; diff --git a/src/parse.y b/src/parse.y index 9202a45a3..952175ad5 100644 --- a/src/parse.y +++ b/src/parse.y @@ -14,7 +14,7 @@ ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** -** @(#) $Id: parse.y,v 1.113 2004/05/08 08:23:30 danielk1977 Exp $ +** @(#) $Id: parse.y,v 1.114 2004/05/18 10:06:25 danielk1977 Exp $ */ %token_prefix TK_ %token_type {Token} @@ -278,7 +278,7 @@ cmd ::= DROP VIEW nm(X). { //////////////////////// The SELECT statement ///////////////////////////////// // cmd ::= select(X). { - sqlite3Select(pParse, X, SRT_Callback, 0, 0, 0, 0); + sqlite3Select(pParse, X, SRT_Callback, 0, 0, 0, 0, 0); sqlite3SelectDelete(X); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 29aac804d..7f1bb0090 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.235 2004/05/17 10:48:58 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.236 2004/05/18 10:06:26 danielk1977 Exp $ */ #include "config.h" #include "sqlite.h" @@ -1191,7 +1191,7 @@ void sqlite3CreateIndex(Parse*,Token*,SrcList*,IdList*,int,Token*,Token*); void sqlite3DropIndex(Parse*, SrcList*); void sqlite3AddKeyType(Vdbe*, ExprList*); void sqlite3AddIdxKeyType(Vdbe*, Index*); -int sqlite3Select(Parse*, Select*, int, int, Select*, int, int*); +int sqlite3Select(Parse*, Select*, int, int, Select*, int, int*, char *aff); Select *sqlite3SelectNew(ExprList*,SrcList*,Expr*,ExprList*,Expr*,ExprList*, int,int,int); void sqlite3SelectDelete(Select*); @@ -1309,3 +1309,4 @@ void sqlite3TableAffinityStr(Vdbe *, Table *); char sqlite3CompareAffinity(Expr *pExpr, char aff2); char const *sqlite3AffinityString(char affinity); int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); +char sqlite3ExprAffinity(Expr *pExpr); diff --git a/src/trigger.c b/src/trigger.c index 985b0b43c..758513e4c 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -189,7 +189,7 @@ void sqlite3FinishTrigger( { OP_String, 0, 0, 0 }, /* 3: table name */ { OP_Integer, 0, 0, 0 }, { OP_String, 0, 0, 0 }, /* 5: SQL */ - { OP_MakeRecord, 5, 0, 0 }, + { OP_MakeRecord, 5, 0, "tttit" }, { OP_PutIntKey, 0, 0, 0 }, }; int addr; @@ -615,7 +615,7 @@ static int codeTriggerProgram( Select * ss = sqlite3SelectDup(pTriggerStep->pSelect); assert(ss); assert(ss->pSrc); - sqlite3Select(pParse, ss, SRT_Discard, 0, 0, 0, 0); + sqlite3Select(pParse, ss, SRT_Discard, 0, 0, 0, 0, 0); sqlite3SelectDelete(ss); break; } diff --git a/src/vdbe.h b/src/vdbe.h index 7928dbe67..393edcece 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -15,7 +15,7 @@ ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** -** $Id: vdbe.h,v 1.75 2004/05/13 05:16:17 danielk1977 Exp $ +** $Id: vdbe.h,v 1.76 2004/05/18 10:06:26 danielk1977 Exp $ */ #ifndef _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_ @@ -94,7 +94,7 @@ void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1); void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2); void sqlite3VdbeChangeP3(Vdbe*, int addr, const char *zP1, int N); void sqlite3VdbeDequoteP3(Vdbe*, int addr); -int sqlite3VdbeFindOp(Vdbe*, int, int); +int sqlite3VdbeFindOp(Vdbe*, int, int, int); VdbeOp *sqlite3VdbeGetOp(Vdbe*, int); int sqlite3VdbeMakeLabel(Vdbe*); void sqlite3VdbeDelete(Vdbe*); @@ -108,6 +108,5 @@ void sqlite3VdbeTrace(Vdbe*,FILE*); void sqlite3VdbeCompressSpace(Vdbe*,int); int sqlite3VdbeReset(Vdbe*,char **); int sqliteVdbeSetVariables(Vdbe*,int,const char**); -int sqlite3VdbeKeyCompare(void*,int,const void*,int, const void*); #endif diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 71765a5df..bea4d07ed 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -334,3 +334,5 @@ int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); int sqlite3VdbeIdxKeyCompare(Cursor*, int , const unsigned char*, int, int*); int sqlite3VdbeIdxRowid(BtCursor *, i64 *); int sqlite3MemCompare(Mem *, Mem *); +int sqlite3VdbeKeyCompare(void*,int,const void*,int, const void*); +int sqlite3VdbeRowCompare(void*,int,const void*,int, const void*); |