Icon View Incident Report

Serious Serious
Reported By: Roy Lambert
Reported On: 12/30/2007
For: Version 1.07 Build 1
# 2509 TBlobField.Clear Method Does Not Set Field to NULL

I think you have a problem. I've tried ReturnTableToMemo (below) with the destination field set to both BLOB and CLOB, but in both cases there's a problem. In EDBManager as a CLOB it looks empty, as a BLOB it says 0 Bytes. However, when running StreamMemoToTable (also below) the .IsNull test fails, it tries to restore the table from the field and fails with a 1003 error - the stream signature is invalid.

procedure ReturnTableToMemo(Fld: string; SrcTbl, DestTbl: TEDBTable);
var
ms: TMemoryStream;
WasEditing: boolean;
begin
ms := TMemoryStream.Create;
try
  WasEditing := (DestTbl.State in dsEditModes);
  if not WasEditing then GetRecordLock(DestTbl, 200);
  if SrcTbl.RecordCount > 0 then begin
   SrcTbl.SaveToStream(ms);
   TMemoField(DestTbl.FieldByName(Fld)).LoadFromStream(ms)
  end else DestTbl.FieldByName(Fld).Clear;
  if not WasEditing then DestTbl.Post;
finally
  ms.Free;
end;
end;

function StreamMemoToTable(Fld: string; SrcTbl: TEDBDataset;
DestTbl: TEDBTable; OpenExclusive: boolean = False): boolean;
var
ms: TMemoryStream;
begin
try
  DestTbl.Close;
  DestTbl.Exclusive := True;
  ClearTableDestTbll);
  DestTbl.Close;
  DestTbl.Exclusive := OpenExclusive;
  DestTbl.Open;
  if not SrcTbl.FieldByName(Fld).IsNull then begin
   ms := TMemoryStream.Create;
   try
    TMemoField(SrcTbl.FieldByName(Fld)).SaveToStream(ms);
    DestTbl.LoadFromStream(ms);
    DestTbl.Refresh;
    DestTbl.First;
   finally
    ms.Free;
   end;
  end;
  Result := True;
except
  Result := False;
end;
end;



Resolution Resolution
Fixed Problem on 12/31/2007 in version 1.07 build 2


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image