You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var bytes: ByteArray
val database = Database(driver)
val queries = database.myTableQueries
//blah-blah
val myRecord = MyTable(bytes)
queries.insert(myRecord)
Well, but what if I need to allocate several gigs in bytes? Sure one should use chunking of data, etc.
Meantime in ordinary JDBC we used to handle large amount of bytes through streaming, like:
val file = File("your_path")
val inputStream = FileInputStream(file)
val statement = connection.prepareStatement("INSERT INTO myTable (myBlob) VALUES (?)")
statement.setBlob(1, inputStream)
In the end, it could be really usefull to translate blob not only to ByteArray but also to InputStream
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
At the moment one can't handle big blobs, since blobs translated to
ByteArray
.E.g. if we need to insert large blob:
and in Kotlin:
Well, but what if I need to allocate several gigs in
bytes
? Sure one should use chunking of data, etc.Meantime in ordinary JDBC we used to handle large amount of bytes through streaming, like:
In the end, it could be really usefull to translate blob not only to
ByteArray
but also toInputStream
Beta Was this translation helpful? Give feedback.
All reactions