PipelineComponent.PreExecute 方法

定义

public:
 virtual void PreExecute();
public virtual void PreExecute ();
abstract member PreExecute : unit -> unit
override this.PreExecute : unit -> unit
Public Overridable Sub PreExecute ()

示例

以下示例演示如何在 中 InputColumnCollection查找列的列索引。 它们存储在局部变量中,然后在 中 ProcessInput 用于访问 中的 PipelineBuffer列。

int[] bufferColumnIndex;  
public override void PreExecute()  
{  
    IDTSInput100 input = ComponentMetaData.InputCollection[0];  
    bufferColumnIndex = new int[input.InputColumnCollection.Count];  
    for ( int x=0; x < input.InputColumnCollection.Count; x++)  
    {  
        bufferColumnIndex[x] = BufferManager.FindColumnByLineageID( input.Buffer, input.InputColumnCollection[x].LineageID);  
    }  
}  
public override void ProcessInput( int inputID, PipelineBuffer buffer )  
{  
    while( buffer.NextRow() )  
    {  
        for( int x=0; x < bufferColumnIndex.Length(); x++ )  
        {  
            if( !buffer.IsNull(bufferColumnIndex[x]))  
            {  
                // TODO: Access the column data.  
            }  
        }  
    }  
}  
Private bufferColumnIndex As Integer()   

Public Overrides Sub PreExecute()   
 Dim input As IDTSInput100 = ComponentMetaData.InputCollection(0)   
 bufferColumnIndex = New Integer(input.InputColumnCollection.Count - 1) {}   
 Dim x As Integer = 0   
 While x < input.InputColumnCollection.Count  
   bufferColumnIndex(x) = BufferManager.FindColumnByLineageID(input.Buffer, input.InputColumnCollection(x).LineageID)   
   x -= 1  
 End While   
End Sub   

Public Overrides Sub ProcessInput(ByVal inputID As Integer, ByVal buffer As PipelineBuffer)   
 While buffer.NextRow   
   Dim x As Integer = 0   
   While x < bufferColumnIndex.Length   
     If Not buffer.IsNull(bufferColumnIndex(x)) Then   
     End If   
     x -= 1  
   End While   
 End While   
End Sub  

注解

组件开发人员应尽可能多地考虑功能, PreExecute 因为每个组件调用一次,而不是为每个缓冲区调用 ProcessInput一次。 组件应通过调用 FindColumnByLineageID 的 方法在 中找到PipelineBuffer其输入和输出列的BufferManager索引。

适用于