ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/iblocaldb/IBXCreateDatabaseDlg.pas
(Generate patch)

Comparing ibx/trunk/iblocaldb/IBXCreateDatabaseDlg.pas (file contents):
Revision 37 by tony, Mon Feb 15 14:44:25 2016 UTC vs.
Revision 80 by tony, Mon Jan 1 11:31:07 2018 UTC

# Line 56 | Line 56 | type
56   var
57    CreateDatabaseDlg: TCreateDatabaseDlg;
58  
59 + function RestoreDatabaseFromArchive(DBName: string; DBParams: TStrings; aFilename: string): boolean;
60 +
61 + function CreateNewDatabase(DBName: string; DBParams: TStrings; DBArchive: string): boolean;
62 +
63   implementation
64  
65 + function RestoreDatabaseFromArchive(DBName: string; DBParams: TStrings;
66 +  aFilename: string): boolean;
67 + begin
68 + with TCreateDatabaseDlg.Create(Application) do
69 + try
70 +   if (aFilename = '') or not FileExists(aFileName) then
71 +   begin
72 +    OpenDialog1.InitialDir := GetUserDir;
73 +    if OpenDialog1.Execute then
74 +      aFilename := OpenDialog1.FileName
75 +    else
76 +      Exit;
77 +   end;
78 +   IBRestoreService1.SetDBParams(DBParams);
79 +   IBRestoreService1.BackupFile.Clear;
80 +   IBRestoreService1.DatabaseName.Clear;
81 +   IBRestoreService1.Options := [replace];
82 +   IBRestoreService1.BackupFile.Add(aFilename);
83 +   IBRestoreService1.DatabaseName.Add(DBName);
84 +   Result := ShowModal = mrOK;
85 + finally
86 +   Free
87 + end;
88 + end;
89 +
90 + function CreateNewDatabase(DBName: string; DBParams: TStrings; DBArchive: string
91 +  ): boolean;
92 + begin
93 + with TCreateDatabaseDlg.Create(Application) do
94 + try
95 +  IBRestoreService1.SetDBParams(DBParams);
96 +  IBRestoreService1.BackupFile.Clear;
97 +  IBRestoreService1.DatabaseName.Clear;
98 +  IBRestoreService1.Options := [CreateNewDB];
99 +  IBRestoreService1.BackupFile.Add(DBArchive);
100 +  IBRestoreService1.DatabaseName.Add(DBName);
101 +  Result := ShowModal = mrOK;
102 + finally
103 +   Free
104 + end
105 + end;
106 +
107   {$R *.lfm}
108  
109   procedure TCreateDatabaseDlg.FormShow(Sender: TObject);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines