diff options
author | drh <drh@noemail.net> | 2020-05-13 18:03:34 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-05-13 18:03:34 +0000 |
commit | 3c0e606bba4d489285f54bbed395a16e0fddf5d4 (patch) | |
tree | a225e23a07f07dee7261ecb23e7130d84e11c0a5 /src/expr.c | |
parent | ffe421c76ad11c29287cbabe3548a7d95569ac37 (diff) | |
download | sqlite-3c0e606bba4d489285f54bbed395a16e0fddf5d4.tar.gz sqlite-3c0e606bba4d489285f54bbed395a16e0fddf5d4.zip |
Implement the IIF(x,y,z) SQL function that is short-hand for
"CASE WHEN x THEN y ELSE z END". For compatibility with SQL Server.
FossilOrigin-Name: fce173cd211b15867369b6a54fad48168352fc83981a722ce98e57299b88608a
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c index 528377c5d..7205f8628 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3700,6 +3700,13 @@ static int exprCodeInlineFunction( sqlite3VdbeResolveLabel(v, endCoalesce); break; } + case INLINEFUNC_iif: { + Expr caseExpr; + memset(&caseExpr, 0, sizeof(caseExpr)); + caseExpr.op = TK_CASE; + caseExpr.x.pList = pFarg; + return sqlite3ExprCodeTarget(pParse, &caseExpr, target); + } default: { /* The UNLIKELY() function is a no-op. The result is the value |