PipelineBuffer Class
Provides an in-memory data store containing rows and columns of data.
命名空間: Microsoft.SqlServer.Dts.Pipeline
組件: Microsoft.SqlServer.PipelineHost (in microsoft.sqlserver.pipelinehost.dll)
語法
'宣告
<DefaultMemberAttribute("Item")> _
Public Class PipelineBuffer
Implements IDisposable
[DefaultMemberAttribute("Item")]
public class PipelineBuffer : IDisposable
[DefaultMemberAttribute(L"Item")]
public ref class PipelineBuffer : IDisposable
/** @attribute DefaultMemberAttribute("Item") */
public class PipelineBuffer implements IDisposable
DefaultMemberAttribute("Item")
public class PipelineBuffer implements IDisposable
備註
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 IDTSOutputColumnCollection90 collections of the components in the graph.
Source components and components with asynchronous outputs receive a buffer for each of the output objects that is 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. 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 IDTSBuffer90 COM object.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer
範例
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)
{
if (!buffer.EndOfRowset)
{
IDTSInput90 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);
while (buffer.NextRow())
{
foreach (IDTSInputColumn90 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];
IDTSOutput90 output = ComponentMetaData.OutputCollection[0];
Random rand = new Random();
//Loop rows number of times
for(int r = 0; r < rows; r++)
{
buf.AddRow();
foreach( IDTSOutputColumn90 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 Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
平台
開發平台
如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。
目標平台
如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。
請參閱
參考
PipelineBuffer Members
Microsoft.SqlServer.Dts.Pipeline Namespace