Export (0) Print
Expand All
Expand Minimize

PipelineComponent.PreExecute Method

Called after PrepareForExecute, and before PrimeOutput and ProcessInput.

Namespace:  Microsoft.SqlServer.Dts.Pipeline
Assembly:  Microsoft.SqlServer.PipelineHost (in Microsoft.SqlServer.PipelineHost.dll)

public virtual void PreExecute()

Component developers should factor as much functionality into PreExecute as possible because it is called one time per component instead of one time per buffer for ProcessInput. Components should locate the indexes of its input and output columns in the PipelineBuffer by calling the FindColumnByLineageID method of the BufferManager.

The following example shows how to locate the column indexes of the columns in the InputColumnCollection. They are stored in a local variable and then used in ProcessInput to access the columns in the 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.
            }
        }
    }
}
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft