Skip to content

Commit

Permalink
#115 Make "where" optional for update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapac committed Aug 26, 2018
1 parent 75bd474 commit 9de65cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ fun <T:Table> T.insertIgnore(selectQuery: Query, columns: List<Column<*>> = this
/**
* @sample org.jetbrains.exposed.sql.tests.shared.DMLTests.testUpdate01
*/
fun <T:Table> T.update(where: SqlExpressionBuilder.()->Op<Boolean>, limit: Int? = null, body: T.(UpdateStatement)->Unit): Int {
val query = UpdateStatement(this, limit, SqlExpressionBuilder.where())
fun <T:Table> T.update(where: (SqlExpressionBuilder.()->Op<Boolean>)? = 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<Boolean>)? = null, limit: Int? = null, body: (UpdateStatement)->Unit) : Int {
fun Join.update(where: (SqlExpressionBuilder.()->Op<Boolean>)? = null, limit: Int? = null, body: (UpdateStatement)->Unit) : Int {
val query = UpdateStatement(this, limit, where?.let { SqlExpressionBuilder.it() })
body(query)
return query.execute(TransactionManager.current())!!
Expand Down

0 comments on commit 9de65cc

Please sign in to comment.