[ 
https://issues.apache.org/jira/browse/CALCITE-508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16346312#comment-16346312
 ] 

ASF GitHub Bot commented on CALCITE-508:
----------------------------------------

Github user vlsi commented on a diff in the pull request:

    https://github.com/apache/calcite-avatica/pull/23#discussion_r164959963
  
    --- 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 --
    
    Infinite loop is possible. Please add a counter


> 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)

Reply via email to