//
// Created by the DataSnap proxy generator.
// 15.09.2015 16:07:42
//

unit ClientMethods_9_1;

interface

uses System.JSON, Data.DBXCommon, Data.DBXClient, Data.DBXDataSnap, Data.DBXJSON, Datasnap.DSProxy, System.Classes, System.SysUtils, Data.DB, Data.SqlExpr, Data.DBXDBReaders, Data.DBXCDSReaders, Data.DBXJSONReflect;

type
  TServerMethods1Client = class(TDSAdminClient)
  private
    FZeroGlobalBufferCommand: TDBXCommand;
    FGlobalBufferToMySQLCommand: TDBXCommand;
    FGetstreamByPacketsCommand: TDBXCommand;
    FApplyUpdatesCommand: TDBXCommand;
    FHelloCommand: TDBXCommand;
    FDataInsertCommand: TDBXCommand;
    FZeroGlobalStringCommand: TDBXCommand;
    FBuildGlobalStringCommand: TDBXCommand;
    FGlobalStringToMySQLCommand: TDBXCommand;
    FGetBytesCommand: TDBXCommand;
  public
    constructor Create(ADBXConnection: TDBXConnection); overload;
    constructor Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean); overload;
    destructor Destroy; override;
    procedure ZeroGlobalBuffer;
    procedure GlobalBufferToMySQL;
    procedure GetstreamByPackets(stream: TMemoryStream; packetsize: Int64);
    procedure ApplyUpdates;
    procedure Hello(s: string);
    procedure DataInsert(V: OleVariant);
    procedure ZeroGlobalString;
    procedure BuildGlobalString(V: OleVariant);
    procedure GlobalStringToMySQL;
    procedure GetBytes(s: string);
  end;

implementation

procedure TServerMethods1Client.ZeroGlobalBuffer;
begin
  if FZeroGlobalBufferCommand = nil then
  begin
    FZeroGlobalBufferCommand := FDBXConnection.CreateCommand;
    FZeroGlobalBufferCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FZeroGlobalBufferCommand.Text := 'TServerMethods1.ZeroGlobalBuffer';
    FZeroGlobalBufferCommand.Prepare;
  end;
  FZeroGlobalBufferCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.GlobalBufferToMySQL;
begin
  if FGlobalBufferToMySQLCommand = nil then
  begin
    FGlobalBufferToMySQLCommand := FDBXConnection.CreateCommand;
    FGlobalBufferToMySQLCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FGlobalBufferToMySQLCommand.Text := 'TServerMethods1.GlobalBufferToMySQL';
    FGlobalBufferToMySQLCommand.Prepare;
  end;
  FGlobalBufferToMySQLCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.GetstreamByPackets(stream: TMemoryStream; packetsize: Int64);
begin
  if FGetstreamByPacketsCommand = nil then
  begin
    FGetstreamByPacketsCommand := FDBXConnection.CreateCommand;
    FGetstreamByPacketsCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FGetstreamByPacketsCommand.Text := 'TServerMethods1.GetstreamByPackets';
    FGetstreamByPacketsCommand.Prepare;
  end;
  FGetstreamByPacketsCommand.Parameters[0].Value.SetStream(stream, FInstanceOwner);
  FGetstreamByPacketsCommand.Parameters[1].Value.SetInt64(packetsize);
  FGetstreamByPacketsCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.ApplyUpdates;
begin
  if FApplyUpdatesCommand = nil then
  begin
    FApplyUpdatesCommand := FDBXConnection.CreateCommand;
    FApplyUpdatesCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FApplyUpdatesCommand.Text := 'TServerMethods1.ApplyUpdates';
    FApplyUpdatesCommand.Prepare;
  end;
  FApplyUpdatesCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.Hello(s: string);
begin
  if FHelloCommand = nil then
  begin
    FHelloCommand := FDBXConnection.CreateCommand;
    FHelloCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FHelloCommand.Text := 'TServerMethods1.Hello';
    FHelloCommand.Prepare;
  end;
  FHelloCommand.Parameters[0].Value.SetWideString(s);
  FHelloCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.DataInsert(V: OleVariant);
begin
  if FDataInsertCommand = nil then
  begin
    FDataInsertCommand := FDBXConnection.CreateCommand;
    FDataInsertCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FDataInsertCommand.Text := 'TServerMethods1.DataInsert';
    FDataInsertCommand.Prepare;
  end;
  FDataInsertCommand.Parameters[0].Value.AsVariant := V;
  FDataInsertCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.ZeroGlobalString;
begin
  if FZeroGlobalStringCommand = nil then
  begin
    FZeroGlobalStringCommand := FDBXConnection.CreateCommand;
    FZeroGlobalStringCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FZeroGlobalStringCommand.Text := 'TServerMethods1.ZeroGlobalString';
    FZeroGlobalStringCommand.Prepare;
  end;
  FZeroGlobalStringCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.BuildGlobalString(V: OleVariant);
begin
  if FBuildGlobalStringCommand = nil then
  begin
    FBuildGlobalStringCommand := FDBXConnection.CreateCommand;
    FBuildGlobalStringCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FBuildGlobalStringCommand.Text := 'TServerMethods1.BuildGlobalString';
    FBuildGlobalStringCommand.Prepare;
  end;
  FBuildGlobalStringCommand.Parameters[0].Value.AsVariant := V;
  FBuildGlobalStringCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.GlobalStringToMySQL;
begin
  if FGlobalStringToMySQLCommand = nil then
  begin
    FGlobalStringToMySQLCommand := FDBXConnection.CreateCommand;
    FGlobalStringToMySQLCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FGlobalStringToMySQLCommand.Text := 'TServerMethods1.GlobalStringToMySQL';
    FGlobalStringToMySQLCommand.Prepare;
  end;
  FGlobalStringToMySQLCommand.ExecuteUpdate;
end;

procedure TServerMethods1Client.GetBytes(s: string);
begin
  if FGetBytesCommand = nil then
  begin
    FGetBytesCommand := FDBXConnection.CreateCommand;
    FGetBytesCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FGetBytesCommand.Text := 'TServerMethods1.GetBytes';
    FGetBytesCommand.Prepare;
  end;
  FGetBytesCommand.Parameters[0].Value.SetWideString(s);
  FGetBytesCommand.ExecuteUpdate;
end;


constructor TServerMethods1Client.Create(ADBXConnection: TDBXConnection);
begin
  inherited Create(ADBXConnection);
end;


constructor TServerMethods1Client.Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean);
begin
  inherited Create(ADBXConnection, AInstanceOwner);
end;


destructor TServerMethods1Client.Destroy;
begin
  FZeroGlobalBufferCommand.DisposeOf;
  FGlobalBufferToMySQLCommand.DisposeOf;
  FGetstreamByPacketsCommand.DisposeOf;
  FApplyUpdatesCommand.DisposeOf;
  FHelloCommand.DisposeOf;
  FDataInsertCommand.DisposeOf;
  FZeroGlobalStringCommand.DisposeOf;
  FBuildGlobalStringCommand.DisposeOf;
  FGlobalStringToMySQLCommand.DisposeOf;
  FGetBytesCommand.DisposeOf;
  inherited;
end;

end.

