1

I'm using a blob field in a kbmMemTable to store a custom component that I've developed from TComponent and I use the read and write component stream methods of the TReader to read and write the component to the blob field. The data in the kbmMemTable is eventually stored inside a structured storage file created by GpStructuredStorage.

This has worked flawlessly, until I moved my component (along with the kbmMemtable) to a new application and tried to have the new application read the blob field. At first I was getting a component naming error (component name already exists), but later I started getting an Access Violation when the TReader tries to read a TPersistent property of my component.

As far as I know, I did not change anything with regards to the way I retrive the kbmMemTable data from the gpStructuredStorage file and the way I read the component back from the blob field using TReader. I've made no changes to the component and, I don't seem to have any problem with other components that I'm storing in other blob fields in the same table (at least I'm not getting any errors when they are read back).

I'm miffed at what could be the problem. Any help / suggestion would be greatly appreciated. I am using Delphi 2007.

menjaraz
  • 7,551
  • 4
  • 41
  • 81
golfur
  • 11
  • 2
  • How about formatting your question so that it isn't a wall of text? I am not inclined to attempt to read it in this form. – David Heffernan Jan 20 '11 at 19:18
  • try reproducing your problem in both applications by writing your TPersistent to a .dfm file, then reading that .dfm file back in. Then reduce your problem to the simplest TPersistent that will reproduce. Then re-ask your question with sample code. – Jeroen Wiert Pluimers Jan 20 '11 at 20:12

3 Answers3

1

Another guess. Your component name is collited with other/different one. To resolve this, always make your unit(s) after other thirst party ones: example:

from: SysUtils, YourUnitClass, Classes;
to: SysUtils, Classes, YourUnitClass;

and make sure to register your component

initialization
  RegisterClasses([TYourComponentClass]);

finalization
  UnRegisterClasses([TYourComponentClass]);

Gook luck

APZ28
  • 997
  • 5
  • 4
  • Thanks for your help. I do register my component in the initialization section of the unit where my component is declared - although I do not unregister the class. I will also check the unit order. – golfur Jan 21 '11 at 03:02
0

This is just a guess, but it sounds like the component class definition in the new application does not match that of the component that you're streaming.

0

I finally figured out what caused the streaming problem - although I am not sure why so perhaps someone can throw a light on this issue. I decided to check if the problem could be caused by some of the new 3rd party components I was using and lo and behold, when I disabled a skinning component (which was going to be an improvement in my new app!), everything worked as it should have. By disabling I mean I did not remove it from the program, I just made it so that the compressed skins were no longer used to paint the windows and the controls.

golfur
  • 11
  • 2