Skip to content

Commit a45a092

Browse files
revert unnecessary changes
1 parent 64dee20 commit a45a092

File tree

2 files changed

+7
-35
lines changed

2 files changed

+7
-35
lines changed

ktorm-support-sqlite/src/main/kotlin/org/ktorm/support/sqlite/Functions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public fun ColumnDeclaring<String>.instr(right: ColumnDeclaring<String>): Functi
192192
* SQLite instr function, translated to `instr(left, right)`.
193193
*/
194194
public fun ColumnDeclaring<String>.instr(right: String): FunctionExpression<Int> {
195-
return instr(wrapArgument(right))
195+
return this.instr(wrapArgument(right))
196196
}
197197

198198
/**

ktorm-support-sqlite/src/main/kotlin/org/ktorm/support/sqlite/SQLiteDialect.kt

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)