update

inline fun <T : Table> T.update(where: SqlExpressionBuilder.() -> Op<Boolean>, limit: Int? = null, crossinline body: T.(UpdateStatement) -> Unit): Int

Represents the SQL statement that updates rows of a table.

Return

The number of updated rows.

Parameters

where

Condition that determines which rows to update.

limit

Maximum number of rows to update.

Samples

org.jetbrains.exposed.sql.tests.shared.dml.UpdateTests.testUpdate01
inline fun <T : Table> T.update(limit: Int? = null, crossinline body: T.(UpdateStatement) -> Unit): Int

Represents the SQL statement that updates all rows of a table.

Return

The number of updated rows.

Parameters

limit

Maximum number of rows to update.

Samples

org.jetbrains.exposed.sql.tests.shared.dml.UpdateTests.testUpdate01
inline fun Join.update(where: SqlExpressionBuilder.() -> Op<Boolean>, limit: Int? = null, crossinline body: (UpdateStatement) -> Unit): Int

Represents the SQL statement that updates rows of a join relation.

Return

The number of updated rows.

Parameters

where

Condition that determines which rows to update.

limit

Maximum number of rows to update.

Samples

org.jetbrains.exposed.sql.tests.shared.dml.UpdateTests.testUpdateWithSingleJoin
inline fun Join.update(limit: Int? = null, crossinline body: (UpdateStatement) -> Unit): Int

Represents the SQL statement that updates all rows of a join relation.

Return

The number of updated rows.

Parameters

limit

Maximum number of rows to update.

Samples

org.jetbrains.exposed.sql.tests.shared.dml.UpdateTests.testUpdateWithSingleJoin
@JvmName(name = "updateNullableParam")
fun <T : Table> T.update(where: SqlExpressionBuilder.() -> Op<Boolean>? = null, limit: Int? = null, body: T.(UpdateStatement) -> Unit): Int

Deprecated

This `update()` with a nullable `where` parameter will be removed in future releases. Please leave a comment on [YouTrack](https://youtrack.jetbrains.com/issue/EXPOSED-494/Inline-DSL-statement-and-query-functions) with a use-case if a nullable condition cannot be replaced with the new `update()` overloads.

Replace with

update(limit = limit) { body.invoke() }

@JvmName(name = "updateJoinNullableParam")
fun Join.update(where: SqlExpressionBuilder.() -> Op<Boolean>? = null, limit: Int? = null, body: (UpdateStatement) -> Unit): Int

Deprecated

This `Join.update()` with a nullable `where` parameter will be removed in future releases. Please leave a comment on [YouTrack](https://youtrack.jetbrains.com/issue/EXPOSED-494/Inline-DSL-statement-and-query-functions) with a use-case if a nullable condition cannot be replaced with the new `Join.update()` overloads.

Replace with

update(limit = limit) { body.invoke() }