Skip to content

Commit 59c54ba

Browse files
committed
tested and fixed
1 parent dabac4c commit 59c54ba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

common/src/main/java/com/imsproject/common/dataAccess/OfflineResultSet.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ class OfflineResultSet(rs: ResultSet) {
8484

8585
fun getLocalDateTime(columnName: String): LocalDateTime? {
8686
val obj = getObject(columnName) ?: return null
87-
return LocalDateTime.parse(obj as String, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
87+
return when (obj) {
88+
is LocalDateTime -> obj
89+
is java.sql.Timestamp -> obj.toLocalDateTime()
90+
is String -> LocalDateTime.parse(obj, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
91+
else -> throw IllegalArgumentException("Unsupported type for LocalDateTime: ${obj::class.java.name}")
92+
}
8893
}
8994

9095
inline fun <reified T> getEnum(columnName: String): T? {

0 commit comments

Comments
 (0)