Sdílet prostřednictvím


PipelineBuffer Class

Definition

Provides an in-memory data store containing rows and columns of data.

public ref class PipelineBuffer : IDisposable
public class PipelineBuffer : IDisposable
type PipelineBuffer = class
    interface IDisposable
Public Class PipelineBuffer
Implements IDisposable
Inheritance
PipelineBuffer
Implements

Examples

The following example shows a transformation component that iterates the rows and columns of a PipelineBuffer in ProcessInput.

using System;  
using Microsoft.SqlServer.Dts;  
using Microsoft.SqlServer.Dts.Pipeline;  
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;  
using Microsoft.SqlServer.Dts.Runtime.Wrapper;  

namespace Microsoft.Samples.SqlServer.Dts  
{  
   [DtsPipelineComponent  
   (  
   DisplayName="SampleComponent",  
   ComponentType=ComponentType.Transform  
   )]  
   public class SampleComponent: PipelineComponent  
   {  
      public override void ProvideComponentProperties()  
      {  
         base.ProvideComponentProperties();  

         ///Name the input and output add by the base class.  
         ComponentMetaData.InputCollection[0].Name = "SampleInput";  
         ComponentMetaData.OutputCollection[0].Name = "SampleOutput";  
      }  

      public override void ProcessInput(int inputID, PipelineBuffer buffer)  
      {  

      IDTSInput100 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);  

      while (buffer.NextRow())  
      {  
         foreach (IDTSInputColumn100 col in input.InputColumnCollection)  
         {  
            int colIndex = BufferManager.FindColumnByLineageID(input.Buffer,col.LineageID);  
            object colData = buffer[colIndex];  
            //TODO: Do something with the column data.  
         }  
      }  
      }  
   }  
}  

The following example shows a source component that adds rows to the output buffer in PrimeOutput.

using System;  
using Microsoft.SqlServer.Dts;  
using Microsoft.SqlServer.Dts.Pipeline;  
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;  
using Microsoft.SqlServer.Dts.Runtime.Wrapper;  

namespace Microsoft.Samples.SqlServer.Dts  
{  
   [DtsPipelineComponent  
   (  
      DisplayName="SampleComponent",  
      ComponentType=ComponentType.SourceComponent  
)]  
   public class SampleComponent: PipelineComponent  
   {  
      public override void PrimeOutput(int outputs, int[] outputIDs,PipelineBuffer[] buffers)  
      {  
         int rows = 100;  
         PipelineBuffer buf = buffers[0];  
         IDTSOutput100 output = ComponentMetaData.OutputCollection[0];  
         Random rand = new Random();  

         //Loop rows number of times  
         for(int r = 0; r < rows; r++)  
         {  
            buf.AddRow();  
            foreach( IDTSOutputColumn100 col in output.OutputColumnCollection)  
            {  
               int colIndex = BufferManager.FindColumnByLineageID( output.Buffer, col.LineageID);  
               // Note, buffer columns containing binary large objects  
               // can not be set using the following syntax. Instead,  
               // the AddBlobData and SetBytes methods are used.  
               buf[colIndex] = rand.Next();  
            }  
         }  
         buf.SetEndOfRowset();  
      }  
   }  
}  

Remarks

The PipelineBuffer is an in-memory two-dimensional data store containing rows and columns. It is created by the data flow task and supplied to managed data flow components during execution. The columns contained in a buffer are based on the columns in the IDTSOutputColumnCollection100 collections of the components in the graph.

Source components and components with asynchronous outputs receive a buffer for each of the output objects that are connected to a downstream component. These buffers are referred to as output buffers and do not contain rows. The component that receives the output buffer adds rows to the buffer and calls the SetEndOfRowset method when finished. This method sets the value of the EndOfRowset property to true on the final buffer. The data flow task then provides that buffer to the next component in the graph.

Transformation components with synchronous outputs and destination components receive PipelineBuffer objects in the ProcessInput method. The PipelineBuffer received in this method is an Input buffer and contains the rows that were added to by upstream components. This buffer is restricted and cannot be used to add or remove rows from the buffer.

The PipelineBuffer is written in managed code and supports managed data flow component developers by marshalling data between managed code and the underlying IDTSBuffer100 COM object.

For a complete list of Integration Services data types and the corresponding Get and Set methods of the PipelineBuffer class to use with each data type, see Working with Data Types in the Data Flow.

Constructors

PipelineBuffer(IntPtr, PipelineBufferMode)

Instantiates a new instance of the PipelineBuffer.

PipelineBuffer(UInt32, UInt32, UInt64, IntPtr*, DTP_BUFFCOL*, Boolean)

Initializes a new instance of the PipelineBuffer class.

Properties

ColumnCount

Gets the number of columns in the PipelineBuffer.

ColumnInfo

Gets read-only metadata about the column.

CurrentRow

Gets the index of the current row in the PipelineBuffer.

EndOfRowset

Gets a value indicating whether the current PipelineBuffer is the final buffer.

Item[Int32]

Value of specified column in the current row

Mode

Gets a value indicating whether a PipelineBuffer is an IDTSInput100 buffer or an IDTSOutput100 buffer.

RowCount

Gets the number of rows in the PipelineBuffer object.

RowSize

Gets the size of row in the PipelineBuffer object.

RowStarts

Gets the starting point of the row.

Methods

AddBlobData(Int32, Byte[], Int32)

Adds an array of a specified number of bytes to a PipelineBuffer column.

AddBlobData(Int32, Byte[])

Adds an array of bytes to a PipelineBuffer column.

AddRow()

Adds a row to the PipelineBuffer object.

DirectErrorRow(Int32, Int32, Int32, Int32)

Sends a PipelineBuffer row to an IDTSOutput100 whose IsErrorOut property is true.

DirectErrorRow(Int32, Int32, Int32)

Sends a PipelineBuffer row to an IDTSOutput100 whose IsErrorOut property is true.

DirectRow(Int32)

Sends a row from a PipelineBuffer to the specified IDTSOutput100.

Dispose()

Releases all resources used by the PipelineBuffer.

Dispose(Boolean)

Releases the unmanaged resources that are used by the PipelineBuffer, and optionally releases the managed resources.

Finalize()

Releases all resources used by the PipelineBuffer.

GetBlobData(Int32, Int32, Int32)

Retrieves an array of bytes from a binary large object (BLOB) stored in a PipelineBuffer column.

GetBlobLength(Int32)

Gets the number of bytes contained in a binary large object (BLOB) PipelineBuffer column.

GetBoolean(Int32)

Gets the bool value stored in the PipelineBuffer column.

GetByte(Int32)

Gets the byte value stored in the PipelineBuffer column.

GetBytes(Int32)

Gets the array of bytes stored in a buffer column.

GetColumnInfo(Int32)

Retrieves the BufferColumn structure for a PipelineBuffer column.

GetDate(Int32)

Gets the DateTime value stored in the PipelineBuffer column.

GetDateTime(Int32)

Gets the DateTime value stored in the PipelineBuffer column.

GetDateTimeOffset(Int32)

Gets the DateTimeOffset value stored in the PipelineBuffer column.

GetDecimal(Int32)

Gets the decimal value stored in the PipelineBuffer column.

GetDouble(Int32)

Gets the double stored in the PipelineBuffer column.

GetGuid(Int32)

Gets the Guid value stored in the PipelineBuffer column.

GetInt16(Int32)

Gets the short stored in the PipelineBuffer column.

GetInt32(Int32)

Gets the int stored in a PipelineBuffer column.

GetInt64(Int32)

Gets the long stored in the PipelineBuffer column.

GetSByte(Int32)

Gets the SByte value stored in a PipelineBuffer column.

GetSingle(Int32)

Gets the float stored in a PipelineBuffer column.

GetString(Int32)

Gets the string stored in the buffer column.

GetTime(Int32)

Gets the TimeSpan value stored in the PipelineBuffer column.

GetUInt16(Int32)

Gets the ushort value stored in the buffer column.

GetUInt32(Int32)

Gets the UInt32 value stored in the buffer column.

GetUInt64(Int32)

Gets the ulong value stored in the buffer column.

IsNull(Int32)

Checks to see if the data in a buffer column is null.

NextRow()

Advances the PipelineBuffer to the next row.

RemoveRow()

Removes the current row from the PipelineBuffer.

ResetBlobData(Int32)

Deletes the contents of the specified BLOB column.

SetBoolean(Int32, Boolean)

Assigns a bool value to a PipelineBuffer column.

SetByte(Int32, Byte)

Assigns a byte to a PipelineBuffer column.

SetBytes(Int32, Byte[])

Assigns an array of bytes to a buffer column.

SetDate(Int32, DateTime)

Assigns a DateTime value to the PipelineBuffer column.

SetDateTime(Int32, DateTime)

Assigns a DateTime value to the PipelineBuffer column.

SetDateTimeOffset(Int32, DateTimeOffset)

Assigns a DateTimeOffset value to the PipelineBuffer column.

SetDecimal(Int32, Decimal)

Assigns a decimal to a buffer column.

SetDouble(Int32, Double)

Assigns a double to a PipelineBuffer column.

SetEndOfRowset()

Notifies the PipelineBuffer that a component has finished adding rows to the buffer.

SetErrorInfo(Int32, Int32, Int32)

Sets the error information for the current PipelineBuffer row.

SetGuid(Int32, Guid)

Assigns a Guid to a buffer column.

SetInt16(Int32, Int16)

Assigns a 16-bit signed integer to a buffer column.

SetInt32(Int32, Int32)

Assigns a 32-bit signed integer to a buffer column.

SetInt64(Int32, Int64)

Assigns a 64-bit signed integer to a buffer column.

SetNull(Int32)

Assigns null to a buffer column.

SetSByte(Int32, SByte)

Assigns a signed 8-bit integer to a buffer column.

SetSingle(Int32, Single)

Assigns a float to a buffer column.

SetString(Int32, String)

Assigns a string to a buffer column.

SetTime(Int32, TimeSpan)

Assigns a TimeSpan value to the PipelineBuffer column.

SetUInt16(Int32, UInt16)

Assigns an unsigned 16-bit integer to a buffer column.

SetUInt32(Int32, UInt32)

Assigns an unsigned 32-bit integer to a buffer column.

SetUInt64(Int32, UInt64)

Assigns an unsigned 64-bit integer to a buffer column.

Applies to