forked from motaz/turbobird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TurboBird.lpr
123 lines (112 loc) · 4.58 KB
/
TurboBird.lpr
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
{***************************************************************************}
{ TurboBird: FireBird database administration and management tool }
{ Developed by: Motaz Abdel Azeem http://code.sd/ }
{ Start development : 5.Dec.2009 }
{ Last updated : 12.Apr.2014 }
{ License : GPL for GUI, LGPL for Units }
{***************************************************************************}
program TurboBird;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
cmem,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Controls, memdslaz, main, CreateDb, Reg, QueryWindow, ViewView,
ViewTrigger, ViewSProc, ViewGen, NewTable, NewGen, EnterPass, About,
CreateTrigger, EditTable, CallProc, EditDataFullRec, UDFInfo, ViewDomain,
NewDomain, SysTables, NewConstraint, NewEditField, Calen, Scriptdb,
UserPermissions, TableManage, BackupRestore, CreateUser, ChangePass,
PermissionManage, SQLHistory, CopyTable, dynlibs, ibase60dyn, dbInfo,
sysutils, Comparison, Update, topologicalsort, UnitFirebirdServices,
trunksqlscript, turbocommon;
const
Major = 1;
Minor = 0;
Release = 3;
VersionDate = '2010 - April 2014';
{$IFDEF Unix}
{$DEFINE extdecl:=cdecl}
fbclib = 'libfbclient.' + sharedsuffix;
{$ENDIF}
{$IFDEF Windows}
{$DEFINE extdecl:=stdcall}
fbclib = 'fbembed.dll'; //allows both embedded and client/server access
seclib = 'fbclient.dll'; //only client/server access
thirdlib = 'gds32.dll'; //could be Firebird, could be old Interbase library...
{$ENDIF}
{$R *.res}
var
SAbout: TfmAbout;
ErrorMessage: string;
IBaseLibraryHandle : TLibHandle;
begin
Application.Initialize;
{$IFDEF DEBUG}
// Requires the build mode to set -dDEBUG in Project Options/Other and
// defining -gh/heaptrace on
// This avoids interference when running a production/default build without -gh
// Set up -gh output for the Leakview package:
if FileExists('heap.trc') then
DeleteFile('heap.trc');
SetHeapTraceOutput('heap.trc');
{$ENDIF DEBUG}
IBaseLibraryHandle:= LoadLibrary(fbclib);
// search for all compatible FireBird libraries in Windows
{$IFDEF Windows}
if IBaseLibraryHandle = NilHandle then
IBaseLibraryHandle:= LoadLibrary(seclib);
if IBaseLibraryHandle = NilHandle then
IBaseLibraryHandle:= LoadLibrary(thirdlib);
{$ENDIF}
// Check Firebird library existence
if (IBaseLibraryHandle = nilhandle) then
begin
ErrorMessage:= Format('Unable to load Firebird library: %s.' + LineEnding +
'Please follow the Firebird documentation to install the Firebird client on your system.',
[fbclib]);
{$IFDEF WINDOWS}
// More libraries and additional hint
ErrorMessage:= Format('Unable to load Firebird library: %s.' + LineEnding +
'Please follow the Firebird documentation to install the Firebird client on your system.' + LineEnding +
'Hint: you could copy the fbclient/fbembed.dll and associated dlls into the TurboBird directory.',
[fbclib+'/'+seclib+'/'+thirdlib]);
{$ENDIF}
Application.MessageBox(PChar(ErrorMessage), 'Warning', 0);
end;
SAbout:= TfmAbout.Create(nil);
SAbout.BorderStyle:= bsNone;
SAbout.BitBtn1.Visible:= False;
SAbout.Show;
Application.ProcessMessages;
SAbout.Update;
Application.CreateForm(TfmMain, fmMain);
fmMain.Version:= Format('%d.%d.%d', [Major, Minor, Release]);
fmMain.StatusBar1.Panels[1].Text:= 'Version: ' + fmMain.Version;
fmMain.VersionDate:= VersionDate;
fmMain.Major:= Major;
fmMain.Minor:= Minor;
fmMain.ReleaseVersion:= Release;
Application.CreateForm(TfmCreateDB, fmCreateDB);
Application.CreateForm(TfmReg, fmReg);
Application.CreateForm(TfmNewGen, fmNewGen);
Application.CreateForm(TfmEnterPass, fmEnterPass);
Application.CreateForm(TfmCreateTrigger, fmCreateTrigger);
Application.CreateForm(TfmEditTable, fmEditTable);
Application.CreateForm(TfmCallProc, fmCallProc);
Application.CreateForm(TfmEditDataFullRec, fmEditDataFullRec);
Application.CreateForm(TfmNewDomain, fmNewDomain);
Application.CreateForm(TdmSysTables, dmSysTables);
Application.CreateForm(TfmNewConstraint, fmNewConstraint);
Application.CreateForm(TfmCalen, fmCalen);
Application.CreateForm(TfmBackupRestore, fmBackupRestore);
Application.CreateForm(TfmCreateUser, fmCreateUser);
Application.CreateForm(TfmChangePass, fmChangePass);
Application.CreateForm(TfmSQLHistory, fmSQLHistory);
Application.CreateForm(TfmCopyTable, fmCopyTable);
SAbout.Free;
InitialiseIBase60;
Application.Run;
ReleaseIBase60;
end.