diff --git a/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt b/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt index f141b139b6..3702b0ddbc 100644 --- a/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt +++ b/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt @@ -126,13 +126,13 @@ fun T.insertIgnore(selectQuery: Query, columns: List> = this /** * @sample org.jetbrains.exposed.sql.tests.shared.DMLTests.testUpdate01 */ -fun T.update(where: SqlExpressionBuilder.()->Op, limit: Int? = null, body: T.(UpdateStatement)->Unit): Int { - val query = UpdateStatement(this, limit, SqlExpressionBuilder.where()) +fun T.update(where: (SqlExpressionBuilder.()->Op)? = null, limit: Int? = null, body: T.(UpdateStatement)->Unit): Int { + val query = UpdateStatement(this, limit, where?.let { SqlExpressionBuilder.it() }) body(query) return query.execute(TransactionManager.current())!! } -fun Join.update(where: (SqlExpressionBuilder.()->Op)? = null, limit: Int? = null, body: (UpdateStatement)->Unit) : Int { +fun Join.update(where: (SqlExpressionBuilder.()->Op)? = null, limit: Int? = null, body: (UpdateStatement)->Unit) : Int { val query = UpdateStatement(this, limit, where?.let { SqlExpressionBuilder.it() }) body(query) return query.execute(TransactionManager.current())!!