Previous Thread
Next Thread
Print Thread
Bad Result Set Handle #31097 23 Apr 13 09:06 AM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
What's the maximum number of result set handles supported at once?

I have a category hierarchy in a table defined using an adjacency list. This requires a recursive function to select an entire path in the hierarchy. When I reach the fifth result XCALL SQL returns rc=21 (SQLERR_BADRESHDL).


Stephen Funkhouser
Diversified Data Solutions
Re: Bad Result Set Handle #31098 23 Apr 13 10:29 AM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
The default maximum is 4, but you should be able to increase that by setting the desired maximum number of result sets into the reshdl member of the ST_SQL_CMDHDR structure that you pass to the SQLOP_INIT_CONN (4) call.

The idea was to set a reasonable maximum by default in order to avoid some rogue accidental value being requested. But not to prevent you from using as many as you want, if you really want to.

Re: Bad Result Set Handle #31099 23 Apr 13 10:39 AM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Thanks, could the resultset handle information be added to the SQL docs?

As an aside, I decided to modify my function to only require one handle. I temporarily save the result set to a local DIMX array, and then iterate the temporary array to make the recursive calls. This way there shouldn't be a un-freed resultset memory issue possible.

Does a previous resultset get free'd on subsequent queries if it was not explicitly free'd via a SQLOP_FREE_RESULT call?


Stephen Funkhouser
Diversified Data Solutions
Re: Bad Result Set Handle #31100 23 Apr 13 11:21 AM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I need to need to update the ASQL documentation...

No, result sets are not automatically freed by the subsequent SQLOP_QUERY, so it is imperative that you use SQLOP_FREE_RESULT after done using the results of the previous query.

The only automatic cleanup of result sets is when you disconnect, in which all of the active result set handles will be freed. (But that won't account for the case where you effectively orphan a result set by reusing the handle without first free it.)


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3