-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Labels
Description
SQLDelight Version
2.0.0-SNAPSHOT
Application Operating System
JVM
Describe the Bug
open class JdbcCursor(val resultSet: ResultSet) : SqlCursor {
override fun getString(index: Int): String? = resultSet.getString(index + 1) // index is zero-based
open class JdbcPreparedStatement(
private val preparedStatement: PreparedStatement
) : SqlPreparedStatement {
override fun bindBytes(index: Int, bytes: ByteArray?) {
if (bytes == null) {
preparedStatement.setNull(index, Types.BLOB) // JDBC setNull/setBytes is one-based
} else {
preparedStatement.setBytes(index, bytes)
}
}
In the SqlCursor the index is zero-based, so JdbcCursor needs to increment it for JDBC api.
in SqlPreparedStatement the index uses 1, 2, 3
, so JdbcPreparedStatement does not need increase.
Expected: All indexes are either zero based or all one-based.
Stacktrace
No response