Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the EP_OptOnly flag on expressions for WHERE clause terms that are added by the optimizer but should not be coded. (CVS 2540) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f4a66ed04dfd8714746b766b4859682e |
User & Date: | drh 2005-07-08 14:14:23.000 |
Context
2005-07-08
| ||
17:13 | Change the name of the OpenTemp opcode to OpenVirtual which is more descriptive of what it does. (CVS 2541) (check-in: 3bb9ce5f20 user: drh tags: trunk) | |
14:14 | Add the EP_OptOnly flag on expressions for WHERE clause terms that are added by the optimizer but should not be coded. (CVS 2540) (check-in: f4a66ed04d user: drh tags: trunk) | |
13:53 | Add the SQLITE_CASE_SENSITIVE_LIKE compile-time option. (CVS 2539) (check-in: b72bff81f9 user: drh tags: trunk) | |
Changes
Changes to src/sqliteInt.h.
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. ** ************************************************************************* ** Internal interface definitions for 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. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.391 2005/07/08 14:14:23 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* ** These #defines should enable >2GB file support on Posix if the ** underlying operating system supports it. If the OS lacks |
︙ | ︙ | |||
834 835 836 837 838 839 840 | ** right side of "<expr> IN (<select>)" */ Table *pTab; /* Table for OP_Column expressions. */ }; /* ** The following are the meanings of bits in the Expr.flags field. */ | | | | | | | > | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | ** right side of "<expr> IN (<select>)" */ Table *pTab; /* Table for OP_Column expressions. */ }; /* ** The following are the meanings of bits in the Expr.flags field. */ #define EP_FromJoin 0x01 /* Originated in ON or USING clause of a join */ #define EP_Agg 0x02 /* Contains one or more aggregate functions */ #define EP_Resolved 0x04 /* IDs have been resolved to COLUMNs */ #define EP_Error 0x08 /* Expression contains one or more errors */ #define EP_Not 0x10 /* Operator preceeded by NOT */ #define EP_VarSelect 0x20 /* pSelect is correlated, not constant */ #define EP_OptOnly 0x40 /* A constraint used by the optimizer only */ /* ** These macros can be used to test, set, or clear bits in the ** Expr.flags field. */ #define ExprHasProperty(E,P) (((E)->flags&(P))==(P)) #define ExprHasAnyProperty(E,P) (((E)->flags&(P))!=0) |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is reponsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is reponsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** ** $Id: where.c,v 1.141 2005/07/08 14:14:23 drh Exp $ */ #include "sqliteInt.h" /* ** The query generator uses an array of instances of this structure to ** help it analyze the subexpressions of the WHERE clause. Each WHERE ** clause subexpression is separated from the others by an AND operator. |
︙ | ︙ | |||
1305 1306 1307 1308 1309 1310 1311 | } loopMask |= getMask(&maskSet, iCur); /* Insert code to test every subexpression that can be completely ** computed using the current set of tables. */ for(pTerm=aExpr, j=0; j<nExpr; j++, pTerm++){ | | > | | | > | | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | } loopMask |= getMask(&maskSet, iCur); /* Insert code to test every subexpression that can be completely ** computed using the current set of tables. */ for(pTerm=aExpr, j=0; j<nExpr; j++, pTerm++){ Expr *pE = pTerm->p; if( pE==0 || ExprHasProperty(pE, EP_OptOnly) ) continue; if( (pTerm->prereqAll & loopMask)!=pTerm->prereqAll ) continue; if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){ continue; } sqlite3ExprIfFalse(pParse, pE, cont, 1); pTerm->p = 0; } brk = cont; /* For a LEFT OUTER JOIN, generate code that will record the fact that ** at least one row of the right table has matched the left table. */ if( pLevel->iLeftJoin ){ pLevel->top = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp(v, OP_Integer, 1, 0); sqlite3VdbeAddOp(v, OP_MemStore, pLevel->iLeftJoin, 1); VdbeComment((v, "# record LEFT JOIN hit")); for(pTerm=aExpr, j=0; j<nExpr; j++, pTerm++){ Expr *pE = pTerm->p; if( pE==0 || ExprHasProperty(pE, EP_OptOnly) ) continue; if( (pTerm->prereqAll & loopMask)!=pTerm->prereqAll ) continue; sqlite3ExprIfFalse(pParse, pE, cont, 1); pTerm->p = 0; } } } pWInfo->iContinue = cont; freeMaskSet(&maskSet); return pWInfo; |
︙ | ︙ |