diff --git a/module/database/src/main/kotlin/taboolib/module/database/ActionInsert.kt b/module/database/src/main/kotlin/taboolib/module/database/ActionInsert.kt index de9d313b1..2ee77ab68 100644 --- a/module/database/src/main/kotlin/taboolib/module/database/ActionInsert.kt +++ b/module/database/src/main/kotlin/taboolib/module/database/ActionInsert.kt @@ -15,7 +15,7 @@ class ActionInsert(val table: String, val keys: Array) : Action { private var finallyCallback: (PreparedStatement.(Connection) -> Unit)? = null /** 插入值 */ - private var values = ArrayList>() + private var values = ArrayList>() /** 重复时更新 */ private var duplicateUpdate = ArrayList() @@ -37,26 +37,26 @@ class ActionInsert(val table: String, val keys: Array) : Action { }.build() /** 元素 */ - override val elements: List + override val elements: List get() { - val el = ArrayList() + val el = ArrayList() el.addAll(values.flatMap { it.toList() }) el.addAll(duplicateUpdate.mapNotNull { it.value }) return el } /** 插入值 */ - fun value(vararg args: Any) { + fun value(vararg args: Any?) { values.add(arrayOf(*args)) } /** 插入值 */ - fun values(args: Array) { + fun values(args: Array) { values.add(args) } /** 插入值 */ - fun values(args: List) { + fun values(args: List) { values.add(args.toTypedArray()) } diff --git a/module/database/src/main/kotlin/taboolib/module/database/Attributes.kt b/module/database/src/main/kotlin/taboolib/module/database/Attributes.kt index f5b22d058..ef44712eb 100644 --- a/module/database/src/main/kotlin/taboolib/module/database/Attributes.kt +++ b/module/database/src/main/kotlin/taboolib/module/database/Attributes.kt @@ -12,6 +12,6 @@ interface Attributes { val query: String /** 占位符对应的元素 */ - val elements: List + val elements: List get() = emptyList() } \ No newline at end of file diff --git a/module/database/src/main/kotlin/taboolib/module/database/Statement.kt b/module/database/src/main/kotlin/taboolib/module/database/Statement.kt index ffb289c57..1eef0f403 100644 --- a/module/database/src/main/kotlin/taboolib/module/database/Statement.kt +++ b/module/database/src/main/kotlin/taboolib/module/database/Statement.kt @@ -71,7 +71,7 @@ class Statement { } /** 追加值 */ - fun addValues(values: List>): Statement { + fun addValues(values: List>): Statement { query += values.joinToString { "(${it.joinToString { "?" }})" } return this }