-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuBDEInfo.pas
140 lines (121 loc) · 3.49 KB
/
uBDEInfo.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
unit uBDEInfo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, BDE, DB, DBTables;
type
TForm_BDESystemInfo = class(TForm)
Button_Close: TButton;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure Button_CloseClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
(*
var
Form_BDESystemInfo: TForm_BDESystemInfo;
*)
implementation
{$R *.DFM}
function fDbiGetSysVersion(SysVerList: TStringList): SYSVersion;
var
Month, Day, iHour, iMin, iSec: Word;
Year: SmallInt;
procedure ListDriverInfo;
var
DriverList: TStringList;
i: integer;
s: string;
function fDbiOpenTableTypesList(Driver: string): string;
var
hTypeCur: hDBICur;
TblTypes: TBLType;
BufStr: string;
begin
hTypeCur:= nil;
FillChar(TblTypes, sizeof(TblTypes), 0);
Check(DbiOpenTableTypesList(PChar(Driver), hTypeCur));
while (DbiGetNextRecord(hTypeCur, dbiNOLOCK, @TblTypes, nil) = DBIERR_NONE) do
begin
BufStr := format(' Name: %s, TableLevel: %d',[Tbltypes.szName, Tbltypes.iTblLevel]);
result := BufStr;
end;
end;
procedure List1Driver(Driver: string);
begin { List1Driver }
with SysVerList do
try
begin
Add(Driver);
Add(fDbiOpenTableTypesList(Driver));
end;
except
on e: exception do
Add(Format(' Error on %s [%s]', [Driver, E.message]));
end;
end; { List1Driver }
begin { ListDriverInfo }
DriverList := TStringList.Create;
with SysVerList do
try
Session.GetDriverNames(DriverList);
if DriverList.Count > 0 then
begin
// cfmVirtual, cfmPersistent, cfmSession
s := '';
if cfmVirtual in Session.ConfigMode then
s := s + 'Virtual ';
if cfmPersistent in Session.ConfigMode then
s := s + 'Persistant ';
if cfmSession in Session.ConfigMode then
s := s + 'Session ';
Add(Format('Available drivers: ConfigMode=%s', [s]));
for i := 0 to DriverList.Count-1 do
List1Driver(DriverList[i]);
List1Driver('DBASE');
List1Driver('FOXPRO');
List1Driver('PARADOX');
List1Driver('MSACCESS');
end;
finally
DriverList.Free;
end;
end; { ListDriverInfo }
begin { fDbiGetSysVersion }
Check(DbiGetSysVersion(Result));
if SysVerList <> nil then
begin
with SysVerList do
begin
Clear;
Add(Format('ENGINE VERSION=%d', [Result.iVersion]));
Add(Format('INTERFACE LEVEL=%d', [Result.iIntfLevel]));
Check(DbiDateDecode(Result.dateVer, Month, Day, Year));
Add(Format('VERSION DATE=%s', [DateToStr(EncodeDate(Year, Month,Day))]));
Check(DbiTimeDecode(Result.timeVer, iHour, iMin, iSec));
Add(Format('VERSION TIME=%s', [TimeToStr(EncodeTime(iHour, iMin,
iSec div 1000, iSec div 100))]));
ListDriverInfo;
end;
end;
end; { fDbiGetSysVersion }
procedure TForm_BDESystemInfo.FormCreate(Sender: TObject);
var
List: TStringList;
i: integer;
begin
List := TStringList.Create;
Check(DbiInit(nil));
fDbiGetSysVersion(List);
for i := 0 to List.Count-1 do
ListBox1.Items.Add(List[i]);
List.Free;
end;
procedure TForm_BDESystemInfo.Button_CloseClick(Sender: TObject);
begin
Close;
end;
end.