Product Documentation

FairCom ADO.NET Driver - Developer's Guide

Previous Topic

Next Topic

Reading Blob Data

By default, the CtreeSqlDataReader loads incoming data as a row as soon as an entire row of data is available. Binary large objects (blobs) need different treatment, however, because they can contain gigabytes of data that cannot be contained in a single row.

When accessing the data in the blob field, use the GetBytes() or GetChars() typed accessors of the CtreeSqlDataReader object, which fill an array with data. You can also use GetString() for character data. However, to conserve system resources you might not want to load an entire blob value into a single string variable. You can instead specify a specific buffer size of data to be returned, and a starting location for the first byte or character to be read from the returned data. GetBytes() and GetChars() will return a long value, which represents the number of bytes or characters returned. If you pass a null array to GetBytes() or GetChars(), the long value returned will be the total number of bytes or characters in the blob. You can optionally specify an index in the array as a starting position for the data being read.

The FairCom DB SQL database has two different types of blob fields: LVARCHAR, that store long variable character data and LVARBINARY used to store an arbitrary number of binary bytes. You should consider using either CtreeSqlDataReader GetBytes() or GetChars() methods when reading LVARCHAR or LVARBINARY columns from a FairCom DB SQL database.

TOCIndex