Skip to content

Commit a7714ad

Browse files
committed
fix db params
1 parent e083c6d commit a7714ad

File tree

1 file changed

+4
-6
lines changed
  • frameworks/Kotlin/ktor/ktor-r2dbc/src/main/kotlin/org/jetbrains/ktor/benchmarks

1 file changed

+4
-6
lines changed

frameworks/Kotlin/ktor/ktor-r2dbc/src/main/kotlin/org/jetbrains/ktor/benchmarks/Hello.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,9 @@ fun Application.main() {
137137
Mono.usingWhen(dbConnFactory.create(), { connection ->
138138
val statement = connection.createStatement(UPDATE_QUERY)
139139
worldsUpdated.forEach { world ->
140-
if (world.id != null && world.randomNumber != null) {
141-
statement.bind(0, world.randomNumber)
142-
statement.bind(1, world.id)
143-
statement.add()
144-
}
140+
statement.bind("$1", world.randomNumber)
141+
statement.bind("$2", world.id)
142+
statement.add()
145143
}
146144
if (worldsUpdated.isNotEmpty()) {
147145
Mono.from(statement.execute())
@@ -159,7 +157,7 @@ private fun getWorld(
159157
dbConnFactory: ConnectionFactory, random: Random
160158
): Mono<World> = Mono.usingWhen(dbConnFactory.create(), { connection ->
161159
Mono.from(connection.createStatement(WORLD_QUERY)
162-
.bind(0, random.nextInt(DB_ROWS) + 1)
160+
.bind("$1", random.nextInt(DB_ROWS) + 1)
163161
.execute())
164162
.flatMap { r ->
165163
Mono.from(r.map { row, _ ->

0 commit comments

Comments
 (0)