The Schema collections return metadata for the Advanced SQL Engine objects. The notable metadata columns for the BLOB data type are:
Column Name | Description |
---|---|
COLUMN_TYPE or DATA_TYPE |
Set to BLOB. |
CHARACTER_OCTET_LENGTH | Returns the maximum length of the column in Bytes. |
PROVIDERDBTYPE | It is set to TdType.Blob. |
The TdDataReader.SchemaTable returns result set metadata. The notable metadata columns for the Blob data type are:
Column Name | Description |
---|---|
ColumnSize | Returns the maximum length of the column in Bytes. |
DataType | System.Type object for the System.Byte[] type. |
ProviderType | Set to TdType.Blob. |
Format | Format assigned to the SQL Engine object. |
ProviderSpecificDataType | System.Type object for the TdBlob class. |
The following example shows how to configure a Blob parameter using DbType type declaration, Size property and a BCL value.
C# |
Copy Code |
---|---|
TdParameter customerPicture = new TdParameter(); customerPicture.ParameterName = "customerPicture"; customerPicture.DbType = DbType.Binary; customerPicture.Size = 64001; customerPicture.Value = customerPictureBuffer; |
![]() |
---|
The Data Provider maps DbType.Binary to the SQL Engine VarByte Data Type when Size is less than or equal to 64,000 Bytes. The Data Provider maps DbType.Binary to the SQL Engine BLOB Data Type when Size is greater than 64,000. |
The following example shows how to configure a Blob parameter using TdType type declaration and a BCL value.
C# |
Copy Code |
---|---|
TdParameter customerPicture = new TdParameter(); customerPicture.ParameterName = "customerPicture"; customerPicture.TdType = TdType.Clob; customerPicture.Value = customerPictureBuffer; |
The TdParameter.Value should be set to an Array of Bytes (Char[]) or an instance of System.IO.Stream.
The TdParameter.Size property must be set to a number greater than Zero for InputOutput or Output Parameters. The Data Provider will throw an exception when TdParameter.Direction property is set to ParameterDirection.Output or ParameterDirection.InputOutput and TdParameter.Size property is set to Zero. The TdParameter.Size property specifies the maximum number of Bytes the Data Provider will send to the SQL Engine and/or will receive from the SQL Engine. We recommend to set the TdParameter.Size property to the corresponding SQL Engine object size (e.g. Column or Stored Procedure Parameter size) for Input, InputOutput or Output parameters.
The following methods and properties return the column value as a System.Byte[] object.
The following methods and properties return the column or parameter value as a TdBlob class.
![]() |
---|
The CommandBehavior (see TdCommand.ExecuteReader(CommandBehavior)) must not include CommandBehavior.SequentialAccess. |
The following method returns the column or parameter value as a System.Stream object.
![]() |
---|
The CommandBehavior.SequentialAccess can potentially result in best overall performance. However in this mode BLOB data type cannot be transformed to TdBlob or Stream class. The CommandBehavior.SequentialAccess reduces the overall messages between the Data Provider and the SQL Engine because LOBs are transmitted to the Data Provider in Inline-mode. |
Accessor Methods for Retrieving Data
Configuring Parameters and Parameter Data Types