All,
Sean and I have updated the SqlTask to fix some logic when executing SQL Server scripts from a file. The existing task caused problems when you have a script like this:
declare @userName varchar(30)
SELECT @userName = 'sa'
EXEC sp_who @userName
GO
declare @userName varchar(30)
SELECT @userName = 'sa'
EXEC sp_who @userName
GO
We could only get it to execute each line as a separate batch, which would give us errors stating that @userName was not defined, OR as a single batch causing errors that @userName was defined more than once.
So we enhance the logic to properly run scripts when line="true" and batch="false". The SqlStatementList class now reads everything until it reaches the delimiter and places everything into a single batch. The formatting and comments from the scripts are not stripped out in this mode.
Tasks - primarily added code to make verbose="true" actually do something
<<SqlTask.cs>>
Utils - exposed the Connection object in SqlHelper so informational messages and warnings could be consumed in the SqlTask class. Added logic to SqlStatementList to handle multi-line sql scripts that must be processed as a single batch.
<<SqlHelper.cs>> <<SqlStatementList.cs>>
Tests - added a couple tests for the "Line" style
<<SqlStatementListTests.cs>>
Regards,
Jay Turpin and Sean Demartino
SqlTask.cs
Description: Binary data
SqlHelper.cs
Description: Binary data
SqlStatementList.cs
Description: Binary data
SqlStatementListTests.cs
Description: Binary data