Feature: Use Begin/End ExecuteReader to allow for Async execution of script.


Having the script executed Async gives a few benefits. You can do this by using BeginExecuteReader and EndExecuteReader on the SQL Command object.
1 - Large results. Speed should increase. This allows you to use more threads without the extra work.
2 - Possible to cancel query. Right now you can't cancel a query with CTRL-C. It justs sits there and waits. If done Async, you could cancel it.


StephenMills wrote Aug 16, 2010 at 5:34 PM

Ok, I looked at it some more and have to revise my points.
First of all it isn't as easy as Begin/EndExecuteReader. You need to get to the interface which means using something like Get-Interface.
And then you would need to call SQLCommand.Cancel() in the finally section of a try-catch-finally.

1 - No speed improvement - You still need to wait for the query to complete before you can access any of the result sets.
2 - Cancel is still possible. CTRL-C would be able to work and it would cancel the query on the SQL Server.
3 - Could make InfoMessages have a datetime close to when they happened.

TTRider wrote Aug 16, 2010 at 9:13 PM

I need to investigate how to make it work the most reliable way.

wrote Feb 13, 2013 at 2:21 AM