New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`QueryResult.rows` The default value is null. #48

Closed
kevin70 opened this Issue Dec 1, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@kevin70

kevin70 commented Dec 1, 2018

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()
        }
    }
@oshai

This comment has been minimized.

Contributor

oshai commented Dec 1, 2018

Sounds like you're right. Let me check the code to see how to fix that. It will take few days.

@oshai

This comment has been minimized.

Contributor

oshai commented Dec 2, 2018

Fixed in 0.8.54

@oshai oshai closed this Dec 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment