unit ServerMethodsUnit1;

interface

uses System.SysUtils, System.Classes, System.Json,
    Datasnap.DSServer, Datasnap.DSAuth, DataSnap.DSProviderDataModuleAdapter, Data.DBXMySQL,
  Datasnap.Provider, Data.DB, Datasnap.DBClient, SimpleDS, Data.SqlExpr;

type
  TServerMethods1 = class(TDSServerModule)
    SQLConnection1: TSQLConnection;
    SimpleDataSet1: TSimpleDataSet;
    DataSetProvider1: TDataSetProvider;
    procedure DataSetProvider1GetTableName(Sender: TObject; DataSet: TDataSet;
      var TableName: string);
    procedure DSServerModuleCreate(Sender: TObject);
    procedure DataSetProvider1BeforeGetRecords(Sender: TObject; var OwnerData: OleVariant);
    procedure DataSetProvider1AfterGetRecords(Sender: TObject; var OwnerData: OleVariant);
  private
    { Private declarations }
  public
    { Public declarations }
    function EchoString(Value: string): string;
    function ReverseString(Value: string): string;
  end;

implementation


{$R *.dfm}


uses System.StrUtils;

procedure TServerMethods1.DataSetProvider1AfterGetRecords(Sender: TObject;
  var OwnerData: OleVariant);
begin
simpledataset1.Open;
end;

procedure TServerMethods1.DataSetProvider1BeforeGetRecords(Sender: TObject;
  var OwnerData: OleVariant);
begin
simpledataset1.Close;
end;

procedure TServerMethods1.DataSetProvider1GetTableName(Sender: TObject; DataSet: TDataSet;
  var TableName: string);
begin
TableName:='Pictures';
end;

procedure TServerMethods1.DSServerModuleCreate(Sender: TObject);
begin
simpledataset1.Open;
end;

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

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

end.

