This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 230515 - Correct multiple resultsets
Summary: Correct multiple resultsets
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2013-05-30 10:31 UTC by matthias42
Modified: 2013-06-02 01:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch v1 (10.47 KB, patch)
2013-05-30 10:31 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matthias42 2013-05-30 10:31:50 UTC
Created attachment 135120 [details]
proposed patch v1

There is an outfall from the rework of the resultset fetching (SQLExecutionHelper.java). There are two issues fixed by the attached patch.


- I tested with informix and it bailed out, because getUpdateCount was called twice. The language in http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#getUpdateCount%28%29 was interpreted by IBM as 'getUpdateCount must not be called more than once'. The change reworks the fetching order to follow the advice given in http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#getMoreResults%28%29

- testing derby I implemented a most simple stored procedure:

public class Test {
    public static void selectRows(ResultSet[] data1, ResultSet[] data2) throws SQLException {
        Connection conn = DriverManager.getConnection("jdbc:default:connection");
        PreparedStatement ps1 = conn.prepareStatement("select * from t1");
        data1[0] = ps1.executeQuery();

        PreparedStatement ps2 = conn.prepareStatement("select * from t2");
        data2[0] = ps2.executeQuery();

        conn.close();
    }
}

and called it ... well it failed - derby does not like the combination of asking for a scrollable cursor and the nested resultsets.

I moved the logic for determining whether scrollable resultsets are supported into the method updateScrollableSupport and there I check for the driver and the statement type.
Comment 1 Jaroslav Havlin 2013-05-31 14:20:37 UTC
http://hg.netbeans.org/core-main/rev/1e02f2d6fe2e
Applied. Thank you, Matthias.

A few notes:
 - I've fixed several "The assigned value is never used" warnings. I hope this
   doesn't break anything.
 - I've skipped "stmt.setFetchSize(Integer.MIN_VALUE);" change, supposing
   that the line was changed by mistake (setting negative value is not allowed,
   according to javadoc).
 - Removing condition "if (!needReread)" nested in "if (needReread)" condition,
   as it is never satisfied.
 - Expression "dc.getJDBCDriver().getClassName()" replaced with 
   "dc.getDriverClass()", because it broke several tests.

Please check the changes and if some of them are wrong, please let me know.
Many thanks!
Comment 2 matthias42 2013-05-31 16:28:58 UTC
(In reply to comment #1)
>  - I've fixed several "The assigned value is never used" warnings. I hope this
>    doesn't break anything.

Looks good!

>  - I've skipped "stmt.setFetchSize(Integer.MIN_VALUE);" change, supposing
>    that the line was changed by mistake (setting negative value is not allowed,
>    according to javadoc).

Yeah - I was experimenting with mysql and streaming resultsets ... Sorry it should not have been in the patch.

>  - Removing condition "if (!needReread)" nested in "if (needReread)" condition,
>    as it is never satisfied.

Nice catch :-)

>  - Expression "dc.getJDBCDriver().getClassName()" replaced with 
>    "dc.getDriverClass()", because it broke several tests.

Another nice one!

Thanks for getting through the patch - I'm not sure what exactly went wrong on my side - I would have sworn, that I executed the test suite and removed the Integer.MIN_VALUE satement.

I'll give it a spin once the changes migrate to main-golden.
Comment 3 Quality Engineering 2013-06-02 01:07:59 UTC
Integrated into 'main-golden', will be available in build *201306012301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1e02f2d6fe2e
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #230515: Correct multiple resultsets

Patch by Matthias42.