You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
QueryResult.rows The default value is null. I need NPE judgment for every query.
This kind of code makes me feel bad. I don't think these judgments make sense at all. For queries that don't have results, they should return an empty object, which should be more like JDBC's ResultSet for emtpy.
override fun findServers(): Flux<Server> {
return conn.sendPreparedStatement(
"SELECT HOST,PORT,INIT_AT,ACTIVE_AT FROM DUIC_SERVER WHERE ACTIVE_AT >= :active_at",
listOf(LocalDateTime.now().minus(ACTIVE_TIMEOUT))
).toMono().flatMapMany {
val rows = it.rows ?: emptyList<RowData>()
rows.map { rs ->
Server(
host = rs.getAs("host"),
port = rs.getAs("port"),
initAt = rs.getDate("init_at")!!.toDate(),
activeAt = rs.getDate("active_at")!!.toDate()
)
}.toFlux()
}
}
The text was updated successfully, but these errors were encountered:
QueryResult.rows
The default value is null.I need NPE judgment for every query.
This kind of code makes me feel bad. I don't think these judgments make sense at all. For queries that don't have results, they should return an empty object, which should be more like JDBC's ResultSet for emtpy.
The text was updated successfully, but these errors were encountered: