@@ -79,34 +79,6 @@ 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-
11082 protected open fun visitInsertOrUpdate (expr : InsertOrUpdateExpression ): InsertOrUpdateExpression {
11183 writeKeyword(" insert into " )
11284 visitTable(expr.table)
@@ -118,16 +90,16 @@ public open class SQLiteFormatter(
11890 writeKeyword(" on conflict " )
11991 writeInsertColumnNames(expr.conflictColumns)
12092
121- if (expr.updateAssignments.isNotEmpty()) {
93+ if (expr.updateAssignments.isEmpty()) {
94+ writeKeyword(" do nothing " )
95+ } else {
12296 writeKeyword(" do update set " )
12397 visitColumnAssignments(expr.updateAssignments)
12498
12599 if (expr.where != null ) {
126100 writeKeyword(" where " )
127101 visit(expr.where)
128102 }
129- } else {
130- writeKeyword(" do nothing " )
131103 }
132104 }
133105
@@ -152,16 +124,16 @@ public open class SQLiteFormatter(
152124 writeKeyword(" on conflict " )
153125 writeInsertColumnNames(expr.conflictColumns)
154126
155- if (expr.updateAssignments.isNotEmpty()) {
127+ if (expr.updateAssignments.isEmpty()) {
128+ writeKeyword(" do nothing " )
129+ } else {
156130 writeKeyword(" do update set " )
157131 visitColumnAssignments(expr.updateAssignments)
158132
159133 if (expr.where != null ) {
160134 writeKeyword(" where " )
161135 visit(expr.where)
162136 }
163- } else {
164- writeKeyword(" do nothing " )
165137 }
166138 }
167139
0 commit comments