db9010 / com.jovial.db9010 / Database / update

update

fun update(table: Table): Builder

Run an UPDATE statement on the given table. Rows to be updated are identified with calls to ParameterSetter.set within the code body passed to UpdateStatement.Builder.run.

Usage example:

    val idStr = Parameter(Types.sqlString)
    val num = db.update(Users) + "WHERE " + id + "=" + idStr run { u ->
        u[idStr] = "alex"   // Sets the parameter
        u[Users.name] = "Alexy"   // Sets the new value of the name column
        u[users.cityId] = pragueId    // Sets the new value of the cityId column
    }
    println("Updated $num row(s)")