The attached patch now works for me.
Rob,
The test case is as follows:
1. Execute any sql statement which returns a *single* result set. This
should be displayed properly by squirrel. This case is for regression.
2. Execute any sql statement which returns *multiple* result sets. I had
some stored procedures which returned multiple result sets. Squirrel should
open multiple result panels for each returned result set.
Just for info, the comments in this class also talk about the problem I
faced.
<quote>
If getMoreResults() returns false, we don't know if we have more results, we
only know that it isn't a result set. Since we called getUpdateCount()
before getMoreResults() because we would like to know the update count of
the first result, we might not be allowed to call getUpdateCount() again.
</quote>
I hope this will solve this problem.
Thanks
Abhishek
Here is the text of the patch (for a quick look).
302c303,322
< int updateCount = _stmt.getUpdateCount();
---
> int updateCount = -1;
> boolean moreResults = true;
> if (inFirstLoop && !firstResultIsResultSet)
> {
> // in first loop if the first result is not a result set.
> updateCount = _stmt.getUpdateCount();
> } else if (!inFirstLoop)
> {
> // If not in first loop call getMoreResults before calling
getUpdateCount
> moreResults = _stmt.getMoreResults();
> updateCount = _stmt.getUpdateCount();
> }
> if (!moreResults && -1 == updateCount)
> {
> // There is no need to close result sets if we call
_stmt.getMoreResults() because it
> // implicitly closes any current ResultSet.
> // ON DB2 version 7.1 it is even harmful to close a
ResultSet explicitly.
> // _stmt.getMoreResults() will never return true anymore if
you do.
> break;
> }
309c329
< else if(false == inFirstLoop)
---
> else if( !inFirstLoop )
363,370d382
< if (!_stmt.getMoreResults() && -1 == updateCount)
< {
< // There is no need to close result sets if we call
_stmt.getMoreResults() because it
< // implicitly closes any current ResultSet.
< // ON DB2 version 7.1 it is even harmful to close a ResultSet
explicitly.
< // _stmt.getMoreResults() will never return true anymore if
you do.
< break;
< }
-----Original Message-----
From: Rob Manning [mailto:Rob...@co...]
Sent: Thursday, November 03, 2005 10:02 AM
To: Gupta, Abhishek
Cc: Gerd Wagner; squ...@li...
Subject: Re: [Squirrel-sql-users] multiple result sets problem
Gupta, Abhishek wrote:
>Yes I found the problem soon after I finished working with stored procs.
>Sent a mail regarding this also. I am sorry for wasting your time.
>
>However I do think that getMoreResults should be called before calling
>getUpdateCount.
>
>I will try to make it work but I can only test on Sybase and MySQL.
>
>
Abhishek,
Let me know when you get it working. I have access to HSQLDB, Derby,
Firebird and
Oracle instances. If you describe to me your test case and what I
should look for to confirm
that the patch works correctly, I'll be happy to test it against these
databases and report back
whether or not it works.
Rob Manning
CollabraSpace - Revolutionary Collaboration
Visit us at http://www.collabraspace.com
This message has been scanned for viruses by
ClamAV v0.83
|