// 
// Created by the DataSnap proxy generator.
// 4/4/2012 8:20:07 PM
// 

unit DSProxy;

interface
  uses
    Classes,
    DB,
    DSAdmin,
    DSRESTParameterMetaData,
    DBXFPCJson,
    DBXValue,
    DBXFPCCommon,
    DSRESTConnection, DSRestTypes;

  type
    TMyServerMethods = class(TDSAdmin)
    private
      FTMyServerMethods_EchoString: TDSRESTParameterMetaDataArray;
      FTMyServerMethods_ReverseString: TDSRESTParameterMetaDataArray;
      FTMyServerMethods_ServerTime: TDSRESTParameterMetaDataArray;
      FTMyServerMethods_Add33: TDSRESTParameterMetaDataArray;
      FTMyServerMethods_GetEmployees: TDSRESTParameterMetaDataArray;
      FTMyServerMethods_AS_GetProviderNames: TDSRESTParameterMetaDataArray;
      FTMyServerMethods_AS_Execute: TDSRESTParameterMetaDataArray;
    protected
      procedure TMyServerMethods_EchoString;
      procedure TMyServerMethods_ReverseString;
      procedure TMyServerMethods_ServerTime;
      procedure TMyServerMethods_Add33;
      procedure TMyServerMethods_GetEmployees;
      procedure TMyServerMethods_AS_GetProviderNames;
      procedure TMyServerMethods_AS_Execute;
    public
      destructor Destroy;override;

      (*
       * @param Value [in] - Type on server: string
       * @return result - Type on server: string
       *)
      function EchoString(Value: string):string;

      (*
       * @param Value [in] - Type on server: string
       * @return result - Type on server: string
       *)
      function ReverseString(Value: string):string;

      (*
       * @return result - Type on server: TDateTime
       *)
      function ServerTime():TDateTime;

      (*
       * @param X1 [in] - Type on server: Int32
       * @param X2 [in] - Type on server: Int32
       * @param X3 [in] - Type on server: Int32
       * @param X4 [in] - Type on server: Int32
       * @param X5 [in] - Type on server: Int32
       * @param X6 [in] - Type on server: Int32
       * @param X7 [in] - Type on server: Int32
       * @param X8 [in] - Type on server: Int32
       * @param X9 [in] - Type on server: Int32
       * @param X10 [in] - Type on server: Int32
       * @param X11 [in] - Type on server: Int32
       * @param X12 [in] - Type on server: Int32
       * @param X13 [in] - Type on server: Int32
       * @param X14 [in] - Type on server: Int32
       * @param X15 [in] - Type on server: Int32
       * @param X16 [in] - Type on server: Int32
       * @param X17 [in] - Type on server: Int32
       * @param X18 [in] - Type on server: Int32
       * @param X19 [in] - Type on server: Int32
       * @param X20 [in] - Type on server: Int32
       * @param X21 [in] - Type on server: Int32
       * @param X22 [in] - Type on server: Int32
       * @param X23 [in] - Type on server: Int32
       * @param X24 [in] - Type on server: Int32
       * @param X25 [in] - Type on server: Int32
       * @param X26 [in] - Type on server: Int32
       * @param X27 [in] - Type on server: Int32
       * @param X28 [in] - Type on server: Int32
       * @param X29 [in] - Type on server: Int32
       * @param X30 [in] - Type on server: Int32
       * @param X31 [in] - Type on server: Int32
       * @param X32 [in] - Type on server: Int32
       * @param X33 [in] - Type on server: Int32
       * @return result - Type on server: Int32
       *)
      function Add33(X1: Int32;X2: Int32;X3: Int32;X4: Int32;X5: Int32;X6: Int32;X7: Int32;X8: Int32;X9: Int32;X10: Int32;X11: Int32;X12: Int32;X13: Int32;X14: Int32;X15: Int32;X16: Int32;X17: Int32;X18: Int32;X19: Int32;X20: Int32;X21: Int32;X22: Int32;X23: Int32;X24: Int32;X25: Int32;X26: Int32;X27: Int32;X28: Int32;X29: Int32;X30: Int32;X31: Int32;X32: Int32;X33: Int32):Int32;

      (*
       * @return result - Type on server: TDataSet
       *)
      function GetEmployees():TDataSet;

      (*
       * @return result - Type on server: string
       *)
      function AS_GetProviderNames():string;

      (*
       * @param ProviderName [in] - Type on server: string
       * @param CommandText [in] - Type on server: string
       * @param ParamReader [in/out] - Type on server: TDBXStreamValue
       * @param OwnerDataStream [in/out] - Type on server: TDBXStreamValue
       *)
      procedure AS_Execute(ProviderName: string;CommandText: string;var ParamReader: TDBXStreamValue;var OwnerDataStream: TDBXStreamValue);
    end;

implementation


{TMyServerMethods}

procedure TMyServerMethods.TMyServerMethods_EchoString;
begin
  if Length(FTMyServerMethods_EchoString) = 0 then
  begin
    SetLength(FTMyServerMethods_EchoString, 2);
    FTMyServerMethods_EchoString[0] := TDSRESTParameterMetaData.CreateParam( 'Value',Input,WideStringType,'string');
    FTMyServerMethods_EchoString[1] := TDSRESTParameterMetaData.CreateParam( '',ReturnValue,WideStringType,'string');
  end;
end;

procedure TMyServerMethods.TMyServerMethods_ReverseString;
begin
  if Length(FTMyServerMethods_ReverseString) = 0 then
  begin
    SetLength(FTMyServerMethods_ReverseString, 2);
    FTMyServerMethods_ReverseString[0] := TDSRESTParameterMetaData.CreateParam( 'Value',Input,WideStringType,'string');
    FTMyServerMethods_ReverseString[1] := TDSRESTParameterMetaData.CreateParam( '',ReturnValue,WideStringType,'string');
  end;
end;

procedure TMyServerMethods.TMyServerMethods_ServerTime;
begin
  if Length(FTMyServerMethods_ServerTime) = 0 then
  begin
    SetLength(FTMyServerMethods_ServerTime, 1);
    FTMyServerMethods_ServerTime[0] := TDSRESTParameterMetaData.CreateParam( '',ReturnValue,DateTimeType,'TDateTime');
  end;
end;

procedure TMyServerMethods.TMyServerMethods_Add33;
begin
  if Length(FTMyServerMethods_Add33) = 0 then
  begin
    SetLength(FTMyServerMethods_Add33, 34);
    FTMyServerMethods_Add33[0] := TDSRESTParameterMetaData.CreateParam( 'X1',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[1] := TDSRESTParameterMetaData.CreateParam( 'X2',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[2] := TDSRESTParameterMetaData.CreateParam( 'X3',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[3] := TDSRESTParameterMetaData.CreateParam( 'X4',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[4] := TDSRESTParameterMetaData.CreateParam( 'X5',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[5] := TDSRESTParameterMetaData.CreateParam( 'X6',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[6] := TDSRESTParameterMetaData.CreateParam( 'X7',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[7] := TDSRESTParameterMetaData.CreateParam( 'X8',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[8] := TDSRESTParameterMetaData.CreateParam( 'X9',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[9] := TDSRESTParameterMetaData.CreateParam( 'X10',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[10] := TDSRESTParameterMetaData.CreateParam( 'X11',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[11] := TDSRESTParameterMetaData.CreateParam( 'X12',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[12] := TDSRESTParameterMetaData.CreateParam( 'X13',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[13] := TDSRESTParameterMetaData.CreateParam( 'X14',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[14] := TDSRESTParameterMetaData.CreateParam( 'X15',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[15] := TDSRESTParameterMetaData.CreateParam( 'X16',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[16] := TDSRESTParameterMetaData.CreateParam( 'X17',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[17] := TDSRESTParameterMetaData.CreateParam( 'X18',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[18] := TDSRESTParameterMetaData.CreateParam( 'X19',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[19] := TDSRESTParameterMetaData.CreateParam( 'X20',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[20] := TDSRESTParameterMetaData.CreateParam( 'X21',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[21] := TDSRESTParameterMetaData.CreateParam( 'X22',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[22] := TDSRESTParameterMetaData.CreateParam( 'X23',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[23] := TDSRESTParameterMetaData.CreateParam( 'X24',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[24] := TDSRESTParameterMetaData.CreateParam( 'X25',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[25] := TDSRESTParameterMetaData.CreateParam( 'X26',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[26] := TDSRESTParameterMetaData.CreateParam( 'X27',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[27] := TDSRESTParameterMetaData.CreateParam( 'X28',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[28] := TDSRESTParameterMetaData.CreateParam( 'X29',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[29] := TDSRESTParameterMetaData.CreateParam( 'X30',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[30] := TDSRESTParameterMetaData.CreateParam( 'X31',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[31] := TDSRESTParameterMetaData.CreateParam( 'X32',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[32] := TDSRESTParameterMetaData.CreateParam( 'X33',Input,Int32Type,'Int32');
    FTMyServerMethods_Add33[33] := TDSRESTParameterMetaData.CreateParam( '',ReturnValue,Int32Type,'Int32');
  end;
end;

procedure TMyServerMethods.TMyServerMethods_GetEmployees;
begin
  if Length(FTMyServerMethods_GetEmployees) = 0 then
  begin
    SetLength(FTMyServerMethods_GetEmployees, 1);
    FTMyServerMethods_GetEmployees[0] := TDSRESTParameterMetaData.CreateParam( '',ReturnValue,TableType,'TDataSet');
  end;
end;

procedure TMyServerMethods.TMyServerMethods_AS_GetProviderNames;
begin
  if Length(FTMyServerMethods_AS_GetProviderNames) = 0 then
  begin
    SetLength(FTMyServerMethods_AS_GetProviderNames, 1);
    FTMyServerMethods_AS_GetProviderNames[0] := TDSRESTParameterMetaData.CreateParam( '',ReturnValue,WideStringType,'string');
  end;
end;

procedure TMyServerMethods.TMyServerMethods_AS_Execute;
begin
  if Length(FTMyServerMethods_AS_Execute) = 0 then
  begin
    SetLength(FTMyServerMethods_AS_Execute, 4);
    FTMyServerMethods_AS_Execute[0] := TDSRESTParameterMetaData.CreateParam( 'ProviderName',Input,WideStringType,'string');
    FTMyServerMethods_AS_Execute[1] := TDSRESTParameterMetaData.CreateParam( 'CommandText',Input,WideStringType,'string');
    FTMyServerMethods_AS_Execute[2] := TDSRESTParameterMetaData.CreateParam( 'ParamReader',InputOutput,BinaryBlobType,'TDBXStreamValue');
    FTMyServerMethods_AS_Execute[3] := TDSRESTParameterMetaData.CreateParam( 'OwnerDataStream',InputOutput,BinaryBlobType,'TDBXStreamValue');
  end;
end;
destructor TMyServerMethods.Destroy;
begin
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_EchoString);
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_ReverseString);
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_ServerTime);
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_Add33);
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_GetEmployees);
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_AS_GetProviderNames);
   TDSRESTParameterMetaData.releaseArray(FTMyServerMethods_AS_Execute);
  inherited;
end;

(*
 * @param Value [in] - Type on server: string
 * @return result - Type on server: string
 *)
function TMyServerMethods.EchoString( value:string):string;
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := GET;
    cmd.text := 'TMyServerMethods.EchoString';
    TMyServerMethods_EchoString;
    cmd.prepare(FTMyServerMethods_EchoString);
    cmd.parameters.items[0].Value.AsString:=value;
    Connection.execute(cmd);
    
    result:= cmd.parameters.items[1].Value.AsString;
  finally
    cmd.free;
  end;
end;

(*
 * @param Value [in] - Type on server: string
 * @return result - Type on server: string
 *)
function TMyServerMethods.ReverseString( value:string):string;
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := GET;
    cmd.text := 'TMyServerMethods.ReverseString';
    TMyServerMethods_ReverseString;
    cmd.prepare(FTMyServerMethods_ReverseString);
    cmd.parameters.items[0].Value.AsString:=value;
    Connection.execute(cmd);
    
    result:= cmd.parameters.items[1].Value.AsString;
  finally
    cmd.free;
  end;
end;

(*
 * @return result - Type on server: TDateTime
 *)
function TMyServerMethods.ServerTime():TDateTime;
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := GET;
    cmd.text := 'TMyServerMethods.ServerTime';
    TMyServerMethods_ServerTime;
    cmd.prepare(FTMyServerMethods_ServerTime);
    Connection.execute(cmd);
    
    result:= cmd.parameters.items[0].Value.AsDateTime;
  finally
    cmd.free;
  end;
end;

(*
 * @param X1 [in] - Type on server: Int32
 * @param X2 [in] - Type on server: Int32
 * @param X3 [in] - Type on server: Int32
 * @param X4 [in] - Type on server: Int32
 * @param X5 [in] - Type on server: Int32
 * @param X6 [in] - Type on server: Int32
 * @param X7 [in] - Type on server: Int32
 * @param X8 [in] - Type on server: Int32
 * @param X9 [in] - Type on server: Int32
 * @param X10 [in] - Type on server: Int32
 * @param X11 [in] - Type on server: Int32
 * @param X12 [in] - Type on server: Int32
 * @param X13 [in] - Type on server: Int32
 * @param X14 [in] - Type on server: Int32
 * @param X15 [in] - Type on server: Int32
 * @param X16 [in] - Type on server: Int32
 * @param X17 [in] - Type on server: Int32
 * @param X18 [in] - Type on server: Int32
 * @param X19 [in] - Type on server: Int32
 * @param X20 [in] - Type on server: Int32
 * @param X21 [in] - Type on server: Int32
 * @param X22 [in] - Type on server: Int32
 * @param X23 [in] - Type on server: Int32
 * @param X24 [in] - Type on server: Int32
 * @param X25 [in] - Type on server: Int32
 * @param X26 [in] - Type on server: Int32
 * @param X27 [in] - Type on server: Int32
 * @param X28 [in] - Type on server: Int32
 * @param X29 [in] - Type on server: Int32
 * @param X30 [in] - Type on server: Int32
 * @param X31 [in] - Type on server: Int32
 * @param X32 [in] - Type on server: Int32
 * @param X33 [in] - Type on server: Int32
 * @return result - Type on server: Int32
 *)
function TMyServerMethods.Add33( x1:Int32; x2:Int32; x3:Int32; x4:Int32; x5:Int32; x6:Int32; x7:Int32; x8:Int32; x9:Int32; x10:Int32; x11:Int32; x12:Int32; x13:Int32; x14:Int32; x15:Int32; x16:Int32; x17:Int32; x18:Int32; x19:Int32; x20:Int32; x21:Int32; x22:Int32; x23:Int32; x24:Int32; x25:Int32; x26:Int32; x27:Int32; x28:Int32; x29:Int32; x30:Int32; x31:Int32; x32:Int32; x33:Int32):Int32;
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := GET;
    cmd.text := 'TMyServerMethods.Add33';
    TMyServerMethods_Add33;
    cmd.prepare(FTMyServerMethods_Add33);
    cmd.parameters.items[0].Value.AsInt32:=x1;
    cmd.parameters.items[1].Value.AsInt32:=x2;
    cmd.parameters.items[2].Value.AsInt32:=x3;
    cmd.parameters.items[3].Value.AsInt32:=x4;
    cmd.parameters.items[4].Value.AsInt32:=x5;
    cmd.parameters.items[5].Value.AsInt32:=x6;
    cmd.parameters.items[6].Value.AsInt32:=x7;
    cmd.parameters.items[7].Value.AsInt32:=x8;
    cmd.parameters.items[8].Value.AsInt32:=x9;
    cmd.parameters.items[9].Value.AsInt32:=x10;
    cmd.parameters.items[10].Value.AsInt32:=x11;
    cmd.parameters.items[11].Value.AsInt32:=x12;
    cmd.parameters.items[12].Value.AsInt32:=x13;
    cmd.parameters.items[13].Value.AsInt32:=x14;
    cmd.parameters.items[14].Value.AsInt32:=x15;
    cmd.parameters.items[15].Value.AsInt32:=x16;
    cmd.parameters.items[16].Value.AsInt32:=x17;
    cmd.parameters.items[17].Value.AsInt32:=x18;
    cmd.parameters.items[18].Value.AsInt32:=x19;
    cmd.parameters.items[19].Value.AsInt32:=x20;
    cmd.parameters.items[20].Value.AsInt32:=x21;
    cmd.parameters.items[21].Value.AsInt32:=x22;
    cmd.parameters.items[22].Value.AsInt32:=x23;
    cmd.parameters.items[23].Value.AsInt32:=x24;
    cmd.parameters.items[24].Value.AsInt32:=x25;
    cmd.parameters.items[25].Value.AsInt32:=x26;
    cmd.parameters.items[26].Value.AsInt32:=x27;
    cmd.parameters.items[27].Value.AsInt32:=x28;
    cmd.parameters.items[28].Value.AsInt32:=x29;
    cmd.parameters.items[29].Value.AsInt32:=x30;
    cmd.parameters.items[30].Value.AsInt32:=x31;
    cmd.parameters.items[31].Value.AsInt32:=x32;
    cmd.parameters.items[32].Value.AsInt32:=x33;
    Connection.execute(cmd);
    
    result:= cmd.parameters.items[33].Value.AsInt32;
  finally
    cmd.free;
  end;
end;

(*
 * @return result - Type on server: TDataSet
 *)
function TMyServerMethods.GetEmployees():TDataSet;
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := GET;
    cmd.text := 'TMyServerMethods.GetEmployees';
    TMyServerMethods_GetEmployees;
    cmd.prepare(FTMyServerMethods_GetEmployees);
    Connection.execute(cmd);
    
    result:= cmd.parameters.items[0].Value.AsTable as TDataSet;
  finally
    cmd.free;
  end;
end;

(*
 * @return result - Type on server: string
 *)
function TMyServerMethods.AS_GetProviderNames():string;
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := GET;
    cmd.text := 'TMyServerMethods.AS_GetProviderNames';
    TMyServerMethods_AS_GetProviderNames;
    cmd.prepare(FTMyServerMethods_AS_GetProviderNames);
    Connection.execute(cmd);
    
    result:= cmd.parameters.items[0].Value.AsString;
  finally
    cmd.free;
  end;
end;

(*
 * @param ProviderName [in] - Type on server: string
 * @param CommandText [in] - Type on server: string
 * @param ParamReader [in/out] - Type on server: TDBXStreamValue
 * @param OwnerDataStream [in/out] - Type on server: TDBXStreamValue
 *)
procedure TMyServerMethods.AS_Execute( providername:string; commandtext:string;var paramreader:TDBXStreamValue;var ownerdatastream:TDBXStreamValue);
var
  cmd: TDSRestCommand;
begin
  cmd := Connection.createCommand;
  try
    cmd.RequestType := POST;
    cmd.text := 'TMyServerMethods.AS_Execute';
    TMyServerMethods_AS_Execute;
    cmd.prepare(FTMyServerMethods_AS_Execute);
    cmd.parameters.items[0].Value.AsString:=providername;
    cmd.parameters.items[1].Value.AsString:=commandtext;
    if assigned(paramreader) then
      cmd.parameters.items[2].Value.AsDBXValue:=paramreader
    else
      cmd.parameters.items[2].Value.setTDBXNull('TDBXStreamValue');
    if assigned(ownerdatastream) then
      cmd.parameters.items[3].Value.AsDBXValue:=ownerdatastream
    else
      cmd.parameters.items[3].Value.setTDBXNull('TDBXStreamValue');
    Connection.execute(cmd);
    paramreader :=   cmd.parameters.items[2].Value.AsDBXValue as TDBXStreamValue;
    ownerdatastream :=   cmd.parameters.items[3].Value.AsDBXValue as TDBXStreamValue;
  finally
    cmd.free;
  end;
end;
end.
