Главная страница | назад

Article #19254: Interbase, cached updates and Blob not found error

 Question and Answer Database

FAQ4254B.txt - Interbase, cached updates and Blob not found error

Category   :Database (InterBase)
Platform   :Win95/NT
Product    :All32Bit,   

My application is querying an Interbase table that contains blob fields and
I am using cached updates. I can do some editing of the blob fields but after 
editing a few records I begin to get the error 'BLOB NOT FOUND'. Why am I 
getting this error and what can I do to avoid it?

This issues arises because of the way that Interbase accesses blob fields. Interbase 
Blob handles are not guaranteed to stay consistent across transactions and therefore
the record buffer that is cached may contain a Blob handle that is no longer valid 
(BLOB NOT FOUND). There are a few workarounds you can try:

1. Use a live query instead of cached updates
2. Use a TTable instead of cached updates
3. Use MIDAS
4. Refresh the query after each post (not recommended--too expensive)
5. Force an update of all blob fields when posting:

Example of #5:

TForm1.Query1BeforePost(DataSet: TDataSet);
  i: Integer;
  temp: String;
  for i := 0 to Query1.FieldCount-1 do
    if (Query1.Fields[i].IsBlob) then
      temp := Query1.Fields[i].AsString;
      Query1.Fields[i].AsString := temp;

This will force an update of all blob fields and refresh their handles.

3/26/99 11:00:00 AM

Last Modified: 01-SEP-99