Skip to content

[BUG] Statement.getLargeUpdateCount() must return value, but throws an exception. #1063

@vankovivan

Description

@vankovivan

Describe the bug
Statement.getLargeUpdateCount() must return value, but throws an exception.

To Reproduce

        String sql = "create or replace table simple_test_2856371(col integer)";
        String url = "jdbc:databricks://...";

        Properties props = new Properties();
        props.setProperty("user", "token");
        props.setProperty("password", "<token>");

        Driver driver = DriverManager.getDriver(url);

        try (Connection conn = driver.connect(url, props);
             PreparedStatement st = conn.prepareStatement(sql)) {
            boolean isResultset = st.execute();
            assert(!isResultset);

            // Not the result set, get the update count.
            long updateCount = st.getLargeUpdateCount();
            assert(updateCount == 0);

            // Check for more results, stop condition is: ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
            // as specified in https://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#getMoreResults--
            isResultset = st.getMoreResults();
            assert(!isResultset);

            // must be -1, got an exception: Operation not allowed - ResultSet is closed
            updateCount = st.getLargeUpdateCount();
            assert(updateCount == -1);
        }

Expected behavior
Statement.getLargeUpdateCount() returns -1 when there are no more results.

Client Environment (please complete the following information):
Driver version: 3.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions