[ https://issues.apache.org/jira/browse/CALCITE-508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16350405#comment-16350405 ]
ASF GitHub Bot commented on CALCITE-508: ---------------------------------------- Github user asolimando commented on a diff in the pull request: https://github.com/apache/calcite-avatica/pull/23#discussion_r165660009 --- Diff: core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetThrowsSqlExceptionTest.java --- @@ -75,11 +90,118 @@ public void testUpdateNull() throws SQLException { final TestDriver driver = new TestDriver(); try (Connection connection = driver.connect("jdbc:test", properties); ResultSet resultSet = - connection.createStatement().executeQuery("SELECT * FROM TABLE")) { + connection.createStatement().executeQuery("SELECT * FROM TABLE")) { thrown.expect(SQLFeatureNotSupportedException.class); resultSet.updateNull(1); } } -} + @Test + public void testCommonCursorStates() throws SQLException { + final ResultSet resultSet = getResultSet(); + + // right after statement execution, result set is before first row + assert resultSet.isBeforeFirst(); + + // retrieve each row until the last one + while (!resultSet.isAfterLast()) { --- End diff -- I have added a limit of at most 2 rows, that is sufficient for the test at hand. Do you see any better way to enforce a reasonable limit? There is no way to know beforehand the size of the result set, you can just check the return value of next and isAfterLast (this last was my previous attempt). > Reading from ResultSet before calling next() should throw SQLException not > NoSuchElementException > ------------------------------------------------------------------------------------------------- > > Key: CALCITE-508 > URL: https://issues.apache.org/jira/browse/CALCITE-508 > Project: Calcite > Issue Type: Bug > Reporter: Julian Hyde > Assignee: Julian Hyde > Priority: Major > Labels: newbie > > Reading from ResultSet before calling next() should throw SQLException not > NoSuchElementException. > Each of the Cursor.Accessor.getXxx methods should convert runtime exceptions > to SQLException. > JdbcTest.testExtract currently demonstrates this problem; it passes if there > is a NoSuchElementException, but should look for a SQLException. -- This message was sent by Atlassian JIRA (v7.6.3#76005)