aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expr.c7
-rw-r--r--src/func.c1
-rw-r--r--src/sqliteInt.h1
3 files changed, 9 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
diff --git a/src/func.c b/src/func.c
index 6c1e1f756..f50fa1986 100644
--- a/src/func.c
+++ b/src/func.c
@@ -2021,6 +2021,7 @@ void sqlite3RegisterBuiltinFunctions(void){
FUNCTION(coalesce, 1, 0, 0, 0 ),
FUNCTION(coalesce, 0, 0, 0, 0 ),
INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
+ INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
};
#ifndef SQLITE_OMIT_ALTERTABLE
sqlite3AlterFunctions();
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index d80337fbf..05109571e 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1785,6 +1785,7 @@ struct FuncDestructor {
#define INLINEFUNC_expr_implies_expr 2
#define INLINEFUNC_expr_compare 3
#define INLINEFUNC_affinity 4
+#define INLINEFUNC_iif 5
#define INLINEFUNC_unlikely 99 /* Default case */
/*