⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 first3tier2009_clientclasses.pas

📁 source code for the Marco Cantu s book Delphi 2009 Handbook
💻 PAS
字号:
//
// Created by the DataSnap proxy generator.
// 

unit First3Tier2009_ClientClasses;

interface

uses DBXCommon, Classes, SysUtils, DB, SqlExpr, DBXDBReaders;

type
  TDSFirst3TierServerModuleClient = class
  private
    FDBXConnection: TDBXConnection;
    FInstanceOwner: Boolean;
    FGetHelloCommand: TDBXCommand;
  public
    constructor Create(ADBXConnection: TDBXConnection); overload;
    constructor Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean); overload;
    destructor Destroy; override;
    function GetHello: string;
  end;

implementation

function TDSFirst3TierServerModuleClient.GetHello: string;
begin
  if FGetHelloCommand = nil then
  begin
    FGetHelloCommand := FDBXConnection.CreateCommand;
    FGetHelloCommand.CommandType := TDBXCommandTypes.DSServerMethod;
    FGetHelloCommand.Text := 'TDSFirst3TierServerModule.GetHello';
    FGetHelloCommand.Prepare;
  end;
  FGetHelloCommand.ExecuteUpdate;
  Result := FGetHelloCommand.Parameters[0].Value.GetWideString;
end;


constructor TDSFirst3TierServerModuleClient.Create(ADBXConnection: TDBXConnection);
begin
  inherited Create;
  if ADBXConnection = nil then
    raise EInvalidOperation.Create('Connection cannot be nil.  Make sure the connection has been opened.');
  FDBXConnection := ADBXConnection;
FInstanceOwner := True;
end;


constructor TDSFirst3TierServerModuleClient.Create(ADBXConnection: TDBXConnection; AInstanceOwner: Boolean);
begin
  inherited Create;
  if ADBXConnection = nil then
    raise EInvalidOperation.Create('Connection cannot be nil.  Make sure the connection has been opened.');
  FDBXConnection := ADBXConnection;
FInstanceOwner := AInstanceOwner;
end;


destructor TDSFirst3TierServerModuleClient.Destroy;
begin
  FreeAndNil(FGetHelloCommand);
  inherited;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -