Sybase sp_help - first ResultSet, not last
Posted: 14.03.2012, 16:40
the Sybase sp_help procedure returns multiple resultsets, but the actual reply is in the very first resultset. In SQL Advantage (the Sybase client program to execute queries), you get for example this answer :
(373 rows affected)
(0 rows affected)
(0 rows affected)
(0 rows affected)
(return status = 0)
So 4 resultsets are returned, but only the first one contains actual data.
In ZDbcDbLibStatement.pas, there is a function TZDBLibStatement.ExecuteQuery, which contains a loop to get resultsets until there are no more available, effectively returning the last resultset.
For procedures like "sp_who", this is OK as for these procedures the actual data is inside the last resultset, but not for "sp_help"
Is there a way to obtain the first resultset instead of the last one?
(I am adding overloaded ExecuteQueries in the code with an extra boolean parameter to indicate that the loop should stop as soon as a valid resultset is found. Probably not the best solution)
(373 rows affected)
(0 rows affected)
(0 rows affected)
(0 rows affected)
(return status = 0)
So 4 resultsets are returned, but only the first one contains actual data.
In ZDbcDbLibStatement.pas, there is a function TZDBLibStatement.ExecuteQuery, which contains a loop to get resultsets until there are no more available, effectively returning the last resultset.
For procedures like "sp_who", this is OK as for these procedures the actual data is inside the last resultset, but not for "sp_help"
Is there a way to obtain the first resultset instead of the last one?
(I am adding overloaded ExecuteQueries in the code with an extra boolean parameter to indicate that the loop should stop as soon as a valid resultset is found. Probably not the best solution)