https://www.cnblogs.com/yjhb/p/11804239.html

我的测试代码下载:

链接:https://pan.baidu.com/s/1q7Fis_LYdV9vSyXOiCSNqA
提取码:htvx

 

 

procedure TForm3.FDSQLiteFunction1Calculate(AFunc: TSQLiteFunctionInstance;
  AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject);
begin
   AOutput.AsInteger := AInputs[0].AsInteger + AInputs[1].AsInteger + AInputs[2].AsInteger;
end
procedure TForm3.FormCreate(Sender: TObject);
begin
  FDSQLiteFunction1.Active:=true;  //要先 FDSQLiteFunction1 设为 true
  FDQuery3.SQL.Text:='SELECT 姓名, MyFun1(语文, 数学, 英语) AS 总分 FROM MyTable';
  FDQuery3.Active:=true;           //再   FDQuery3设为TRue
end;