chickadee » freetds » call-with-result-set

(call-with-result-set CONN QUERY [PARAM0 [PARAM1 ... ]] PROCEDURE)procedure

A convenience wrapper which issues a query and invokes PROCEDURE with the result object as an argument, analogously to call-with-input-file or call-with-output-file.

This cleans up the result set when control leaves PROCEDURE's dynamic extent (more importantly, this ensures the result is cleaned up when an unhandled exception occurs).

Important: When the dynamic extent is re-entered, the result object will be invalid because it was cleaned up. The query is not resent.