Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Technical Reference
 GetBlobData Method
Other versions are also available for the following:
PipelineBuffer.GetBlobData Method

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

Namespace: Microsoft.SqlServer.Dts.Pipeline
Assembly: Microsoft.SqlServer.PipelineHost (in microsoft.sqlserver.pipelinehost.dll)
Visual Basic (Declaration)
Public Function GetBlobData ( _
    columnIndex As Integer, _
    offset As Integer, _
    count As Integer _
) As Byte()
C#
public byte[] GetBlobData (
    int columnIndex,
    int offset,
    int count
)
C++
public:
array<unsigned char>^ GetBlobData (
    int columnIndex, 
    int offset, 
    int count
)
J#
public byte[] GetBlobData (
    int columnIndex, 
    int offset, 
    int count
)
JScript
public function GetBlobData (
    columnIndex : int, 
    offset : int, 
    count : int
) : byte[]

Parameters

columnIndex

The index of the column containing the BLOB.

offset

The point in the BLOB to begin retrieving bytes from the BLOB.

count

The number of bytes to retrieve from the BLOB.

Return Value

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 Working with Data Types in the Data Flow.


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

C#
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.

      }
   }
}

Visual Basic
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
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.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker