Skip to content

Commit e1ad8c6

Browse files
fix warning
1 parent 9ac1b10 commit e1ad8c6

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

ktorm-core/src/main/kotlin/org/ktorm/database/CachedRowSet.kt

+12-10
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ import java.math.BigInteger
2323
import java.net.URI
2424
import java.net.URL
2525
import java.sql.*
26+
import java.sql.Array as SQLArray
2627
import java.sql.Date
2728
import java.sql.ResultSet.*
2829
import java.time.*
2930
import java.util.*
3031
import 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)

ktorm-support-sqlite/src/test/kotlin/org/ktorm/support/sqlite/QueryTest.kt

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.ktorm.support.sqlite
22

33
import org.junit.Test
4-
import org.ktorm.database.use
54
import org.ktorm.dsl.*
65
import org.ktorm.schema.TextSqlType
76
import java.sql.Clob

0 commit comments

Comments
 (0)