SDAC and FastReport 4

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
LHSoft
Posts: 104
Joined: Sat 18 Aug 2012 08:33

SDAC and FastReport 4

Post by LHSoft » Thu 30 May 2013 23:42

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

LHSoft
Posts: 104
Joined: Sat 18 Aug 2012 08:33

Re: SDAC and FastReport 4

Post by LHSoft » Fri 31 May 2013 10:21

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

AndreyZ

Re: SDAC and FastReport 4

Post by AndreyZ » Fri 31 May 2013 13:17

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.

Post Reply