Page 1 of 1

SDAC and FastReport 4

Posted: Thu 30 May 2013 23:42
by LHSoft
Hello,

I have very very strange behavior of the frxQuery, when setting or reading property SQL.

This is your code in frxDACComponents.pas:

Code: Select all

function TfrxDACQuery.GetSQL: Tstrings;
var
  i: Integer;
begin
  AssignStrings(FSQL, FQuery.SQL);
  Result := FSQL;
end;

procedure TfrxDACQuery.SetSQL(Value: Tstrings);
begin
  AssignStrings(FQuery.SQL, Value);
end;
So, your definition of AssignStrings is (Source, Destination).
Therefore, both functions should be wrong, they should be:

Code: Select all

function TfrxDACQuery.GetSQL: Tstrings;
var
  i: Integer;
begin
  AssignStrings(FQuery.SQL, FSQL);
  Result := FSQL;
end;

procedure TfrxDACQuery.SetSQL(Value: Tstrings);
begin
  AssignStrings(Value, FQuery.SQL);
end;
If I change both I get an stack overflow, if I change only SetSQL I can set the SQL Query and display data, but can not read the SQL Statement (of course).

So, please, can you tell me, why there is an stack overflow when changing both? Is there any other place in source it is corresponding with?

Best regards
Hans

Re: SDAC and FastReport 4

Posted: Fri 31 May 2013 10:21
by LHSoft
Now I have a working solution, I can set and read frxSDACQuery within fastscript:
Change code in frxDACComponents.pas to following:

Code: Select all

function TfrxDACQuery.GetSQL: Tstrings;
begin
  Result := FQuery.SQL;
end;

procedure TfrxDACQuery.SetSQL(Value: Tstrings);
begin
  AssignStrings(Value, FQuery.SQL);
end;
Without this there is following behavior:
frxSDACQuery.SQL := Memo.Lines
changes memo.Lines to frxSDACQuery.SQL and revers, so you never can set an SQLStatement within fastscript.
Using AssignStrings in GetSQL causes a stack overflow in frxXMLSerializer.pas. Don't know why.
@Devart: Maybe you can check my Solution if its correct?

regards
Hans

Re: SDAC and FastReport 4

Posted: Fri 31 May 2013 13:17
by AndreyZ
Thank you for the information. The correct code is the following:

Code: Select all

function TfrxDACQuery.GetSQL: Tstrings;
begin
  Result := FQuery.SQL;
end;

procedure TfrxDACQuery.SetSQL(Value: Tstrings);
begin
  AssignStrings(Value, FQuery.SQL);
end;
This fix will be included in the next SDAC build.