English | 简体中文

api-docs / org.ktorm.expression / SqlExpression

SqlExpression

abstract class SqlExpression (source code)

Root class of SQL expressions or statements.

SQL expressions are tree structures, and can be regarded as SQL’s abstract syntax trees (AST).

Subclasses must satisfy the following rules:

  • Must be data class, providing common abilities such as destruction, copy function, equals function, etc.
  • Must be immutable, any modify operation should return a new expression instance.

To visit or modify expression trees, use SqlExpressionVisitor.

To format expressions as executable SQL strings, use SqlFormatter.

See Also

SqlExpressionVisitor

SqlFormatter

Constructors

NameSummary

<init>

SqlExpression()

Root class of SQL expressions or statements.

Properties

NameSummary

extraProperties

abstract val extraProperties: Map<String, Any>

Extra properties of this expression, maybe useful in SqlFormatter to generate some special SQLs.

isLeafNode

abstract val isLeafNode: Boolean

Check if this expression is a leaf node in expression trees.

Extension Properties

NameSummary

removeBrackets

val SqlExpression.removeBrackets: Boolean

Inheritors

NameSummary

BulkInsertExpression

data class BulkInsertExpression : SqlExpression

Bulk insert expression, represents a bulk insert statement in MySQL.

BulkInsertExpression

data class BulkInsertExpression : SqlExpression

Bulk insert expression, represents a bulk insert statement in PostgreSQL.

ColumnAssignmentExpression

data class ColumnAssignmentExpression<T : Any> : 
    SqlExpression

Column assignment expression, represents a column assignment for insert or update statements.

DeleteExpression

data class DeleteExpression : SqlExpression

Delete expression, represents the delete statement in SQL.

InsertExpression

data class InsertExpression : SqlExpression

Insert expression, represents the insert statement in SQL.

InsertFromQueryExpression

data class InsertFromQueryExpression : SqlExpression

Insert-from-query expression, eg. insert into tmp(num) select 1 from dual.

InsertOrUpdateExpression

data class InsertOrUpdateExpression : SqlExpression

Insert or update expression, represents an insert statement with an
on duplicate key update clause in MySQL.

InsertOrUpdateExpression

data class InsertOrUpdateExpression : SqlExpression

Insert or update expression, represents an insert statement with an
on conflict (key) do update set clause in PostgreSQL.

OrderByExpression

data class OrderByExpression : SqlExpression

Order-by expression.

QuerySourceExpression

abstract class QuerySourceExpression : SqlExpression

Query source expression, used in the from clause of a SelectExpression.

ScalarExpression

abstract class ScalarExpression<T : Any> : 
    SqlExpression,
    ColumnDeclaring<T>

Base class of scalar expressions. An expression is “scalar” if it has a return value (eg. a + 1).

UpdateExpression

data class UpdateExpression : SqlExpression

Update expression, represents the update statement in SQL.