Not sure if this is an issue in general, but it is for the following use case:
Execute the following query in Query Analyzer against SQL Server:
select * from sales_transactions waitfor delay '00:01'
The query should return a sufficiently large result set, enough to fill a "buffer" (maybe > 4KB).
Then click cancel. It will take 1 minute for the user to regain control.
The reason is that the cancel command was never sent to the server in this example. Here's why:
AFScriptContext.executeScriptStatements() will call:
1. setExecuting(true);
2. _currentStatement.execute(sqlString);
3. setExecuting(false);
In this example, the server will return parts or all of the result set, then do the "waitfor delay 00:01". And because the server returned something, step #2 will finish executing very quickly, and the code will set executing = false. Then when the user clicks cancel, AFScriptContext.cancelQuery() will not send the cancel to the server when isExecuting() == false.
So instead, AFScriptContext.cancelQuery() should probably check "isQueryNotDone" rather than "isExecuting". We know the query is not done because the cancel button is still enabled.
You can also reproduce this by executing a select * from sales_transactions query
Assume sales_transactions has a million rows and you hit stop after ADS has retrieved 20,000 rows. ADS still retrieves all 1 million rows (which takes a long time) but then displays only 20,000 rows