1 |
unit Unit3; |
2 |
|
3 |
{$mode objfpc}{$H+} |
4 |
|
5 |
interface |
6 |
|
7 |
uses |
8 |
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, |
9 |
StdCtrls, Buttons, IBServices; |
10 |
|
11 |
type |
12 |
|
13 |
{ TForm3 } |
14 |
|
15 |
TForm3 = class(TForm) |
16 |
Bevel1: TBevel; |
17 |
Button1: TButton; |
18 |
Button2: TButton; |
19 |
CheckBox1: TCheckBox; |
20 |
Edit1: TEdit; |
21 |
Edit2: TEdit; |
22 |
Edit3: TEdit; |
23 |
IBRestoreService1: TIBRestoreService; |
24 |
Label1: TLabel; |
25 |
Label2: TLabel; |
26 |
Label3: TLabel; |
27 |
OpenDialog1: TOpenDialog; |
28 |
RadioButton1: TRadioButton; |
29 |
RadioButton2: TRadioButton; |
30 |
SpeedButton1: TSpeedButton; |
31 |
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
32 |
procedure FormShow(Sender: TObject); |
33 |
procedure SpeedButton1Click(Sender: TObject); |
34 |
private |
35 |
{ private declarations } |
36 |
public |
37 |
{ public declarations } |
38 |
end; |
39 |
|
40 |
var |
41 |
Form3: TForm3; |
42 |
|
43 |
implementation |
44 |
|
45 |
{$R *.lfm} |
46 |
|
47 |
{ TForm3 } |
48 |
|
49 |
procedure TForm3.SpeedButton1Click(Sender: TObject); |
50 |
begin |
51 |
if OpenDialog1.Execute then |
52 |
Edit3.Text := OpenDialog1.Filename; |
53 |
end; |
54 |
|
55 |
procedure TForm3.FormShow(Sender: TObject); |
56 |
begin |
57 |
Edit1.Text := IBRestoreService1.ServerName; |
58 |
if IBRestoreService1.BackupFileLocation = flServerSide then |
59 |
RadioButton1.Checked := true |
60 |
else |
61 |
RadioButton2.Checked := true; |
62 |
Edit2.Text := IBRestoreService1.DatabaseName[0]; |
63 |
IBRestoreService1.BackupFile.Clear; |
64 |
end; |
65 |
|
66 |
procedure TForm3.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
67 |
begin |
68 |
if ModalResult <> mrOK then Exit; |
69 |
if Edit2.Text = '' then |
70 |
raise Exception.Create('A Database Name must be given'); |
71 |
if Edit3.Text = '' then |
72 |
raise Exception.Create('A Backup File Name must be given'); |
73 |
IBRestoreService1.DatabaseName.Clear; |
74 |
IBRestoreService1.DatabaseName.Add(Edit2.Text); |
75 |
IBRestoreService1.BackupFile.Add(Edit3.Text); |
76 |
if RadioButton1.Checked then |
77 |
IBRestoreService1.BackupFileLocation := flServerSide |
78 |
else |
79 |
IBRestoreService1.BackupFileLocation := flClientSide; |
80 |
if CheckBox1.Checked then |
81 |
IBRestoreService1.Options := IBRestoreService1.Options + [Replace] - [CreateNewDB] |
82 |
else |
83 |
IBRestoreService1.Options := IBRestoreService1.Options - [Replace] + [CreateNewDB] |
84 |
|
85 |
end; |
86 |
|
87 |
end. |
88 |
|