Page 1 of 1

Blobfield problem

Posted: Mon 27 Jul 2009 22:16
by barnie00
Hello!
Once again I have a problem.

I have a firebird 2.1 (embedded) DB with 2 Tables.
In every table there is a BLOB-Field used to store an OLE-object.

This is my code to paste a chemical structure formula into one of the ole container and into the database:

Code: Select all

if (UnitStructureOle->CanPaste && bReadOnly==false)
{
UnitStructureOle->Paste();
bSaveUnitBlob=true;
IBCQueryUnits->Edit();
DBEditUnitOleServer->Text=UnitStructureOle->OleClassName;
//
TStream * pUnitStr;
pUnitStr=IBCQueryUnits->CreateBlobStream(IBCQueryUnits->FieldByName("STRUCTURE"), bmWrite);
try
  {
  UnitStructureOle->SaveToStream(pUnitStr);
  }
catch (Exception &exception)
  {
  //
  }
pUnitStr->Free();
}
The same code with differnet compound names is used for the second ole container.
In 2nd container I can see the "image" but it is not stored in the database without exception or error message.

When I try to load the ole object from the database back in to the container with the following code:

Code: Select all

TStream * pUnitStr;
pUnitStr=IBCQueryUnits->CreateBlobStream(IBCQueryUnits->FieldByName("STRUCTURE"), bmRead);
try
  {
  UnitStructureOle->LoadFromStream(pUnitStr);
  }
catch (Exception &exception)
  {
  //
  }
pUnitStr->Free();
it works with the first container/blob field/table but not with the second one.
For the second one I get a stream exception.

Whats wrong here?
Thank you.

Posted: Mon 03 Aug 2009 07:56
by Plash
We could not reproduce the problem. Please send to ibdac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Please use a sample data in your test project. Don't use OLE objects.