-
Notifications
You must be signed in to change notification settings - Fork 0
/
DMDM.pas
76 lines (62 loc) · 2.11 KB
/
DMDM.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
unit DMDM;
interface
uses
System.SysUtils, System.Classes, Data.DBXDataSnap, IPPeerClient,
Data.DBXCommon, Datasnap.DBClient, Datasnap.DSConnect, Data.DB, Data.SqlExpr,
Unit1;
type
TSM = class(TDataModule)
ConDataSnap: TSQLConnection;
DSProviderConnection1: TDSProviderConnection;
DSProviderConnection2: TDSProviderConnection;
procedure DataModuleCreate(Sender: TObject);
procedure DataModuleDestroy(Sender: TObject);
private
FServidorConexaoClient: TConexaoClient;
FServidorDBClient: TDBClient;
FServidorDMClient: TDMClient;
function GetServidorConexaoClient: TConexaoClient;
function GetDBClient: TDBClient;
function GetDMClient: TDMClient;
public
property Conexao : TConexaoClient read GetServidorConexaoClient write FServidorConexaoClient;
property DBClient: TDBClient read GetDBClient write FServidorDBClient;
property DMClient: TDMClient read GetDMClient write FServidorDMClient;
end;
var
SM: TSM;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
procedure TSM.DataModuleCreate(Sender: TObject);
begin
// ConDataSnap.Open;
FServidorDBClient := TDBClient.Create(ConDataSnap.DBXConnection, True);
FServidorDMClient := TDMClient.Create(ConDataSnap.DBXConnection, True);
FServidorConexaoClient := TConexaoClient.Create(ConDataSnap.DBXConnection, True);
end;
function TSM.GetServidorConexaoClient: TConexaoClient;
begin
if FServidorConexaoClient = nil then
FServidorConexaoClient := TConexaoClient.Create(ConDataSnap.DBXConnection, True);
Result := FServidorConexaoClient;
end;
procedure TSM.DataModuleDestroy(Sender: TObject);
begin
FServidorDBClient.Free;
FServidorDMClient.Free;
FServidorConexaoClient.Free;
end;
function TSM.GetDBClient: TDBClient;
begin
if FServidorDBClient = nil then
FServidorDBClient := TDBClient.Create(ConDataSnap.DBXConnection, True);
Result := FServidorDBClient;
end;
function TSM.GetDMClient: TDMClient;
begin
if FServidorDMClient = nil then
FServidorDMClient := TDMClient.Create(ConDataSnap.DBXConnection, True);
Result := FServidorDMClient;
end;
end.