mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-08 03:22:21 +03:00
Optimize trigger compilation to avoid populating the OLD.* and NEW.* pseudo-tables with data that will never be used. Some testing to come. (CVS 4651)
FossilOrigin-Name: e08a33ed7255c22ce2805363f44a1d7770acb2dd
This commit is contained in:
@@ -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.320 2007/12/14 15:12:21 drh Exp $
|
||||
** $Id: expr.c,v 1.321 2008/01/01 19:02:09 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -1107,14 +1107,17 @@ static int lookupName(
|
||||
if( zDb==0 && zTab!=0 && cnt==0 && pParse->trigStack!=0 ){
|
||||
TriggerStack *pTriggerStack = pParse->trigStack;
|
||||
Table *pTab = 0;
|
||||
u32 *piColMask;
|
||||
if( pTriggerStack->newIdx != -1 && sqlite3StrICmp("new", zTab) == 0 ){
|
||||
pExpr->iTable = pTriggerStack->newIdx;
|
||||
assert( pTriggerStack->pTab );
|
||||
pTab = pTriggerStack->pTab;
|
||||
piColMask = &(pTriggerStack->newColMask);
|
||||
}else if( pTriggerStack->oldIdx != -1 && sqlite3StrICmp("old", zTab)==0 ){
|
||||
pExpr->iTable = pTriggerStack->oldIdx;
|
||||
assert( pTriggerStack->pTab );
|
||||
pTab = pTriggerStack->pTab;
|
||||
piColMask = &(pTriggerStack->oldColMask);
|
||||
}
|
||||
|
||||
if( pTab ){
|
||||
@@ -1133,6 +1136,9 @@ static int lookupName(
|
||||
pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
|
||||
}
|
||||
pExpr->pTab = pTab;
|
||||
if( iCol>=0 ){
|
||||
*piColMask |= ((u32)1<<iCol) | (iCol>=32?0xffffffff:0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user