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.
Thanks
Abhishek
-----Original Message-----
From: Gerd Wagner [mailto:bir...@t-...]
Sent: Thursday, November 03, 2005 4:50 AM
To: Gupta, Abhishek
Cc: squ...@li...
Subject: Re: [Squirrel-sql-users] multiple result sets problem
Hi Abhishek,
your patch has a problem with simple Select statements. For simple
Select statements getMoreResults() returns false and getUpdateCount()
returns -1 at their first call. So with your patch the while loop will
break before any result is shown.
I tested your patch against PostgreSQL and DB2.
By the way it took us quite some trials to get this while loop to work
right with most databases. So this is not an easy area. Nonetheless if
it could be improved we would do it.
Gerd
Gupta, Abhishek schrieb:
> Hello,
>
>
>
> I was having some problems getting sql to return multiple result sets.
>
> I am using jTDS 1.1 driver to connect to Sybase 12.5 server.
>
>
>
> After debugging the problem seems that the getMoreResults method can
> change the updateCount. So getUpdateCount should be called after
> getMoreResults.
>
>
>
> This can solve this problem on Sybase but I am not sure about other
> databases.
>
>
>
> I made the changes as in the attached patch for this to work. The patch
> is against the latest snapshot zip file.
>
>
>
> Thanks
>
> Abhishek
>
>
> ------------------------------------------------------------------------
>
> 301a299
>
>> boolean moreResults = _stmt.getMoreResults();
>
> 302a301,308
>
>> 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;
>> }
>
> 360,368d365
> < break;
> < }
> <
> < 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.
|