How to fill an ADT parameter in Firedac on Delphi?

Viewed 127

I have a stored procedure in the database (PostgreSql) and it receives a record as a parameter. When an FdStoredProc is prepared with this function, the parameter is created with the following definitions:

   DataType = ftADT
   FDDataType = dtRowRef
   ParamType = ptInput

I would like to know how to fill this parameter in execution mode.

See a function example

CREATE TYPE t_row_param AS
(
    one_field INTEGER,
    other_field NUMERIC,
    another_field TEXT
    --...
);


CREATE FUNCTION my_function(_asuper_row t_row_param)
    RETURNS void
    LANGUAGE sql
    STABLE
AS
$$
   --...process row
$$;

and that is the sample Delphi code:

type
  TMyRow = record
    one_field: integer;
    other_field Double;
    another_field : String;
  end;

procedure DB_MyFunction(_arow: TMyRow); 
var
  aproc := TFDStoredProc;
begin
  aproc := TFDStoredProc.Create(nil);
  aproc.Connection := aconnection;
  aproc.StoredProcName := 'my_function';
  aproc.Prepare;
  //aproc.params.ParamByName('_asuper_row')AsXXX := ???; how do it?
  //...finalize
 end;
0 Answers
Related