public FileSystemTask( Packages.VulcanPackage vulcanPackage, string name, string taskDescription, DTS.IDTSSequence parentContainer, string sourceConnection, string destConnection, Microsoft.SqlServer.Dts.Tasks.FileSystemTask.DTSFileSystemOperation operation ) : base(vulcanPackage, name, taskDescription, parentContainer) { Connection source = new Connection(vulcanPackage, sourceConnection, sourceConnection, "FILE",String.Format("\"{0}\"",ExpressionPathBuilder.EscapeBackslashes(sourceConnection))); Connection dest = new Connection(vulcanPackage, destConnection, destConnection, "FILE",String.Format("\"{0}\"",ExpressionPathBuilder.EscapeBackslashes(destConnection))); source.SetProperty("FileUsageType", 2); dest.SetProperty("FileUsageType", 2); fileSystemTask = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:FileSystemTask"); fileSystemTask.Name = name; this.Task.Operation = operation; this.Task.Source = source.ConnectionManager.ID; this.Task.Destination = dest.ConnectionManager.ID; }
public SQLTask(Packages.VulcanPackage package, string name, string description, DTS.IDTSSequence parentContainer,Connection destinationConnection) : this(package, name, description, parentContainer, destinationConnection, null) { }
public OLEDBCommand( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string command ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { _oledbCom = dataFlowTask.ComponentMetaDataCollection.New(); _oledbCom.ComponentClassID = "DTSTransform.OLEDBCommand"; //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad. _oledbComI = _oledbCom.Instantiate(); _oledbComI.ProvideComponentProperties(); _oledbCom.Name = name; _oledbCom.Description = description; _oledbCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; _oledbCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); _oledbComI.SetComponentProperty("SqlCommand", command); dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _oledbCom.InputCollection[0] ); try { _oledbComI.AcquireConnections(null); _oledbComI.ReinitializeMetaData(); _oledbComI.ReleaseConnections(); } catch (System.Runtime.InteropServices.COMException ce) { Message.Trace(Severity.Error,ce,"OLEDBCommand: {3}: {2}: Source {0}: Command {1}", connection.ConnectionManager.Name, command, ce.Message, _oledbCom.GetErrorDescription(ce.ErrorCode)); } catch (Exception e) { Message.Trace(Severity.Error,e,"OLEDBCommand: {2}: Source {0}: Command {1}", connection.ConnectionManager.Name, command, e.Message); } AutoMap(); }
public ExecutePackageTask( Packages.VulcanPackage vulcanPackage, string name, string taskDescription, DTS.IDTSSequence parentContainer, Connection packageConnection ) : base(vulcanPackage, name, taskDescription, parentContainer) { executePackageTaskHost = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:ExecutePackageTask"); executePackageTaskHost.Name = name; Task.Connection = packageConnection.ConnectionManager.ID; }
public SQLTask(Packages.VulcanPackage package, string name, string description, DTS.IDTSSequence parentContainer, Connection destinationConnection, Dictionary<string,object> propertiesDictionary) : base(package, name, description, parentContainer) { this._expressionBuilder = new Vulcan.Common.Helpers.ExpressionPathBuilder(package); _sqlTask = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:SQLTask"); _sqlTask.Name = name; _sqlTask.Description = description; SetProperties(propertiesDictionary); if (destinationConnection != null) { SetProperty("Connection", destinationConnection.ConnectionManager.Name); } }
public TermLookup( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, bool isCaseSensitive, string refTermColumn, string refTermTable ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { TermLookupCom = dataFlowTask.ComponentMetaDataCollection.New(); TermLookupCom.ComponentClassID = "DTSTransform.TermLookup"; TermLookupComI = TermLookupCom.Instantiate(); TermLookupComI.ProvideComponentProperties(); TermLookupCom.Name = name; TermLookupCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; TermLookupCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); TermLookupComI.SetComponentProperty("IsCaseSensitive", isCaseSensitive); TermLookupComI.SetComponentProperty("RefTermColumn", refTermColumn); TermLookupComI.SetComponentProperty("RefTermTable", refTermTable); TermLookupCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_IgnoreFailure; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], TermLookupCom.InputCollection[0] ); TermLookupComI.AcquireConnections(null); TermLookupComI.ReinitializeMetaData(); TermLookupComI.ReleaseConnections(); }
public Lookup( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string query ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { lookupCom = dataFlowTask.ComponentMetaDataCollection.New(); lookupCom.ComponentClassID = "DTSTransform.Lookup"; lookupComI = lookupCom.Instantiate(); lookupComI.ProvideComponentProperties(); lookupCom.Name = name; lookupCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; lookupCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); lookupComI.SetComponentProperty("SqlCommand", query); lookupCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_IgnoreFailure; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], lookupCom.InputCollection[0] ); lookupComI.AcquireConnections(null); lookupComI.ReinitializeMetaData(); lookupComI.ReleaseConnections(); }
public override void Emit(XPathNavigator patternNavigator) { if (patternNavigator != null) { ExpressionPathBuilder epb = new ExpressionPathBuilder(VulcanPackage); string relativePath = patternNavigator.SelectSingleNode("@RelativePath").Value; string expression = epb.BuildRelativeExpression( "varRootDir", relativePath ); relativePath = relativePath.Replace(Path.DirectorySeparatorChar, '_'); relativePath = relativePath.Replace('.', '_'); Connection c = new Connection(VulcanPackage, relativePath, relativePath, "FILE",expression); ExecutePackageTask ept = new ExecutePackageTask(VulcanPackage, relativePath, relativePath, ParentContainer, c); this.FirstExecutableGeneratedByPattern = ept.TaskHost; this.LastExecutableGeneratedByPattern = ept.TaskHost; } }
public OLEDBDestination( Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string tableName ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { //remove duplicates if you happen to enclose the table in brackets :) _oledbDest = dataFlowTask.ComponentMetaDataCollection.New(); _oledbDest.ComponentClassID = "DTSAdapter.OleDbDestination.1"; _oledbDestI = _oledbDest.Instantiate(); _oledbDestI.ProvideComponentProperties(); _oledbDest.Name = Resources.OLEDBDestinationNamePrefix + (tableName.Replace("[", "").Replace("]", "").Replace("dbo", "").Replace(".","")); _oledbDest.ValidateExternalMetadata = true; _oledbDest.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90( connection.ConnectionManager ); _oledbDest.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _oledbDest.InputCollection[0] ); }
public Connection AddConnection(string connectionType, Dictionary<string, object> properties, Dictionary<string, string> expressions) { //empty string is ok for the componentName Connection connection = new Connection( this, properties["Name"].ToString(), properties["Description"].ToString(), connectionType, null ); connection.SetProperties(properties); connection.SetExpressions(expressions); return connection; }
public FTPTask( Packages.VulcanPackage vulcanPackage, string name, string taskDescription, DTS.IDTSSequence parentContainer, string serverName, string port, string userName, string password, string remotePath, bool isRemotePathVariable, string localPath, bool isLocalPathVariable, Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp operation ) : base(vulcanPackage, name, taskDescription, parentContainer) { fTPTask = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:FTPTask"); fTPTask.Name = name; fTPTask.Description = taskDescription; this.Task.Operation = operation; this.Task.IsRemotePathVariable = isRemotePathVariable; this.Task.IsLocalPathVariable = isLocalPathVariable; Connection fTPServerConnection = new Connection(vulcanPackage, serverName, serverName, "FTP", String.Format("\"{0}:{1}\"", serverName, port)); fTPServerConnection.SetProperty("ServerUserName", userName); fTPServerConnection.SetProperty("ServerPassword", password); this.Task.Connection = fTPServerConnection.ConnectionManager.ID; if (this.Task.IsRemotePathVariable == true) { this.Task.RemotePath = remotePath; } else { this.Task.RemotePath = remotePath; } if (this.Task.IsLocalPathVariable == true) { this.Task.LocalPath = localPath; } else { Connection localConnection = new Connection(vulcanPackage, localPath, localPath, "File", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(localPath))); int intFileUsageType = 2; switch (operation) { case Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp.Send: intFileUsageType = 0; break; case Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp.Receive: intFileUsageType = 2; break; default: intFileUsageType = 2; break; } localConnection.SetProperty("FileUsageType", intFileUsageType); this.Task.LocalPath = localPath; } }
public void TransmuteToFileTask(string sqlFileName) { string expression = _expressionBuilder.BuildRelativeExpression("varRootDir", VulcanPackage.ProjectSubpath,VulcanPackage.Name, sqlFileName); Connection c = new Connection(VulcanPackage,sqlFileName,sqlFileName,"File",expression); ExecuteSQLTask.SqlStatementSourceType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.SqlStatementSourceType.FileConnection; ExecuteSQLTask.SqlStatementSource = c.ConnectionManager.Name; }