PipelineBuffer.GetBlobData(Int32, Int32, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从列中存储 PipelineBuffer 的二进制大对象(BLOB)中获取字节数组。
public:
cli::array <System::Byte> ^ GetBlobData(int columnIndex, int offset, int count);
public byte[] GetBlobData(int columnIndex, int offset, int count);
member this.GetBlobData : int * int * int -> byte[]
Public Function GetBlobData (columnIndex As Integer, offset As Integer, count As Integer) As Byte()
参数
- columnIndex
- Int32
包含BLOB的列的索引。
- offset
- Int32
BLOB中开始从BLOB中获取字节的节点。
- count
- Int32
从BLOB中检索的字节数。
返回
Byte[]
列中的 PipelineBuffer 字节数组。
示例
以下示例从一 PipelineBuffer 列检索整个字节数组。
public override void ProcessInput(int inputID, PipelineBuffer buffer)
{
IDTSInput100 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);
foreach (IDTSInputColumn100 col in input.InputColumnCollection)
{
int index = BufferManager.FindColumnByLineageID(input.Buffer, col.LineageID);
BufferColumn bc = buffer.GetColumnInfo(index);
if (bc.DataType == DataType.DT_IMAGE)
{
uint blobLength = buffer.GetBlobLength(index);
byte [] blobBytes = buffer.GetBlobData(index, 0, (int)blobLength);
//TODO: Do something with the blob data.
}
}
}
Public Overrides Sub ProcessInput(ByVal inputID As Integer, ByVal buffer As PipelineBuffer)
Dim input As IDTSInput100 = ComponentMetaData.InputCollection.GetObjectByID(inputID)
For Each col As IDTSInputColumn100 In input.InputColumnCollection
Dim index As Integer = BufferManager.FindColumnByLineageID(input.Buffer, col.LineageID)
Dim bc As BufferColumn = buffer.GetColumnInfo(index)
If bc.DataType = DataType.DT_IMAGE Then
Dim blobLength As System.UInt32 = buffer.GetBlobLength(index)
Dim blobBytes As Byte() = buffer.GetBlobData(index, 0, CType(blobLength, Integer))
'TODO: Do something with the blob data
End If
Next
End Sub
注解
该方法适用于以下集成服务数据类型:
当从包含 BLOB 的列(如 DT_IMAGE,)检索数据PipelineBuffer时,你指定 BLOB offset 的起始位置和参数中count要检索的字节数。
有关集成服务数据类型的完整列表以及该类中用于各类型的对应Get和Set方法PipelineBuffer,请参见“在数据流中与数据类型工作”。