Export (0) Print
Expand All

PipelineBuffer Class

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

Object
  Microsoft.SqlServer.Dts.Pipeline::PipelineBuffer

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

[DefaultMemberAttribute(L"Item")]
public ref class PipelineBuffer : IDisposable

The PipelineBuffer type exposes the following members.

  NameDescription
Public propertyColumnCountGets the number of columns in the PipelineBuffer.
Public propertyColumnInfo
Public propertyCurrentRowGets the index of the current row in the PipelineBuffer.
Public propertyEndOfRowsetGets a value indicating whether the current PipelineBuffer is the final buffer.
Public propertyItemGets the data stored in a buffer column.
Public propertyModeGets a value indicating whether a PipelineBuffer is an IDTSInput100 buffer or an IDTSOutput100 buffer.
Public propertyRowCountGets the number of rows in the PipelineBuffer object.
Public propertyRowSize
Public propertyRowStarts
Top

  NameDescription
Public methodAddBlobData(Int32, array<Byte>)Adds an array of bytes to a PipelineBuffer column.
Public methodAddBlobData(Int32, array<Byte>, Int32)Adds an array of a specified number of bytes to a PipelineBuffer column.
Public methodAddRowAdds a row to the PipelineBuffer object.
Public methodDirectErrorRow(Int32, Int32, Int32)Sends a PipelineBuffer row to an IDTSOutput100 whose IsErrorOut property is true.
Public methodDirectErrorRow(Int32, Int32, Int32, Int32)Sends a PipelineBuffer row to an IDTSOutput100 whose IsErrorOut property is true.
Public methodDirectRowSends a row from a PipelineBuffer to the specified IDTSOutput100.
Public methodDispose()Releases all resources used by the PipelineBuffer.
Protected methodDispose(Boolean)Releases the unmanaged resources that are used by the PipelineBuffer, and optionally releases the managed resources.
Public methodEquals (Inherited from Object.)
Protected methodFinalizeReleases all resources used by the PipelineBuffer. (Overrides ObjectFinalize.)
Public methodGetBlobDataRetrieves an array of bytes from a binary large object (BLOB) stored in a PipelineBuffer column.
Public methodGetBlobLengthGets the number of bytes contained in a binary large object (BLOB) PipelineBuffer column.
Public methodGetBooleanGets the bool value stored in the PipelineBuffer column.
Public methodGetByteGets the byte value stored in the PipelineBuffer column.
Public methodGetBytesGets the array of bytes stored in a buffer column.
Public methodGetColumnInfoRetrieves the BufferColumn structure for a PipelineBuffer column.
Public methodGetDateGets the DateTime value stored in the PipelineBuffer column.
Public methodGetDateTimeGets the DateTime value stored in the PipelineBuffer column.
Public methodGetDateTimeOffsetGets the DateTimeOffset value stored in the PipelineBuffer column.
Public methodGetDecimalGets the decimal value stored in the PipelineBuffer column.
Public methodGetDoubleGets the double stored in the PipelineBuffer column.
Public methodGetGuidGets the Guid value stored in the PipelineBuffer column.
Public methodGetHashCode (Inherited from Object.)
Public methodGetInt16Gets the short stored in the PipelineBuffer column.
Public methodGetInt32Gets the int stored in a PipelineBuffer column.
Public methodGetInt64Gets the long stored in the PipelineBuffer column.
Public methodGetSByteGets the SByte value stored in a PipelineBuffer column.
Public methodGetSingleGets the float stored in a PipelineBuffer column.
Public methodGetStringGets the string stored in the buffer column.
Public methodGetTimeGets the TimeSpan value stored in the PipelineBuffer column.
Public methodGetType (Inherited from Object.)
Public methodGetUInt16Gets the ushort value stored in the buffer column.
Public methodGetUInt32Gets the UInt32 value stored in the buffer column.
Public methodGetUInt64Gets the ulong value stored in the buffer column.
Public methodIsNullChecks to see if the data in a buffer column is null.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodNextRowAdvances the PipelineBuffer to the next row.
Public methodRemoveRowRemoves the current row from the PipelineBuffer.
Public methodResetBlobDataDeletes the contents of the specified BLOB column.
Public methodSetBooleanAssigns a bool value to a PipelineBuffer column.
Public methodSetByteAssigns a byte to a PipelineBuffer column.
Public methodSetBytesAssigns an array of bytes to a buffer column.
Public methodSetDateAssigns a DateTime value to the PipelineBuffer column.
Public methodSetDateTimeAssigns a DateTime value to the PipelineBuffer column.
Public methodSetDateTimeOffsetAssigns a DateTimeOffset value to the PipelineBuffer column.
Public methodSetDecimalAssigns a decimal to a buffer column.
Public methodSetDoubleAssigns a double to a PipelineBuffer column.
Public methodSetEndOfRowsetNotifies the PipelineBuffer that a component has finished adding rows to the buffer.
Public methodSetErrorInfoSets the error information for the current PipelineBuffer row.
Public methodSetGuidAssigns a Guid to a buffer column.
Public methodSetInt16Assigns a 16-bit signed integer to a buffer column.
Public methodSetInt32Assigns a 32-bit signed integer to a buffer column.
Public methodSetInt64Assigns a 64-bit signed integer to a buffer column.
Public methodSetNullAssigns nullptr to a buffer column.
Public methodSetSByteAssigns a signed 8-bit integer to a buffer column.
Public methodSetSingleAssigns a float to a buffer column.
Public methodSetStringAssigns a string to a buffer column.
Public methodSetTimeAssigns a TimeSpan value to the PipelineBuffer column.
Public methodSetUInt16Assigns an unsigned 16-bit integer to a buffer column.
Public methodSetUInt32Assigns an unsigned 32-bit integer to a buffer column.
Public methodSetUInt64Assigns an unsigned 64-bit integer to a buffer column.
Public methodToString (Inherited from Object.)
Top

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.

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();
      }
   }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft