diff options
author | danielk1977 <danielk1977@noemail.net> | 2002-05-15 08:30:12 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2002-05-15 08:30:12 +0000 |
commit | c3f9bad209545130059a39f8e68e4f09da3722aa (patch) | |
tree | 1435a6ee9ef16c8cf3c7773f4279fe24a0f14351 /src/expr.c | |
parent | 9456bcc9754fbd640add617b4ec241a5bb1e7e69 (diff) | |
download | sqlite-c3f9bad209545130059a39f8e68e4f09da3722aa.tar.gz sqlite-c3f9bad209545130059a39f8e68e4f09da3722aa.zip |
Added FOR EACH ROW triggers functionality (CVS 562)
FossilOrigin-Name: 794bf67b6b36fce8854d5daff12f21dbb943240c
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c index 9184758b6..b41e0ad8c 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.58 2002/04/20 14:24:42 drh Exp $ +** $Id: expr.c,v 1.59 2002/05/15 08:30:13 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -481,6 +481,33 @@ int sqliteExprResolveIds( } } } + + /* If we have not already resolved this *.* expression, then maybe + * it is a new.* or old.* trigger argument reference */ + if (cnt == 0 && pParse->trigStack != 0) { + TriggerStack * tt = pParse->trigStack; + int j; + int t = 0; + if (tt->newIdx != -1 && sqliteStrICmp("new", zLeft) == 0) { + pExpr->iTable = tt->newIdx; + cntTab++; + t = 1; + } + if (tt->oldIdx != -1 && sqliteStrICmp("old", zLeft) == 0) { + pExpr->iTable = tt->oldIdx; + cntTab++; + t = 1; + } + + if (t) + for(j=0; j<tt->pTab->nCol; j++) { + if( sqliteStrICmp(tt->pTab->aCol[j].zName, zRight)==0 ){ + cnt++; + pExpr->iColumn = j; + } + } + } + if( cnt==0 && cntTab==1 && sqliteIsRowid(zRight) ){ cnt = 1; pExpr->iColumn = -1; |