Skip to content

Commit 39bed06

Browse files
authored
(#4) Allowing nullable params for batchExecuteCommand (#18)
1 parent ede1c41 commit 39bed06

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

runtime/src/main/kotlin/norm/SqlExtensions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ fun ResultSet.toTable(columnNames: List<String> = getColumnNames()): List<List<A
3535

3636
// TODO - handle prepareStatements Failure as well
3737

38-
fun PreparedStatement.withParams(params: List<Any> = listOf()): PreparedStatement =
38+
fun PreparedStatement.withParams(params: List<Any?> = listOf()): PreparedStatement =
3939
this.also { self ->
4040
params.forEachIndexed { index, param -> self.setObject(index + 1, param) }
4141
}
4242

43-
fun PreparedStatement.withBatches(batchedParams: List<List<Any>> = listOf()) =
43+
fun PreparedStatement.withBatches(batchedParams: List<List<Any?>> = listOf()) =
4444
this.also { ps ->
4545
batchedParams.forEach { params ->
4646
ps.withParams(params).addBatch()
@@ -52,7 +52,7 @@ fun Connection.executeCommand(sql: String, params: List<Any> = listOf()): Int =
5252
.withParams(params)
5353
.use { it.executeUpdate() } // auto-close ps
5454

55-
fun Connection.batchExecuteCommand(sql: String, batchedParams: List<List<Any>> = listOf()): List<Int> =
55+
fun Connection.batchExecuteCommand(sql: String, batchedParams: List<List<Any?>> = listOf()): List<Int> =
5656
this.prepareStatement(sql)
5757
.withBatches(batchedParams)
5858
.use { it.executeBatch() }

0 commit comments

Comments
 (0)