@@ -23,11 +23,13 @@ import java.math.BigInteger
2323import java.net.URI
2424import java.net.URL
2525import java.sql.*
26+ import java.sql.Array as SQLArray
2627import java.sql.Date
2728import java.sql.ResultSet.*
2829import java.time.*
2930import java.util.*
3031import javax.sql.rowset.serial.*
32+ import kotlin.use
3133
3234/* *
3335 * Special implementation of [ResultSet], used to hold the query results for Ktorm.
@@ -245,7 +247,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
245247 is SQLData -> SerialStruct (obj, _typeMap )
246248 is Blob -> try { MemoryBlob (obj) } finally { obj.free() }
247249 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() }
249251 else -> obj
250252 }
251253 }
@@ -276,9 +278,9 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
276278 }
277279
278280 private class MemoryArray (
279- array : java.sql. Array ,
281+ array : SQLArray ,
280282 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) {
282284
283285 override fun free () {
284286 // no-op
@@ -396,7 +398,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
396398 override fun getBytes (columnIndex : Int ): ByteArray? {
397399 return when (val value = getColumnValue(columnIndex)) {
398400 null -> null
399- is ByteArray -> Arrays .copyOf(value, value.size )
401+ is ByteArray -> value .copyOf()
400402 is Blob -> value.binaryStream.use { it.readBytes() }
401403 else -> throw SQLException (" Cannot convert ${value.javaClass.name} value to byte[]." )
402404 }
@@ -1076,10 +1078,10 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
10761078 }
10771079 }
10781080
1079- override fun getArray (columnIndex : Int ): java.sql. Array ? {
1081+ override fun getArray (columnIndex : Int ): SQLArray ? {
10801082 return when (val value = getColumnValue(columnIndex)) {
10811083 null -> null
1082- is java.sql. Array -> value
1084+ is SQLArray -> value
10831085 else -> throw SQLException (" Cannot convert ${value.javaClass.name} value to Array." )
10841086 }
10851087 }
@@ -1100,7 +1102,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
11001102 return getClob(findColumn(columnLabel))
11011103 }
11021104
1103- override fun getArray (columnLabel : String ): java.sql. Array ? {
1105+ override fun getArray (columnLabel : String ): SQLArray ? {
11041106 return getArray(findColumn(columnLabel))
11051107 }
11061108
@@ -1195,12 +1197,12 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
11951197 }
11961198
11971199 @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 {
11991201 throw SQLFeatureNotSupportedException (" The result set is not updatable." )
12001202 }
12011203
12021204 @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 {
12041206 throw SQLFeatureNotSupportedException (" The result set is not updatable." )
12051207 }
12061208
@@ -1460,7 +1462,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
14601462 Instant ::class -> getInstant(columnIndex)
14611463 Blob ::class -> getBlob(columnIndex)
14621464 Clob ::class -> getClob(columnIndex)
1463- java.sql. Array ::class -> getArray(columnIndex)
1465+ SQLArray ::class -> getArray(columnIndex)
14641466 Ref ::class -> getRef(columnIndex)
14651467 URL ::class -> getURL(columnIndex)
14661468 else -> getObject(columnIndex)
0 commit comments