From 5338a5f74de5b7c7309589f59247329a9ebd9ee9 Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Thu, 20 Jan 2005 13:03:10 +0000 Subject: [PATCH] Remove a few more lines of code when SQLITE_OMIT_** macros are defined. (CVS 2244) FossilOrigin-Name: 417bbba93ad7ed5c03d9db6afc12e170155bd152 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/expr.c | 11 +++++------ src/select.c | 48 +++++++++++++++++++++++++++--------------------- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/manifest b/manifest index e236571201..a52e6f6c62 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Extend\sthe\sinfluence\sof\sa\scouple\sof\sSQLITE_OMIT_**\smacros\sa\slittle\sbit.\s(CVS\s2243) -D 2005-01-20T11:32:23 +C Remove\sa\sfew\smore\slines\sof\scode\swhen\sSQLITE_OMIT_**\smacros\sare\sdefined.\s(CVS\s2244) +D 2005-01-20T13:03:10 F Makefile.in ffd81f5e926d40b457071b4de8d7c1fa18f39b5a F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -36,7 +36,7 @@ F src/cursor.c de73c00aefc4747ad59b5105cf38bbff0667922e F src/date.c f3d1f5cd1503dabf426a198f3ebef5afbc122a7f F src/delete.c b3accca9c38d9a67dbd724f67b04151a13735ebd F src/experimental.c 8cc66b2be6a011055d75ef19ed2584bcfbb585ad -F src/expr.c 8f8efe75a57d75c6c27fa580c1495214698edab8 +F src/expr.c 09022cbd4fbdff66fbab0f04d010d413cb06b493 F src/func.c dc188d862d7276ea897655b248e2cb17022686e3 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 @@ -58,7 +58,7 @@ F src/parse.y 276efb30de5d8582bda9b6a98b17aac6875ab3e9 F src/pragma.c 8ab313986673aa4c45e8693d8aabb9b95ee7b14a F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 -F src/select.c e147c81d57f7146d90a4d5a01f523dfec43808f4 +F src/select.c 1686f2503c9c7f9de4d564944584015b71c50ac3 F src/shell.c 591364a0e9ca4ce53873e21e0294476c0c2b4770 F src/sqlite.h.in 8249b697d71ef6d7f7f752ba4ca04058e9e8b5ff F src/sqliteInt.h c1acfbeb8b84444e5b86dfce19ff42b5854f6478 @@ -270,7 +270,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746 -P f0add0a60e0afb833202e42cdba97bafe6a59dfc -R b7d0586837ede46bbec162c278e488af +P 5b1a9bf6aa5a5c466b88f649e322e81b8466851f +R db2528b7bd532f73e60abad289bd81fd U danielk1977 -Z 9a530a08d49f6e6af93c82c07243e25f +Z b2590dd052208a3aa6c3782df4f94dd4 diff --git a/manifest.uuid b/manifest.uuid index 3eb3574c9f..d1c6a0719b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5b1a9bf6aa5a5c466b88f649e322e81b8466851f \ No newline at end of file +417bbba93ad7ed5c03d9db6afc12e170155bd152 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 5ef4ffce43..8d9d9f47ea 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.183 2005/01/20 01:51:26 drh Exp $ +** $Id: expr.c,v 1.184 2005/01/20 13:03:10 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -953,11 +953,6 @@ static void getFunctionName(Expr *pExpr, const char **pzName, int *pnName){ *pnName = 17; break; } - default: { - *pzName = "can't happen"; - *pnName = 12; - break; - } } } @@ -1379,12 +1374,14 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){ sqlite3VdbeDequoteP3(v, -1); break; } +#ifndef SQLITE_OMIT_BLOB_LITERAL case TK_BLOB: { assert( TK_BLOB==OP_HexBlob ); sqlite3VdbeOp3(v, op, 0, 0, pExpr->token.z+1, pExpr->token.n-1); sqlite3VdbeDequoteP3(v, -1); break; } +#endif case TK_NULL: { sqlite3VdbeAddOp(v, OP_String8, 0, 0); break; @@ -1622,6 +1619,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){ sqlite3VdbeResolveLabel(v, expr_end_label); break; } +#ifndef SQLITE_OMIT_TRIGGER case TK_RAISE: { if( !pParse->trigStack ){ sqlite3ErrorMsg(pParse, @@ -1642,6 +1640,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){ VdbeComment((v, "# raise(IGNORE)")); } } +#endif break; } } diff --git a/src/select.c b/src/select.c index 948adc7bd0..f26ebe1a07 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.229 2005/01/19 23:24:50 drh Exp $ +** $Id: select.c,v 1.230 2005/01/20 13:03:10 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -434,6 +434,7 @@ static int selectInnerLoop( } switch( eDest ){ +#ifndef SQLITE_OMIT_COMPOUND_SELECT /* In this mode, write each query result to the key of the temporary ** table iParm. */ @@ -445,6 +446,20 @@ static int selectInnerLoop( break; } + /* Construct a record from the query result, but instead of + ** saving that record, use it as a key to delete elements from + ** the temporary table iParm. + */ + case SRT_Except: { + int addr; + addr = sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, NULL_ALWAYS_DISTINCT); + sqlite3VdbeChangeP3(v, -1, aff, P3_STATIC); + sqlite3VdbeAddOp(v, OP_NotFound, iParm, addr+3); + sqlite3VdbeAddOp(v, OP_Delete, iParm, 0); + break; + } +#endif + /* Store the result as data using a unique key. */ case SRT_Table: @@ -460,19 +475,6 @@ static int selectInnerLoop( break; } - /* Construct a record from the query result, but instead of - ** saving that record, use it as a key to delete elements from - ** the temporary table iParm. - */ - case SRT_Except: { - int addr; - addr = sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, NULL_ALWAYS_DISTINCT); - sqlite3VdbeChangeP3(v, -1, aff, P3_STATIC); - sqlite3VdbeAddOp(v, OP_NotFound, iParm, addr+3); - sqlite3VdbeAddOp(v, OP_Delete, iParm, 0); - break; - } - /* If we are creating a set for an "expr IN (SELECT ...)" construct, ** then there should be a single item on the stack. Write this ** item into the set table with bogus data. @@ -665,6 +667,13 @@ static const char *columnType(Parse *pParse, SrcList *pTabList, Expr *pExpr){ if( pExpr==0 || pTabList==0 ) return 0; sqlite3ExprResolveNames(pParse, pTabList, 0, 0, pExpr, 1, 0); + + /* The TK_AS operator can only occur in ORDER BY, GROUP BY, HAVING, + ** and LIMIT clauses. But pExpr originates in the result set of a + ** SELECT. So pExpr can never contain an AS operator. + */ + assert( pExpr->op!=TK_AS ); + switch( pExpr->op ){ case TK_COLUMN: { Table *pTab; @@ -686,13 +695,6 @@ static const char *columnType(Parse *pParse, SrcList *pTabList, Expr *pExpr){ zType = columnType(pParse, pS->pSrc, pS->pEList->a[0].pExpr); break; } - case TK_AS: - /* The TK_AS operator can only occur in ORDER BY, GROUP BY, HAVING, - ** and LIMIT clauses. But pExpr originates in the result set of a - ** SELECT. So pExpr can never contain an AS operator. - */ - assert( 0 ); - /* Fall thru */ default: zType = 0; } @@ -737,10 +739,12 @@ static void generateColumnNames( sqlite3 *db = pParse->db; int fullNames, shortNames; +#ifdef SQLITE_OMIT_EXPLAIN /* If this is an EXPLAIN, skip this step */ if( pParse->explain ){ return; } +#endif assert( v!=0 ); if( pParse->colNamesSet || v==0 || sqlite3_malloc_failed ) return; @@ -1120,6 +1124,7 @@ static int prepSelectStmt(Parse *pParse, Select *p){ ** will be left pointing to a deallocated Table structure after the ** DROP and a coredump will occur the next time the VIEW is used. */ +#if 0 void sqlite3SelectUnbind(Select *p){ int i; SrcList *pSrc = p->pSrc; @@ -1138,6 +1143,7 @@ void sqlite3SelectUnbind(Select *p){ } } } +#endif /* ** This routine associates entries in an ORDER BY expression list with -- 2.47.3