File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
ktorm-support-sqlite/src/main/kotlin/org/ktorm/support/sqlite Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,34 @@ public open class SQLiteFormatter(
7979 _parameters + = ArgumentExpression (expr.limit ? : Int .MAX_VALUE , IntSqlType )
8080 }
8181
82+ override fun visitUnion (expr : UnionExpression ): UnionExpression {
83+ when (expr.left) {
84+ is SelectExpression -> visitQuery(expr.left)
85+ is UnionExpression -> visitUnion(expr.left as UnionExpression )
86+ }
87+
88+ if (expr.isUnionAll) {
89+ writeKeyword(" union all " )
90+ } else {
91+ writeKeyword(" union " )
92+ }
93+
94+ when (expr.right) {
95+ is SelectExpression -> visitQuery(expr.right)
96+ is UnionExpression -> visitUnion(expr.right as UnionExpression )
97+ }
98+
99+ if (expr.orderBy.isNotEmpty()) {
100+ newLine(Indentation .SAME )
101+ writeKeyword(" order by " )
102+ visitOrderByList(expr.orderBy)
103+ }
104+ if (expr.offset != null || expr.limit != null ) {
105+ writePagination(expr)
106+ }
107+ return expr
108+ }
109+
82110 protected open fun visitInsertOrUpdate (expr : InsertOrUpdateExpression ): InsertOrUpdateExpression {
83111 writeKeyword(" insert into " )
84112 visitTable(expr.table)
You can’t perform that action at this time.
0 commit comments