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
|
program demo_08;
{$mode objfpc}{$H+}
// Which persistence layer to activate. (Un)Comment the one you want to use
{.$define UseFBL}
{$define UseSqldbIB}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, fpg_main, frm_main,
Client_DBIndependentVisitors_Svr, Client_BOM,
Client_AutoMap_Svr, Client_HardCodedVisitors_Svr, tiOPFManager,
tiConstants{, tiLog, tiLogToConsole};
procedure MainProc;
var
frm: TMainForm;
begin
fpgApplication.Initialize;
{$IFDEF UseFBL}
if GTIOPFManager.PersistenceLayers.FindByPersistenceLayerName(cTIPersistFBL) = nil then
raise Exception.Create('The system failed to find the <' + cTIPersistFBL + '> persistence layer')
else
GTIOPFManager.DefaultPersistenceLayerName := cTIPersistFBL;
{$ENDIF}
{$IFDEF UseSqldbIB}
if GTIOPFManager.PersistenceLayers.FindByPersistenceLayerName(cTIPersistSqldbIB) = nil then
raise Exception.Create('The system failed to find the <' + cTIPersistSqldbIB + '> persistence layer')
else
GTIOPFManager.DefaultPersistenceLayerName := cTIPersistSqldbIB;
{$ENDIF}
{ Change the connection string to suite your database location }
// ** Remote connection
//gTIOPFManager.ConnectDatabase('192.168.0.54|/home/graemeg/programming/data/tiopf.fdb', 'sysdba', 'masterkey');
// ** Local connection
gTIOPFManager.ConnectDatabase('/home/graemeg/programming/data/tiopf.fdb', 'sysdba', 'masterkey');
{ Which persistence mechanism do you want to use? Uncomment one. }
Client_AutoMap_Svr.RegisterMappings;
//Client_HardCodedVisitors_Svr.RegisterVisitors;
//Client_DBIndependentVisitors_Svr.RegisterVisitors;
frm := TMainForm.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
frm.Free;
gTIOPFManager.DisconnectDatabase;
gTIOPFManager.Terminate;
end;
end;
begin
MainProc;
end.
|