Icon View Incident Report

Serious Serious
Reported By: Simon Page
Reported On: 4/18/2005
For: Version 4.19 Build 1
# 2030 Using Calculated Field with Live Query Result Set with Expression Columns Can Cause Stack Overflow

Using v4.18 or v4.19 we have found a problem with using a calculated field in a query that also has expression fields - the result is a stack overflow.

procedure TForm1.Button1Click(Sender: TObject);
begin
  DBISAMQuery1.Open;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  DBISAMQuery1.Edit;
  //stack overflow if calculated field
  DBISAMQuery1.FieldByName('FirstName').AsString := '123';
  DBISAMQuery1.Post;
end;

procedure TForm1.Button3Click(Sender: TObject);

  procedure AddStringField(const Name: string; Size: Integer);
  var
    Field: TField;
  begin
    Field := TStringField.Create(DBISAMQuery1);
    Field.FieldName := Name;
    Field.Size := Size;
    Field.Calculated := True;
    Field.DataSet := DBISAMQuery1;
  end;

var
  I: Integer;
begin
  DBISAMQuery1.Close;
  DBISAMQuery1.FieldDefs.Update;
  for I := 0 to DBISAMQuery1.FieldDefs.Count - 1 do
     DBISAMQuery1.FieldDefs[I].CreateField(DBISAMQuery1);

  AddStringField('Calculated', 20);
  DBISAMQuery1.FieldDefs.Update;
end;

procedure TForm1.DBISAMQuery1CalcFields(DataSet: TDataSet);
begin
  DBISAMQuery1.FieldByName('Calculated').AsString := '123456';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FStartPath := ExtractFilePath(ParamStr(0));
  DBISAMQuery1.DatabaseName := FStartPath + 'Data';
end;



Resolution Resolution
Fixed Problem on 4/28/2005 in version 4.20 build 1


Products Affected Products Affected
DBISAM CLX Client-Server
DBISAM CLX Client-Server with Source
DBISAM CLX Standard
DBISAM CLX Standard with Source
DBISAM VCL Client-Server
DBISAM VCL Client-Server with Source
DBISAM VCL Standard
DBISAM VCL Standard with Source

Image