-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: EXPOSED-339 Oracle alias for blob does not work (#2048)
* fix: EXPOSED-339 Oracle alias for blob does not work * fix: EXPOSED-339 revert changes in ResultRow, move fix to ColumnType
- Loading branch information
1 parent
8146b78
commit 713ad95
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/types/BlobColumnTypeTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.jetbrains.exposed.sql.tests.shared.types | ||
|
||
import junit.framework.TestCase.assertEquals | ||
import org.jetbrains.exposed.dao.id.IntIdTable | ||
import org.jetbrains.exposed.sql.alias | ||
import org.jetbrains.exposed.sql.insert | ||
import org.jetbrains.exposed.sql.statements.api.ExposedBlob | ||
import org.jetbrains.exposed.sql.tests.DatabaseTestsBase | ||
import org.junit.Test | ||
import java.nio.charset.Charset | ||
|
||
class BlobColumnTypeTests : DatabaseTestsBase() { | ||
object BlobTable : IntIdTable("test-blob") { | ||
val content = blob("content") | ||
} | ||
|
||
@Test | ||
fun testWriteAndReadBlobValueViaAlias() { | ||
withTables(BlobTable) { | ||
val sampleData = "test-sample-data" | ||
BlobTable.insert { | ||
it[content] = ExposedBlob(sampleData.toByteArray()) | ||
} | ||
|
||
val alias = BlobTable.content.alias("content_column") | ||
val content = BlobTable.select(alias).single()[alias].bytes.toString(Charset.defaultCharset()) | ||
assertEquals(content, sampleData) | ||
} | ||
} | ||
} |