Send feedback on this topic.
Teradata.Client.Provider
TdBlob Class
Members  Example 



Teradata.Client.Provider Namespace : TdBlob Class
TdBlob represents a BLOB (Binary Large Object) data type instance. It is used to retrieve a BLOB from the Advanced SQL Engine.
Object Model
TdBlob ClassTdStream ClassTdBlob Class
Syntax
'Declaration
 
Public NotInheritable Class TdBlob 
   Inherits System.MarshalByRefObject
   Implements System.Data.SqlTypes.INullableSystem.ICloneableSystem.IDisposable 
'Usage
 
Dim instance As TdBlob
Remarks

TdBlob does not expose any public constructor. It's primary purpose is to retrieve BLOB data from the SQL Engine.

In order to create an instance of TdBlob, TdDataReader.GetTdBlob method must be called when the data contained in a BLOB column is to be retrieved.

When a TdBlob is created, the provider will open a request on the existing connection. This request is separate and independent from the request that was opened to process the query. The SQL Engine has a maximum number of open requests that it can support per connection. The limit is 16.

It is important that TdBlob.Close or TdBlob.Dispose is called after the TdBlob has been used to process the BLOB. This will free up the resources and the request that was used to retrieve the BLOB from the SQL Engine. After a TdBlob is disposed, an application can only call the Close, Dispose or the IsClosed. All other methods and properties will throw a ObjectDisposedException exception.

A TdBlob instance can only be created when the BLOB data is retrieved using deferred mode. This allows the data to be streamed from the SQL Engine to the Data Provider, and allows an application to retrieve the data in chunks from one or more LOBs.

BLOB data is returned using deferred mode when Data.CommandBehavior.SequentialAccess has not been specified in the call to TdCommand.ExecuteReader.

TdBlob.BaseStream returns a stream. An application can read primitive .NET Framework data types from a TdStream using a IO.BinaryReader. TdStream does not support seeking.

Example
The following example returns a TdBlob representing a picture.
public void DisplayEmployeePicture(String employeeId, TdConnection cn)
{
    TdCommand cmd = new TdCommand(“Select Pic from Employee Where ID = ?”, cn);
            
    // Initialize the parameter with employee ID.
    TdParameter id = cmd.CreateParameter();
    id.ParameterName = “EmployeeID”;
    id.Direction = System.Data.ParameterDirection.Input;
    id.Value = employeeId;
    
    cmd.Parameters.Add(id);
            
    // Execute the query. 
    using (TdDataReader reader = cmd.ExecuteReader())
    {
        if (reader.Read())
        {
            using (TdBlob pic = reader.GetTdBlob(0))
            {
                DisplayPicture(pic);
            }
        }
            
    }
            
    cmd.Dispose();
}
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      Teradata.Client.Provider.TdBlob

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdBlob Members
Teradata.Client.Provider Namespace
TdStream Class