(0) exportieren Drucken
Alle erweitern
Dieser Artikel wurde noch nicht bewertet - Dieses Thema bewerten.

PipelineBuffer-Klasse

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

System..::..Object
  Microsoft.SqlServer.Dts.Pipeline..::..PipelineBuffer

Namespace:  Microsoft.SqlServer.Dts.Pipeline
Assembly:  Microsoft.SqlServer.PipelineHost (in Microsoft.SqlServer.PipelineHost.dll)
public class PipelineBuffer : IDisposable

Der PipelineBuffer-Typ macht folgende Elemente verfügbar.

  NameBeschreibung
Geschützte MethodePipelineBufferInstantiates a new instance of the PipelineBuffer.
Zum Anfang
  NameBeschreibung
Öffentliche EigenschaftColumnCountGets the number of columns in the PipelineBuffer.
Öffentliche EigenschaftCurrentRowGets the index of the current row in the PipelineBuffer.
Öffentliche EigenschaftEndOfRowsetGets a value indicating whether the current PipelineBuffer is the final buffer.
Öffentliche EigenschaftItemGets the data stored in a buffer column.
Öffentliche EigenschaftModeGets a value indicating whether a PipelineBuffer is an IDTSInput100 buffer or an IDTSOutput100 buffer.
Öffentliche EigenschaftRowCountGets the number of rows in the PipelineBuffer object.
Zum Anfang
  NameBeschreibung
Öffentliche MethodeAddBlobData(Int32, array<Byte>[]()[][])Adds an array of bytes to a PipelineBuffer column.
Öffentliche MethodeAddBlobData(Int32, array<Byte>[]()[][], Int32)Adds an array of a specified number of bytes to a PipelineBuffer column.
Öffentliche MethodeAddRowAdds a row to the PipelineBuffer object.
Öffentliche MethodeDirectErrorRow(Int32, Int32, Int32)Sends a PipelineBuffer row to an IDTSOutput100 whose IsErrorOut property is true.
Öffentliche MethodeDirectErrorRow(Int32, Int32, Int32, Int32)Sends a PipelineBuffer row to an IDTSOutput100 whose IsErrorOut property is true.
Öffentliche MethodeDirectRowSends a row from a PipelineBuffer to the specified IDTSOutput100.
Öffentliche MethodeDispose()()()()Releases all resources used by the PipelineBuffer.
Geschützte MethodeDispose(Boolean)Releases the unmanaged resources that are used by the PipelineBuffer, and optionally releases the managed resources.
Öffentliche MethodeEquals (Geerbt von Object.)
Geschützte MethodeFinalizeReleases all resources used by the PipelineBuffer. (Überschreibt Object..::..Finalize()()()().)
Öffentliche MethodeGetBlobDataRetrieves an array of bytes from a binary large object (BLOB) stored in a PipelineBuffer column.
Öffentliche MethodeGetBlobLengthGets the number of bytes contained in a binary large object (BLOB) PipelineBuffer column.
Öffentliche MethodeGetBooleanGets the bool value stored in the PipelineBuffer column.
Öffentliche MethodeGetByteGets the byte value stored in the PipelineBuffer column.
Öffentliche MethodeGetBytesGets the array of bytes stored in a buffer column.
Öffentliche MethodeGetColumnInfoRetrieves the BufferColumn structure for a PipelineBuffer column.
Öffentliche MethodeGetDateGets the DateTime value stored in the PipelineBuffer column.
Öffentliche MethodeGetDateTimeGets the DateTime value stored in the PipelineBuffer column.
Öffentliche MethodeGetDateTimeOffsetGets the DateTimeOffset value stored in the PipelineBuffer column.
Öffentliche MethodeGetDecimalGets the decimal value stored in the PipelineBuffer column.
Öffentliche MethodeGetDoubleGets the double stored in the PipelineBuffer column.
Öffentliche MethodeGetGuidGets the Guid value stored in the PipelineBuffer column.
Öffentliche MethodeGetHashCode (Geerbt von Object.)
Öffentliche MethodeGetInt16Gets the short stored in the PipelineBuffer column.
Öffentliche MethodeGetInt32Gets the int stored in a PipelineBuffer column.
Öffentliche MethodeGetInt64Gets the long stored in the PipelineBuffer column.
Öffentliche MethodeGetSByteGets the SByte value stored in a PipelineBuffer column.
Öffentliche MethodeGetSingleGets the float stored in a PipelineBuffer column.
Öffentliche MethodeGetStringGets the string stored in the buffer column.
Öffentliche MethodeGetTimeGets the TimeSpan value stored in the PipelineBuffer column.
Öffentliche MethodeGetType (Geerbt von Object.)
Öffentliche MethodeGetUInt16Gets the ushort value stored in the buffer column.
Öffentliche MethodeGetUInt32Gets the UInt32 value stored in the buffer column.
Öffentliche MethodeGetUInt64Gets the ulong value stored in the buffer column.
Öffentliche MethodeIsNullChecks to see if the data in a buffer column is null.
Geschützte MethodeMemberwiseClone (Geerbt von Object.)
Öffentliche MethodeNextRowAdvances the PipelineBuffer to the next row.
Öffentliche MethodeRemoveRowRemoves the current row from the PipelineBuffer.
Öffentliche MethodeResetBlobDataDeletes the contents of the specified BLOB column.
Öffentliche MethodeSetBooleanAssigns a bool value to a PipelineBuffer column.
Öffentliche MethodeSetByteAssigns a byte to a PipelineBuffer column.
Öffentliche MethodeSetBytesAssigns an array of bytes to a buffer column.
Öffentliche MethodeSetDateAssigns a DateTime value to the PipelineBuffer column.
Öffentliche MethodeSetDateTimeAssigns a DateTime value to the PipelineBuffer column.
Öffentliche MethodeSetDateTimeOffsetAssigns a DateTimeOffset value to the PipelineBuffer column.
Öffentliche MethodeSetDecimalAssigns a decimal to a buffer column.
Öffentliche MethodeSetDoubleAssigns a double to a PipelineBuffer column.
Öffentliche MethodeSetEndOfRowsetNotifies the PipelineBuffer that a component has finished adding rows to the buffer.
Öffentliche MethodeSetErrorInfoSets the error information for the current PipelineBuffer row.
Öffentliche MethodeSetGuidAssigns a Guid to a buffer column.
Öffentliche MethodeSetInt16Assigns a 16-bit signed integer to a buffer column.
Öffentliche MethodeSetInt32Assigns a 32-bit signed integer to a buffer column.
Öffentliche MethodeSetInt64Assigns a 64-bit signed integer to a buffer column.
Öffentliche MethodeSetNullAssigns nullNothingnullptrunitein NULL-Verweis (Nothing in Visual Basic) to a buffer column.
Öffentliche MethodeSetSByteAssigns a signed 8-bit integer to a buffer column.
Öffentliche MethodeSetSingleAssigns a float to a buffer column.
Öffentliche MethodeSetStringAssigns a string to a buffer column.
Öffentliche MethodeSetTimeAssigns a TimeSpan value to the PipelineBuffer column.
Öffentliche MethodeSetUInt16Assigns an unsigned 16-bit integer to a buffer column.
Öffentliche MethodeSetUInt32Assigns an unsigned 32-bit integer to a buffer column.
Öffentliche MethodeSetUInt64Assigns an unsigned 64-bit integer to a buffer column.
Öffentliche MethodeToString (Geerbt von Object.)
Zum Anfang

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 Verwenden von Datentypen im Datenfluss.

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();
      }
   }
}
Alle öffentlichen static (Shared in Visual Basic)-Elemente dieses Typs sind Threadsicher. Für Instanzelemente wird die Threadsicherheit nicht gewährleistet.
Fanden Sie dies hilfreich?
(1500 verbleibende Zeichen)
Vielen Dank für Ihr Feedback.

Community-Beiträge

HINZUFÜGEN
Microsoft führt eine Onlineumfrage durch, um Ihre Meinung zur MSDN-Website zu erfahren. Wenn Sie sich zur Teilnahme entscheiden, wird Ihnen die Onlineumfrage angezeigt, sobald Sie die MSDN-Website verlassen.

Möchten Sie an der Umfrage teilnehmen?
Anzeigen:
© 2014 Microsoft. Alle Rechte vorbehalten.