共用方式為


PipelineBuffer.GetBlobData 方法

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

命名空間:  Microsoft.SqlServer.Dts.Pipeline
組件:  Microsoft.SqlServer.PipelineHost (在 Microsoft.SqlServer.PipelineHost.dll 中)

語法

'宣告
Public Function GetBlobData ( _
    columnIndex As Integer, _
    offset As Integer, _
    count As Integer _
) As Byte()
'用途
Dim instance As PipelineBuffer 
Dim columnIndex As Integer 
Dim offset As Integer 
Dim count As Integer 
Dim returnValue As Byte()

returnValue = instance.GetBlobData(columnIndex, _
    offset, count)
public byte[] GetBlobData(
    int columnIndex,
    int offset,
    int count
)
public:
array<unsigned char>^ GetBlobData(
    int columnIndex, 
    int offset, 
    int count
)
member GetBlobData : 
        columnIndex:int * 
        offset:int * 
        count:int -> byte[] 
public function GetBlobData(
    columnIndex : int, 
    offset : int, 
    count : int
) : byte[]

參數

  • columnIndex
    型別:System.Int32
    The index of the column containing the BLOB.
  • offset
    型別:System.Int32
    The point in the BLOB to begin retrieving bytes from the BLOB.
  • count
    型別:System.Int32
    The number of bytes to retrieve from the BLOB.

傳回值

型別:array<System.Byte[]
The array of bytes in the PipelineBuffer column.

備註

This method works with the following Integration Services data types:

When retrieving data from PipelineBuffer columns containing a BLOB, such as a DT_IMAGE, you specify the starting location in the BLOB with the offset parameter and the number of bytes to retrieve in the count parameter.

For a complete list of Integration Services data types and the corresponding Get and Set methods of the PipelineBuffer class to use with each type, see 使用資料流程中的資料類型.

範例

The following example retrieves the entire array of bytes from a PipelineBuffer column.

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

請參閱

參考

PipelineBuffer 類別

Microsoft.SqlServer.Dts.Pipeline 命名空間