TZParams compatibility Fastreport

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
ekhirs5a
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 02.07.2018, 15:35

TZParams compatibility Fastreport

Post by ekhirs5a »

it would be possible because of compatibility

TZParmas
property Bound: Boolean read FBound;

in TParams
property Bound: Boolean read FBound write FBound;


{ Bound should be True in design mode }

Code: Select all

  procedure frxParamsToZParams(Query: TfrxCustomQuery; Params: TZParams);
  var
    i: Integer;
    Item: TfrxParamItem;
  begin
    for i := 0 to Params.Count - 1 do
      if Query.Params.IndexOf(Params[i].Name) <> -1 then
      begin
        Item := Query.Params[Query.Params.IndexOf(Params[i].Name)];
        Params[i].Clear;
        Params[i].DataType := Item.DataType;
        { Bound should be True in design mode }
        if not (Query.IsLoading or Query.IsDesigning) then
          Params[i].Bound := False
        else
        begin
          if Item.Expression <> '' then
            Params[i].Value := 0;
          Params[i].Bound := True;
        end;

        if Trim(Item.Expression) <> '' then
          if not (Query.IsLoading or Query.IsDesigning) then
            if Query.Report <> nil then
            begin
              Query.Report.CurObject := Query.Name;
              Item.Value := Query.Report.Calc(Item.Expression);
            end;
        if not VarIsEmpty(Item.Value) then
        begin
          Params[i].Bound := True;
          if Params[i].DataType in [ftDate, ftTime, ftDateTime] then
            Params[i].Value := Item.Value
          else
            Params[i].Value := Item.Value;
        end;

      end;
  end;
	
Best regards,

Roland
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: TZParams compatibility Fastreport

Post by marsupilami »

Hello Roland,

I am not sure if it makes sense to make Bound writable. Zeos doesn't do anything with this information. This probably is why EgonHugeist made it Read Only. From a Zeos Point of View you just could skip writing to bound.

If we make bound writable we would need some functionality that depends on it. The documentation on Bound from Embarcadero says:
Datasets that represent queries and stored procedures use the value of Bound to determine whether to assign a default value for the parameter. If Bound is false, datasets that represent queries attempt to assign a value from the dataset indicated by their DataSource property. Similarly, when Bound is false, datasets that represent stored procedures attempt to supply a value directly from the server.
I am not sure what Zeos should do if one sets Bound to False on a TZQuery. Where should it get a default value from? For stored procedures we could check the meta data if there is a defauilt value there. But that also is nos implemented currently.

So - I suggest to just skip writing to bound.

Best regards,

Jan
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 796
Joined: 18.11.2018, 17:37
Location: Hungary

Re: TZParams compatibility Fastreport

Post by aehimself »

You can try to use .Value := null instead of .Bound.
If FastReport depends on .Bound you can disable ZParams in your project so it'll use the standard TParams instead.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Post Reply