1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

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
This commit is contained in:
drh
2020-05-13 18:03:34 +00:00
parent ffe421c76a
commit 3c0e606bba
6 changed files with 43 additions and 34 deletions

View File

@@ -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