diff options
author | drh <drh@noemail.net> | 2002-05-30 02:35:11 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2002-05-30 02:35:11 +0000 |
commit | 461c281a2e6bcc91d7893c8069a2dea0d6273ab5 (patch) | |
tree | 2ef836b1314131a85b9f6c1263bd1dafc961c2d6 /src/expr.c | |
parent | 739105c72c3cead94bf07e55646573cc0cde0c6a (diff) | |
download | sqlite-461c281a2e6bcc91d7893c8069a2dea0d6273ab5.tar.gz sqlite-461c281a2e6bcc91d7893c8069a2dea0d6273ab5.zip |
Bug fix: bad code was generated for when the first operand of a CASE
was NULL. (CVS 598)
FossilOrigin-Name: 4debc8db929fdc201759ba211acdeadc4e30e8af
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index 89508d26c..25f0ebd0b 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.64 2002/05/26 20:54:33 drh Exp $ +** $Id: expr.c,v 1.65 2002/05/30 02:35:12 drh Exp $ */ #include "sqliteInt.h" @@ -935,6 +935,7 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){ int expr_end_label; int null_result_label; int jumpInst; + int nullBypassInst; int addr; int nExpr; int i; @@ -947,7 +948,7 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){ null_result_label = sqliteVdbeMakeLabel(v); if( pExpr->pLeft ){ sqliteExprCode(pParse, pExpr->pLeft); - sqliteVdbeAddOp(v, OP_IsNull, -1, expr_end_label); + nullBypassInst = sqliteVdbeAddOp(v, OP_IsNull, -1, 0); } for(i=0; i<nExpr; i=i+2){ sqliteExprCode(pParse, pExpr->pList->a[i].pExpr); @@ -980,6 +981,7 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){ if( pExpr->pLeft ){ sqliteVdbeAddOp(v, OP_Pull, 1, 0); sqliteVdbeAddOp(v, OP_Pop, 1, 0); + sqliteVdbeChangeP2(v, nullBypassInst, sqliteVdbeCurrentAddr(v)); } } break; @@ -1164,8 +1166,7 @@ void sqliteExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ } default: { sqliteExprCode(pParse, pExpr); - sqliteVdbeAddOp(v, OP_Not, 0, 0); - sqliteVdbeAddOp(v, OP_If, jumpIfNull, dest); + sqliteVdbeAddOp(v, OP_IfNot, jumpIfNull, dest); break; } } |