db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4424) Convert outerjoin.sql into JUnit
Date Fri, 13 Nov 2009 23:15:39 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777730#action_12777730
] 

Bryan Pendleton commented on DERBY-4424:
----------------------------------------

Hi Eranda, thanks for working on this test.

The handling of the warning message is a little bit delicate, and I had to fiddle with it
a bit.
Basically, the problem is that the warning is not generated in embedded mode until *after*
you call rs.next(), but if you wait until you have processed the entire result set, then the
warning is cleared when the result set is closed.

So I think you can only get this warning *after* calling rs.next(), but *before* calling rs.close(),
and since the call to JDBC.assertFullResultSet() was doing both the rs.next() and the rs.close()
for you, you weren't able to see the warning in your test code.

So I re-wrote this section of the test a little bit and was able to get the
warning to appear in a way that the test could check it.

Here's the section of the test after I fiddled with the test code a bit. Please try putting
this code into the test and see if it now works for you.

        rs = st.executeQuery(
            " select max(name), max(resdate) from inventory join "
            + "timeslots on inventory.capacity is not null "
            + "left outer join reservations on inventory.itemno = "
            + "reservations.itemno and reservations.slot = timeslots.slot");

        rs.next(); // This causes the warning to be generated now.
        if (usingEmbedded())
        {
            SQLWarning sqlWarn = rs.getWarnings();

            assertNotNull("Expected warning but found none", sqlWarn);
            assertSQLState("01003", sqlWarn);
        }
        assertEquals("Yang", rs.getString(1));
        assertEquals("2000-07-13", rs.getString(2));

I also deleted the declaration of the "sqlWarn" variable from the top of
the test method and moved it to this area because this was the only
place that variable was used and so it seemed a little easier to read that way.


> Convert outerjoin.sql into JUnit
> --------------------------------
>
>                 Key: DERBY-4424
>                 URL: https://issues.apache.org/jira/browse/DERBY-4424
>             Project: Derby
>          Issue Type: Improvement
>            Reporter: Eranda Sooriyabandara
>            Assignee: Eranda Sooriyabandara
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: OuterJoinTest.diff
>
>
> Conversion of the outerjoin test into JUnit

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message