Skip to content

Statement.getUpdateCount() throws SQLException after getResultSet() for SELECT statements #205

@zhicwu

Description

@zhicwu

I got the following exception when calling Statement.getUpdateCount() after getResultSet() for SELECT statements:

Exception in thread "main" java.sql.SQLException: Prepare something first
	at org.duckdb.DuckDBPreparedStatement.getUpdateCountInternal(DuckDBPreparedStatement.java:402)
	at org.duckdb.DuckDBPreparedStatement.getUpdateCount(DuckDBPreparedStatement.java:414)
	at io.github.jdbcx.driver.WrappedStatement.getMoreResults(WrappedStatement.java:354)
	at io.github.jdbcx.Main.execute(Main.java:320)
	at io.github.jdbcx.Main.executeQueries(Main.java:350)
	at io.github.jdbcx.Main.process(Main.java:411)
	at io.github.jdbcx.Main.main(Main.java:468)

Could you please enhance the driver to align with the JDBC specification and return -1 from Statement.getUpdateCount() (and similarly getLargeUpdateCount) when "the result is a ResultSet object or there are no more results"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions