Re: odbc resources
Craig Welch wrote:
>
> Next ...
>
> I'm trying to stress test, and have run up the number of inserts to 500,000
>
> When the program ends, it crashes on the final freeHandleODBC(), called
> from cleanUpODBC( )
Oops. I think this happens because I changed the way children handles were
freed, but didn't take this into account when the parent gets freed. Try
this:
global procedure freeHandleODBC( integer id )
atom handle
integer ix, parent
if id < 0 then
id = - id
end if
if not id then
id = current_handle
end if
handle = getHandleODBC( id )
if not handle then
return
end if
for i = 1 to length( handle_children[id] ) do
-- make sure the children weren't already freed
if handle_children[id][i] != -1 then
freeHandleODBC( handle_children[id][i] )
-- mark this as ready for reuse
handle_children[id][i] = -1
end if
end for
-- free it up in its parent's handle_children sequence
parent = handle_parent[id]
if parent then
ix = find( id, handle_children[parent] )
if ix then
handle_children[parent][ix] = -1
end if
end if
if handle_type[id] = SQL_HANDLE_STMT then
freeStmt( id, SQL_RESET_PARAMS )
freeStmt( id, SQL_UNBIND )
end if
VOID = c_func( SQLFreeHandle, { handle_type[id], handle_odbc[id] } )
handle_odbc[id] = -1
if id = current_handle then
current_handle = 0
end if
end procedure
Matt Lewis
|
Not Categorized, Please Help
|
|