@@ -2,7 +2,7 @@ package dev.mongocamp.driver.mongodb.jdbc.resultSet
22
33import dev .mongocamp .driver .mongodb .MongoDAO
44import dev .mongocamp .driver .mongodb .bson .BsonConverter
5- import org .mongodb .scala .bson .{ BsonArray , BsonBoolean , BsonDateTime , BsonInt32 , BsonInt64 , BsonNull , BsonNumber , BsonObjectId , BsonString }
5+ import org .mongodb .scala .bson .{ BsonArray , BsonBoolean , BsonDateTime , BsonDouble , BsonInt32 , BsonInt64 , BsonNull , BsonNumber , BsonObjectId , BsonString }
66import org .mongodb .scala .bson .collection .immutable .Document
77
88import java .io .{ InputStream , Reader }
@@ -14,6 +14,7 @@ import dev.mongocamp.driver.mongodb._
1414import dev .mongocamp .driver .mongodb .jdbc .MongoJdbcCloseable
1515
1616import java .nio .charset .StandardCharsets
17+ import javax .sql .rowset .serial .SerialBlob
1718import scala .util .Try
1819
1920class MongoDbResultSet (collectionDao : MongoDAO [Document ], data : List [Document ], queryTimeOut : Int ) extends ResultSet with MongoJdbcCloseable {
@@ -197,7 +198,7 @@ class MongoDbResultSet(collectionDao: MongoDAO[Document], data: List[Document],
197198
198199 override def getBytes (columnLabel : String ): Array [Byte ] = {
199200 checkClosed()
200- null
201+ getString(columnLabel).replace( " [ " , " " ).replace( " ] " , " " ).split( " , " ).filterNot(s => s.trim.isEmpty).map(_.trim.toByte)
201202 }
202203
203204 override def getDate (columnLabel : String ): Date = {
@@ -824,9 +825,13 @@ class MongoDbResultSet(collectionDao: MongoDAO[Document], data: List[Document],
824825 updateString(columnLabel, text)
825826 }
826827
827- override def getBlob (columnIndex : Int ): Blob = sqlFeatureNotSupported()
828+ override def getBlob (columnIndex : Int ): Blob = {
829+ new SerialBlob (getBytes(columnIndex))
830+ }
828831
829- override def getBlob (columnLabel : String ): Blob = sqlFeatureNotSupported()
832+ override def getBlob (columnLabel : String ): Blob = {
833+ new SerialBlob (getBytes(columnLabel))
834+ }
830835
831836 override def updateBlob (columnIndex : Int , x : Blob ): Unit = {
832837 checkClosed()
0 commit comments