You can retrieve a binary large object (BLOB) in various ways. You can use DBTYPE_BYTES to retrieve the BLOB as a sequence of bytes or use an interface like ISequentialStream. For more information, see
The following code shows how to retrieve a BLOB using ISequentialStream. The macro
| В | Copy Code |
|---|---|
class CCategories
{
public:
ISequentialStream* pPicture;
BEGIN_COLUMN_MAP(CCategories)
BLOB_ENTRY(4, IID_ISequentialStream, STGM_READ, pPicture)
END_COLUMN_MAP()
};
CTable<CAccessor<CCategories> > categories;
ULONG cb;
BYTE myBuffer[65536];
categories.Open(session, "Categories");
while (categories.MoveNext() == S_OK)
{
do
{
categories.pPicture->Read(myBuffer, 65536, &cb);
// Do something with the buffer
} while (cb > 0);
categories.pPicture->Release();
} | |
For more information about macros that handle BLOB data, see "Column Map Macros" in
Dhtml editor
Free javascript download