Change the way chained result sets are free'd, to avoid recursion.

If you have a lot of chained results, e.g. if you array bind a lot of
parameters, recursing through the whole chain might make you run out of
stack space. Convert recursion to iteration.

Also, when we're freeing all the results in the chain, we only need to
call QR_set_cursor(self, NULL) once, on the first result in the chain.
QR_set_cursor itself loops through the whole chain, resetting the cursor
name of every result. By only calling it for the first result, we avoid
O(n^2) behavior, significantly speeding up SQLFreeHandle() on a statement
with a large number of chained results.