home *** CD-ROM | disk | FTP | other *** search
Wrap
unit UnitMain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, CoolDBUtils, StdCtrls, Db, DbTables, ExtCtrls, Buttons; type TForm1 = class(TForm) CoolDBBackup1: TCoolDBBackup; CoolDBStructureRestorer1: TCoolDBStructureRestorer; CoolDBUpdater21: TCoolDBUpdater2; ProgressBar1: TProgressBar; LabelProgress: TLabel; CoolDBStructureExporter1: TCoolDBStructureExporter; Bevel4: TBevel; BitBtn1: TBitBtn; RadioGroup1: TRadioGroup; LabelInfo: TLabel; CoolDBPack1: TCoolDBPack; BitBtn2: TBitBtn; procedure FormCreate(Sender: TObject); procedure CoolDBBackup1ActionInProgress(Sender: TObject; TablesNum: Integer; CurName: String; CurNum: Integer); procedure CoolDBBackup1ExecuteEnd(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure RadioGroup1Click(Sender: TObject); private Folder_DB, Folder_Backup, Folder_DBNew, Folder_DBModified, File_Structure: TFileName; public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.FormCreate(Sender: TObject); begin Folder_DB := ExtractFilePath(ParamStr(0)) + 'Database'; Folder_Backup := ExtractFilePath(ParamStr(0)) + 'Backup'; Folder_DBNew := ExtractFilePath(ParamStr(0)) + 'Database_New'; Folder_DBModified := ExtractFilePath(ParamStr(0)) + 'Database_Modified'; File_Structure := ExtractFilePath(ParamStr(0)) + 'Demo.dbs'; LabelProgress.Caption := ''; RadioGroup1Click(Self); end; procedure TForm1.CoolDBBackup1ActionInProgress(Sender: TObject; TablesNum: Integer; CurName: String; CurNum: Integer); begin LabelProgress.Caption := CurName; ProgressBar1.Max := TablesNum; ProgressBar1.Position := CurNum; end; procedure TForm1.CoolDBBackup1ExecuteEnd(Sender: TObject); begin LabelProgress.Caption := ''; ProgressBar1.Max := 0; ProgressBar1.Position := 0; end; procedure TForm1.BitBtn1Click(Sender: TObject); begin case RadioGroup1.ItemIndex of 0: begin with CoolDBBackup1 do begin DatabaseName := Folder_DB; DatabaseBackupName := Folder_Backup; Execute; end; end; 1: begin with CoolDBPack1 do begin DatabaseName := Folder_DB; Execute; end; end; 2: begin with CoolDBStructureExporter1 do begin DatabaseName := Folder_DBModified; FileName := File_Structure; Execute; end; end; 3: begin with CoolDBStructureRestorer1 do begin DatabaseName := Folder_DBNew; FileName := File_Structure; Execute; end; end; 4: begin with CoolDBUpdater21 do begin DatabaseName := Folder_DB; DatabaseImporterName := Folder_DBNew; Execute; end; end; end; end; procedure TForm1.RadioGroup1Click(Sender: TObject); begin case RadioGroup1.ItemIndex of 0: LabelInfo.Caption := 'You can back up existing DB you have in "Database" folder... Copy of the database will be placed to "Backup" folder.'; 1: LabelInfo.Caption := 'You can pack your database physically removing already deleted rows'; 2: LabelInfo.Caption := 'Here you save structure of database from "Database_Modified" folder on disk "Demo.dbs" file...'; 3: LabelInfo.Caption := 'Now restore database whose structure was previosly saved in "Demo.dbs" file... Database will be placed to "Database_New" folder.'; 4: LabelInfo.Caption := 'Now update DB in "Database" folder so that its structure will match to sttructure of DB from "Database_New" folder...'; end; end; end.