2019-09-25 14:55:39 +02:00
|
|
|
unit EngineChoiceFormU;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
2021-03-20 00:30:20 +01:00
|
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
|
2019-09-25 14:55:39 +02:00
|
|
|
|
|
|
|
type
|
|
|
|
TRDBMSEngine = (PostgreSQL, Firebird, Interbase, MSSQLServer, MySQL, MariaDB, SQLite);
|
|
|
|
|
|
|
|
TEngineChoiceForm = class(TForm)
|
|
|
|
Button1: TButton;
|
|
|
|
Label1: TLabel;
|
|
|
|
Button2: TButton;
|
|
|
|
Button3: TButton;
|
|
|
|
Button4: TButton;
|
|
|
|
Button5: TButton;
|
|
|
|
Button6: TButton;
|
|
|
|
Button7: TButton;
|
2021-03-20 00:30:20 +01:00
|
|
|
Shape1: TShape;
|
2019-09-25 14:55:39 +02:00
|
|
|
procedure Button1Click(Sender: TObject);
|
2020-06-25 22:54:57 +02:00
|
|
|
procedure FormCreate(Sender: TObject);
|
2019-09-25 14:55:39 +02:00
|
|
|
private
|
|
|
|
fSelectedRDBMS: TRDBMSEngine;
|
|
|
|
function SelectedRDBMS: TRDBMSEngine;
|
|
|
|
public
|
2021-08-13 18:05:48 +02:00
|
|
|
class function Execute(out Engine: TRDBMSEngine): Boolean;
|
2019-09-25 14:55:39 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
2020-04-18 15:04:27 +02:00
|
|
|
|
2019-09-25 14:55:39 +02:00
|
|
|
procedure TEngineChoiceForm.Button1Click(Sender: TObject);
|
|
|
|
begin
|
|
|
|
fSelectedRDBMS := TRDBMSEngine(TComponent(Sender).Tag);
|
|
|
|
ModalResult := mrOk;
|
|
|
|
end;
|
|
|
|
|
2021-08-13 18:05:48 +02:00
|
|
|
class function TEngineChoiceForm.Execute(out Engine: TRDBMSEngine): Boolean;
|
2019-09-25 14:55:39 +02:00
|
|
|
var
|
|
|
|
lFrm: TEngineChoiceForm;
|
|
|
|
begin
|
|
|
|
lFrm := TEngineChoiceForm.Create(nil);
|
|
|
|
try
|
2021-08-13 18:05:48 +02:00
|
|
|
Result := lFrm.ShowModal = mrOk;
|
|
|
|
if Result then
|
2019-09-25 14:55:39 +02:00
|
|
|
begin
|
2021-08-13 18:05:48 +02:00
|
|
|
Engine := lFrm.SelectedRDBMS;
|
2019-09-25 14:55:39 +02:00
|
|
|
end;
|
|
|
|
finally
|
|
|
|
lFrm.Free;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2020-06-25 22:54:57 +02:00
|
|
|
procedure TEngineChoiceForm.FormCreate(Sender: TObject);
|
|
|
|
begin
|
2021-03-20 00:30:20 +01:00
|
|
|
Shape1.Brush.Color := RGB($d6,$1e,$1e);
|
2020-06-25 22:54:57 +02:00
|
|
|
{$IFDEF USE_SEQUENCES}
|
|
|
|
Button1.Enabled := False;
|
|
|
|
Button2.Enabled := False;
|
|
|
|
Button4.Enabled := False;
|
|
|
|
Button5.Enabled := False;
|
|
|
|
Button6.Enabled := False;
|
|
|
|
Button7.Enabled := False;
|
|
|
|
Caption := 'Use SEQUENCES';
|
|
|
|
{$ELSE}
|
|
|
|
Button3.Enabled := False;
|
|
|
|
Caption := 'Use RETURNING';
|
|
|
|
{$ENDIF}
|
|
|
|
end;
|
|
|
|
|
2019-09-25 14:55:39 +02:00
|
|
|
function TEngineChoiceForm.SelectedRDBMS: TRDBMSEngine;
|
|
|
|
begin
|
|
|
|
Result := fSelectedRDBMS;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|