-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDelphiDAO.dpr
More file actions
73 lines (68 loc) · 2.5 KB
/
Copy pathDelphiDAO.dpr
File metadata and controls
73 lines (68 loc) · 2.5 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
72
73
program DelphiDAO;
{$APPTYPE CONSOLE}
uses
madExcept,
madLinkDisAsm,
madListHardware,
madListProcesses,
madListModules,
StrUtils,
SysUtils,
Forms,
Inflector in 'lib\com\beardon\active_support\Inflector.pas',
Delphinator in 'lib\com\beardon\active_support\Delphinator.pas',
Inflectors in 'lib\com\beardon\active_support\Inflectors.pas',
Generator in 'lib\com\beardon\delphidao\classes\Generator.pas',
Template in 'lib\com\beardon\delphidao\classes\Template.pas',
ArrayList in 'lib\com\beardon\delphidao\classes\dao\core\ArrayList.pas',
SQLComparisonOperator in 'lib\com\beardon\delphidao\classes\dao\sql\SQLComparisonOperator.pas',
SQLOrderDirection in 'lib\com\beardon\delphidao\classes\dao\sql\SQLOrderDirection.pas',
HashLib in 'lib\com\beardon\delphidao\libraries\HashLib.pas',
TbgQuery in 'lib\com\beardon\delphidao\classes\dao\sql\TbgQuery.pas',
DatabaseDM in 'lib\com\beardon\delphidao\data_modules\DatabaseDM.pas' {DatabaseDataModule: TDataModule},
Configuration in 'lib\com\beardon\delphidao\Configuration.pas',
ConfigLib in 'lib\com\beardon\delphidao\libraries\ConfigLib.pas';
var
generator: TGenerator;
configPath: string;
outputPath: string;
projectPath: string;
procedure ProcessParameters;
const
CONFIG_PATH_PARAM = '-c';
DEFAULT_PROJECT_PATH = '..\..\..\..\';
OUTPUT_PATH_PARAM = '-o';
TEMPLATE_PATH_PARAM = '-t';
var
i: Integer;
begin
for i := 1 to ParamCount do
begin
if (LeftStr(ParamStr(i), 2) = CONFIG_PATH_PARAM) then
configPath := Copy(ParamStr(i), 3, MaxInt);
if (LeftStr(ParamStr(i), 2) = OUTPUT_PATH_PARAM) then
outputPath := Copy(ParamStr(i), 3, MaxInt);
if (LeftStr(ParamStr(i), 2) = TEMPLATE_PATH_PARAM) then
projectPath := Copy(ParamStr(i), 3, MaxInt);
end;
if (configPath = '') then
configPath := ExtractFilePath(Application.ExeName) + CONFIG_INI_FILENAME;
if (outputPath = '') then
outputPath := ExtractFilePath(Application.ExeName);
if (projectPath = '') then
projectPath := DEFAULT_PROJECT_PATH;
end;
begin
ProcessParameters;
Application.CreateForm(TDatabaseDataModule, DatabaseDataModule);
DatabaseDataModule.OpenDBConnection(configPath);
generator := TGenerator.Create;
try
generator.Generate(DatabaseDataModule.DBConnection.Database, outputPath, projectPath);
{ TODO -oUser -cConsole Main : Insert code here }
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
generator.Free;
end.