
org.jetbrains.exposed.sql.statements.UpdateStatement.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of exposed Show documentation
Show all versions of exposed Show documentation
Exposed, an ORM framework for Kotlin
package org.jetbrains.exposed.sql.statements
import org.jetbrains.exposed.sql.*
import java.sql.PreparedStatement
open class UpdateStatement(val targetsSet: ColumnSet, val limit: Int?, val where: Op? = null): UpdateBuilder(StatementType.UPDATE, targetsSet.targetTables()) {
open val firstDataSet: List, Any?>> get() = values.toList()
override fun PreparedStatement.executeInternal(transaction: Transaction): Int {
if (values.isEmpty()) return 0
transaction.flushCache()
return executeUpdate().apply {
transaction.entityCache.removeTablesReferrers(targetsSet.targetTables())
}
}
override fun prepareSQL(transaction: Transaction): String =
transaction.db.dialect.functionProvider.update(targetsSet, firstDataSet, limit, where, transaction)
override fun arguments(): Iterable>> = QueryBuilder(true).run {
values.forEach {
registerArgument(it.key, it.value)
}
where?.toQueryBuilder(this)
if (args.isNotEmpty()) listOf(args) else emptyList()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy