summaryrefslogtreecommitdiff
path: root/extras/tiopf/demos/Demo_06_CreateTable/demo_06.lpr
blob: 8e966dc73f48e56cec2f3b695e1de2f4ea409a8e (plain)
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
program demo_06;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes, SysUtils,
  fpg_main, frm_main, tiOPFManager, tiConstants;


procedure MainProc;
var
  frm: TMainForm;
begin
  fpgApplication.Initialize;

  if GTIOPFManager.PersistenceLayers.FindByPersistenceLayerName(cTIPersistFBL) = nil then
    raise Exception.Create('The system failed to find the <' + cTIPersistFBL + '> persistence layer')
  else
    GTIOPFManager.DefaultPersistenceLayerName := cTIPersistFBL;

  // 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');

  frm := TMainForm.Create(nil);
  try
    frm.Show;
    fpgApplication.Run;
  finally
    frm.Free;
    gTIOPFManager.DisconnectDatabase;
    gTIOPFManager.Terminate;
  end;
end;

begin
  MainProc;
end.