@@ -23,11 +23,13 @@ import java.math.BigInteger
23
23
import java.net.URI
24
24
import java.net.URL
25
25
import java.sql.*
26
+ import java.sql.Array as SQLArray
26
27
import java.sql.Date
27
28
import java.sql.ResultSet.*
28
29
import java.time.*
29
30
import java.util.*
30
31
import javax.sql.rowset.serial.*
32
+ import kotlin.use
31
33
32
34
/* *
33
35
* Special implementation of [ResultSet], used to hold the query results for Ktorm.
@@ -245,7 +247,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
245
247
is SQLData -> SerialStruct (obj, _typeMap )
246
248
is Blob -> try { MemoryBlob (obj) } finally { obj.free() }
247
249
is Clob -> try { MemoryClob (obj) } finally { obj.free() }
248
- is java.sql. Array -> try { MemoryArray (obj, _typeMap ) } finally { obj.free() }
250
+ is SQLArray -> try { MemoryArray (obj, _typeMap ) } finally { obj.free() }
249
251
else -> obj
250
252
}
251
253
}
@@ -276,9 +278,9 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
276
278
}
277
279
278
280
private class MemoryArray (
279
- array : java.sql. Array ,
281
+ array : SQLArray ,
280
282
typeMap : Map <String , Class <* >>?
281
- ) : java.sql.Array by if (typeMap != null ) SerialArray(array, typeMap) else SerialArray(array) {
283
+ ) : SQLArray by if (typeMap != null ) SerialArray(array, typeMap) else SerialArray(array) {
282
284
283
285
override fun free () {
284
286
// no-op
@@ -396,7 +398,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
396
398
override fun getBytes (columnIndex : Int ): ByteArray? {
397
399
return when (val value = getColumnValue(columnIndex)) {
398
400
null -> null
399
- is ByteArray -> Arrays .copyOf(value, value.size )
401
+ is ByteArray -> value .copyOf()
400
402
is Blob -> value.binaryStream.use { it.readBytes() }
401
403
else -> throw SQLException (" Cannot convert ${value.javaClass.name} value to byte[]." )
402
404
}
@@ -1076,10 +1078,10 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
1076
1078
}
1077
1079
}
1078
1080
1079
- override fun getArray (columnIndex : Int ): java.sql. Array ? {
1081
+ override fun getArray (columnIndex : Int ): SQLArray ? {
1080
1082
return when (val value = getColumnValue(columnIndex)) {
1081
1083
null -> null
1082
- is java.sql. Array -> value
1084
+ is SQLArray -> value
1083
1085
else -> throw SQLException (" Cannot convert ${value.javaClass.name} value to Array." )
1084
1086
}
1085
1087
}
@@ -1100,7 +1102,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
1100
1102
return getClob(findColumn(columnLabel))
1101
1103
}
1102
1104
1103
- override fun getArray (columnLabel : String ): java.sql. Array ? {
1105
+ override fun getArray (columnLabel : String ): SQLArray ? {
1104
1106
return getArray(findColumn(columnLabel))
1105
1107
}
1106
1108
@@ -1195,12 +1197,12 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
1195
1197
}
1196
1198
1197
1199
@Deprecated(" The result set is not updatable." , level = DeprecationLevel .ERROR )
1198
- override fun updateArray (columnIndex : Int , x : java.sql. Array ? ): Nothing {
1200
+ override fun updateArray (columnIndex : Int , x : SQLArray ? ): Nothing {
1199
1201
throw SQLFeatureNotSupportedException (" The result set is not updatable." )
1200
1202
}
1201
1203
1202
1204
@Deprecated(" The result set is not updatable." , level = DeprecationLevel .ERROR )
1203
- override fun updateArray (columnLabel : String? , x : java.sql. Array ? ): Nothing {
1205
+ override fun updateArray (columnLabel : String? , x : SQLArray ? ): Nothing {
1204
1206
throw SQLFeatureNotSupportedException (" The result set is not updatable." )
1205
1207
}
1206
1208
@@ -1460,7 +1462,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
1460
1462
Instant ::class -> getInstant(columnIndex)
1461
1463
Blob ::class -> getBlob(columnIndex)
1462
1464
Clob ::class -> getClob(columnIndex)
1463
- java.sql. Array ::class -> getArray(columnIndex)
1465
+ SQLArray ::class -> getArray(columnIndex)
1464
1466
Ref ::class -> getRef(columnIndex)
1465
1467
URL ::class -> getURL(columnIndex)
1466
1468
else -> getObject(columnIndex)
0 commit comments