-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmSCM.pas
84 lines (72 loc) · 1.95 KB
/
dmSCM.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
77
78
79
80
81
82
83
84
unit dmSCM;
interface
uses
System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.MSSQL,
FireDAC.Phys.MSSQLDef, FireDAC.VCLUI.Wait, Data.DB, FireDAC.Comp.Client,
FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
FireDAC.Comp.DataSet;
type
TSCM = class(TDataModule)
scmConnection: TFDConnection;
tblSwimClub: TFDTable;
dsSwimClub: TDataSource;
qrySCMSystem: TFDQuery;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
fDBModel, fDBVersion, fDBMajor, fDBMinor: integer;
FIsActive: boolean;
public
{ Public declarations }
property IsActive: boolean read FIsActive write FIsActive;
procedure ActivateTable();
procedure DeActivateTable();
function GetDBVerInfo(): string;
end;
var
SCM: TSCM;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
procedure TSCM.ActivateTable;
begin
// activate the SCM system table .
tblSwimClub.Open;
if tblSwimClub.Active then
FIsActive := true;
end;
procedure TSCM.DataModuleCreate(Sender: TObject);
begin
FIsActive := false;
end;
procedure TSCM.DeActivateTable;
begin
// close all ....
tblSwimClub.Close;
FIsActive := false;
end;
function TSCM.GetDBVerInfo: string;
begin
result := '';
if scmConnection.Connected then
begin
with qrySCMSystem do
begin
Connection := scmConnection;
Open;
if Active then
begin
fDBModel := FieldByName('SCMSystemID').AsInteger;
fDBVersion := FieldByName('DBVersion').AsInteger;
fDBMajor := FieldByName('Major').AsInteger;
fDBMinor := FieldByName('Minor').AsInteger;
result := IntToStr(fDBModel) + '.' + IntToStr(fDBVersion) + '.' +
IntToStr(fDBMajor) + '.' + IntToStr(fDBMinor);
end;
Close;
end;
end;
end;
end.