unit ServerMethodsUnit1;

interface

uses System.SysUtils, System.Classes, Datasnap.DSServer, Datasnap.DSAuth,
  Data.DBXInterBase, Data.DB, Data.SqlExpr, Data.FMTBcd;

type
{$METHODINFO ON}
  TServerMethods1 = class(TDataModule)
    SQLConnection1: TSQLConnection;
    SQLDataSet1: TSQLDataSet;
  private
    { Private declarations }
  public
    { Public declarations }
    function EchoString(Value: string): string;
    function ReverseString(Value: string): string;
    function GetEmployees: TDataSet;
  end;
{$METHODINFO OFF}

implementation

{$R *.dfm}

uses System.StrUtils;

function TServerMethods1.EchoString(Value: string): string;
begin
  Result := Value;
end;

function TServerMethods1.GetEmployees: TDataSet;
begin
  if not SQLDataSet1.Active then // make sure data can be retrieved
    SQLDataSet1.Open // open dataset
  else SQLDataSet1.First; // in case it already was open
  Result := SQLDataSet1
end;

function TServerMethods1.ReverseString(Value: string): string;
begin
  Result := System.StrUtils.ReverseString(Value);
end;

end.

