Skip to content

Commit

Permalink
Merged
Browse files Browse the repository at this point in the history
  • Loading branch information
kpgalligan committed Nov 5, 2023
2 parents 4deea8d + 3921f7f commit e8c81b5
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,31 +218,33 @@ class NativeStatementTest : BaseDatabaseTest(){
}
}

val TWO_COL_WITH_BLOB = "CREATE TABLE test (num INTEGER NOT NULL, " +
"blb BLOB NOT NULL)"
val THREE_COL_WITH_BLOB = "CREATE TABLE test (num INTEGER NOT NULL, " +
"blb BLOB NOT NULL, null_blb BLOB)"

@Test
fun bindEmptyBlob() {
basicTestDb(TWO_COL_WITH_BLOB) {
basicTestDb(THREE_COL_WITH_BLOB) {
it.withConnection {
it.withStatement("insert into test(num, blb)values(?,?)") {
it.withStatement("insert into test(num, blb, null_blb)values(?,?,?)") {
bindLong(1, 22)
bindBlob(2, ByteArray(0){it.toByte()})
bindBlob(2, byteArrayOf())
bindBlob(3, null)
executeInsert()
}

it.withStatement("select blb from test") {
it.withStatement("select blb, null_blb from test") {
val query = query()
query.next()
assertEquals(query.getBytes(query.columnNames["blb"]!!).size, 0)
assertEquals(query.getBytesOrNull(query.columnNames["null_blb"]!!), null)
}
}
}
}

@Test
fun bindBlob() {
basicTestDb(TWO_COL_WITH_BLOB) {
basicTestDb(THREE_COL_WITH_BLOB) {
it.withConnection {
it.withTransaction {
it.withStatement("insert into test(num, blb)values(?,?)") {
Expand Down

0 comments on commit e8c81b5

Please sign in to comment.