diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Function.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Function.kt index 20ca398d92..d013a7942f 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Function.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Function.kt @@ -73,8 +73,9 @@ class Random( class CharLength( val expr: Expression ) : Function(IntegerColumnType()) { - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = + override fun toQueryBuilder(queryBuilder: QueryBuilder) { currentDialect.functionProvider.charLength(expr, queryBuilder) + } } /** @@ -106,8 +107,9 @@ class Concat( /** Returns the expressions being concatenated. */ vararg val expr: Expression<*> ) : Function(TextColumnType()) { - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = + override fun toQueryBuilder(queryBuilder: QueryBuilder) { currentDialect.functionProvider.concat(separator, queryBuilder, expr = expr) + } } /** @@ -123,8 +125,9 @@ class GroupConcat( /** Returns the order in which the elements of each group are sorted. */ vararg val orderBy: Pair, SortOrder> ) : Function(TextColumnType()) { - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = + override fun toQueryBuilder(queryBuilder: QueryBuilder) { currentDialect.functionProvider.groupConcat(this, queryBuilder) + } } /** @@ -136,8 +139,9 @@ class Substring( /** Returns the length of the substring. */ val length: Expression ) : Function(TextColumnType()) { - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = + override fun toQueryBuilder(queryBuilder: QueryBuilder) { currentDialect.functionProvider.substring(expr, start, length, queryBuilder) + } } /** @@ -350,8 +354,9 @@ sealed class NextVal( columnType: IColumnType ) : Function(columnType) { - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = + override fun toQueryBuilder(queryBuilder: QueryBuilder) { currentDialect.functionProvider.nextVal(seq, queryBuilder) + } class IntNextVal(seq: Sequence) : NextVal(seq, IntegerColumnType()) class LongNextVal(seq: Sequence) : NextVal(seq, LongColumnType()) @@ -386,18 +391,20 @@ class CaseWhenElse( ?: caseWhen.cases.map { it.second }.filterIsInstance>().firstOrNull()?.columnType ?: BooleanColumnType.INSTANCE - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = queryBuilder { - append("CASE ") - if (caseWhen.value != null) { - +caseWhen.value - +" " - } + override fun toQueryBuilder(queryBuilder: QueryBuilder) { + queryBuilder { + append("CASE ") + if (caseWhen.value != null) { + +caseWhen.value + +" " + } - for ((first, second) in caseWhen.cases) { - append("WHEN ", first, " THEN ", second) - } + for ((first, second) in caseWhen.cases) { + append("WHEN ", first, " THEN ", second) + } - append(" ELSE ", elseResult, " END") + append(" ELSE ", elseResult, " END") + } } } @@ -428,6 +435,7 @@ class Cast( val expr: Expression<*>, columnType: IColumnType ) : Function(columnType) { - override fun toQueryBuilder(queryBuilder: QueryBuilder): Unit = + override fun toQueryBuilder(queryBuilder: QueryBuilder) { currentDialect.functionProvider.cast(expr, columnType, queryBuilder) + } }