OpenSource » Database Migrator » Legacy Migrator
Clone URL:  

Migrator Added SMO batch executer to handle "GO"

Changeset 17de8d3def74

Parent d9edefcfe934

by Kiran Kafle

Changes to 5 files · Browse files at 17de8d3def74 Showing diff from parent d9edefcfe934 Diff from another changeset...

 
46
47
48
 
 
 
 
 
 
 
 
 
49
50
51
 
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@@ -46,6 +46,15 @@
  <DocumentationFile>bin\Migrator\Release\Migrator.XML</DocumentationFile>   </PropertyGroup>   <ItemGroup> + <Reference Include="Microsoft.SqlServer.ConnectionInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"> + <HintPath>..\..\lib\Microsoft.SqlServer.ConnectionInfo.dll</HintPath> + </Reference> + <Reference Include="Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"> + <HintPath>..\..\lib\Microsoft.SqlServer.Management.Sdk.Sfc.dll</HintPath> + </Reference> + <Reference Include="Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"> + <HintPath>..\..\lib\Microsoft.SqlServer.Smo.dll</HintPath> + </Reference>   <Reference Include="MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">   <HintPath>..\..\lib\MySql.Data.dll</HintPath>   <Private>True</Private>
 
674
675
676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
678
679
 
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
@@ -674,6 +674,21 @@
  }   }   + /// <summary> + /// This method can execute commands with "GO" separator + /// </summary> + /// <param name="sql"></param> + /// <returns></returns> + public virtual int ExecuteMSSQLBatch(string sql) + { + this.Logger.Trace(sql); + using (var connection = new System.Data.SqlClient.SqlConnection(this.ConnectionString)) + { + var server = new Microsoft.SqlServer.Management.Smo.Server(new Microsoft.SqlServer.Management.Common.ServerConnection(connection)); + return server.ConnectionContext.ExecuteNonQuery(sql); + } + } +   /// <summary>   /// Execute a raw SQl statement that will not produce a result set (e.g. Update, Insert, Delete etc.)   /// </summary>