-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappdb.pas
More file actions
71 lines (51 loc) · 1.44 KB
/
appdb.pas
File metadata and controls
71 lines (51 loc) · 1.44 KB
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
unit AppDb;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms;
type
{ TAppDatabase }
TAppDatabase = class(TObject)
private
FdbFile, FBaseFolder, FDatabaseVersion : String;
protected
property dbFile : String Read FdbFile Write FdbFile;
property BaseFolder : String Read FBaseFolder Write FBaseFolder;
property DatabaseVersion : String Read FDatabaseVersion write FDatabaseVersion;
public
constructor Create; overload;
destructor Destroy; override;
function CheckEntrylength(aText : String; aLength : Integer) : Boolean;
published
end;
const
SETTINGS_META = 'SETTINGS_META';
FOLDER_LIST = 'FOLDER_LIST';
QUERY_LIST = 'QUERY_LIST';
SETTINGS_APP = 'SETTINGS_APP';
implementation
uses Settings, lazfileutils;
{ TAppDatabase }
function TAppDatabase.CheckEntrylength(aText: String; aLength: Integer
): Boolean;
begin
if (aText = '') and (aLength <= 0) then exit;
if (Length(aText) <= aLength) then begin
Result := True;
end
else
Result := False;
end;
constructor TAppDatabase.Create;
begin
inherited;
BaseFolder := ExtractFilePath(Application.ExeName);
dbFile := BaseFolder + Settings.DatabaseFolder + PathDelim + Settings.DatabaseName;
DatabaseVersion := Settings.DataBaseVersion;
end;
destructor TAppDatabase.Destroy;
begin
//..
inherited Destroy;
end;
end.