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