Adds common support for the SQL 92 case expression. Expressions of both common formats are supported.
Supported SQL
CASE With Primary Operand / Condition
SQL:
CASE (yesOrNo)
WHEN ('yes') THEN 1
ELSE 0
END
CASE Without Primary Operand / Condition
CASE
WHEN (yesOrNo = 'yes') THEN 1
WHEN (yesOrNo = 'no') THEN 0
ELSE -1
END
Kotlin Example
Taken from unit tests.
/*
* Note the use of the word "Clause" to avoid reserved words.
*/
select(
case<String>(literal(5)) {
whenClause(literal(6)).thenClause(literal("false"))
whenClause(literal(5)).thenClause(literal("true"))
whenClause(literal(4)).thenClause(literal("false"))
elseClause(literal("false"))
}
)
Testing
A basic test case was added for this functionality, but could be improved to include more varying conditions, though this may not be necessary because it is ultimately using Expression<*>s for most functionality related to the conditions and values.
Edited to include a kotlin example from unit tests
Description
Adds common support for the SQL 92 case expression. Expressions of both common formats are supported.
Supported SQL
CASE With Primary Operand / Condition
SQL:
CASE Without Primary Operand / Condition
Kotlin Example
Taken from unit tests.
Testing
A basic test case was added for this functionality, but could be improved to include more varying conditions, though this may not be necessary because it is ultimately using
Expression<*>
s for most functionality related to the conditions and values.