SqlFormatter

abstract class SqlFormatter(val database: Database, val beautifySql: Boolean, val indentSize: Int) : SqlExpressionVisitor(source)

Implementation of SqlExpressionVisitor, visiting SQL expression trees using visitor pattern. After a visit completes, the executable SQL string will be generated in the sql property with its execution parameters in parameters.

Constructors

Link copied to clipboard
constructor(database: Database, beautifySql: Boolean, indentSize: Int)

Properties

Link copied to clipboard

mark if we should output beautiful SQL strings with line-wrapping and indentation.

Link copied to clipboard

the current database object used to obtain metadata such as identifier quote string.

Link copied to clipboard

the indent size.

Link copied to clipboard

return the SQL execution parameters after the visit completes.

Link copied to clipboard
val sql: String

return the executable SQL string after the visit completes.

Functions

Link copied to clipboard
open override fun visit(expr: SqlExpression): SqlExpression

Dispatch different type of expression nodes to their specific visit* functions. Custom expression types that are unknown to Ktorm will be dispatched to visitUnknown.

Link copied to clipboard

Function that visits an AggregateExpression.

Link copied to clipboard
open override fun <T : Any> visitArgument(expr: ArgumentExpression<T>): ArgumentExpression<T>

Function that visits an ArgumentExpression.

Link copied to clipboard

Function that visits a BetweenExpression.

Link copied to clipboard
open override fun <T : Any> visitBinary(expr: BinaryExpression<T>): BinaryExpression<T>

Function that visits a BinaryExpression.

Link copied to clipboard
open override fun <T : Any> visitCaseWhen(expr: CaseWhenExpression<T>): CaseWhenExpression<T>

Function that visits a CaseWhenExpression.

Link copied to clipboard
open override fun <T : Any> visitCasting(expr: CastingExpression<T>): CastingExpression<T>

Function that visits a CastingExpression.

Link copied to clipboard
open override fun <T : Any> visitColumn(expr: ColumnExpression<T>): ColumnExpression<T>

Function that visits a ColumnExpression.

Link copied to clipboard
Link copied to clipboard

Function that visits a DeleteExpression.

Link copied to clipboard

Function that visits an ExistsExpression.

Link copied to clipboard
open override fun <T : SqlExpression> visitExpressionList(original: List<T>, subVisitor: (T) -> T): List<T>

Helper function for visiting a list of expressions.

Link copied to clipboard
open override fun <T : Any> visitFunction(expr: FunctionExpression<T>): FunctionExpression<T>

Function that visits a FunctionExpression.

Link copied to clipboard

Function that visits an InListExpression.

Link copied to clipboard

Function that visits an InsertExpression.

Link copied to clipboard
Link copied to clipboard
open override fun visitJoin(expr: JoinExpression): JoinExpression

Function that visits a JoinExpression.

Link copied to clipboard

Function that visits an OrderByExpression.

Link copied to clipboard

Function that visits a QueryExpression.

Link copied to clipboard
Link copied to clipboard

Function that visits a general ScalarExpression, this function dispatches different type of scalar expressions to their specific visit* functions. Custom expression types that are unknown to Ktorm will be dispatched to visitUnknown

Link copied to clipboard

Function that visits a SelectExpression.

Link copied to clipboard
open override fun visitTable(expr: TableExpression): TableExpression

Function that visits a TableExpression.

Link copied to clipboard
open override fun <T : Any> visitUnary(expr: UnaryExpression<T>): UnaryExpression<T>

Function that visits an UnaryExpression.

Link copied to clipboard
open override fun visitUnion(expr: UnionExpression): UnionExpression

Function that visits an UnionExpression.

Link copied to clipboard
open override fun visitUnknown(expr: SqlExpression): SqlExpression

Function that visits an unknown expression.

Link copied to clipboard

Function that visits an UpdateExpression.

Link copied to clipboard

Helper function for visiting when clauses of CaseWhenExpression.

Link copied to clipboard
Link copied to clipboard