Delphi 7 + IBX + FB 1.5.2.4787

1. Pessoal, como descobrir se houve algum erro durante o evento de restore 
abaixo
2. Um simples Try/Except resvolveria para tratar os erros no evento abaixo?

Um abraço,

Valdir Marcos


http://bdn.borland.com/article/borcon/files/6100/paper/6100.html#IBBackupService

procedure TMainForm.BackupBtnClick(Sender: TObject);
begin
  with IBRestoreService
  begin
    BuMemo.Lines.Clear;
    try
      ShowWait;
      Active := True;
      ServiceStart;
      while not EOF do      begin
        BuMemo.Lines.Add(GetNextLine);        Application.ProcessMessages;      
 end;       end;
    finally
      Active := False;
      ShowNormal;
    end; //try
  end; //with
end;
IBRestoreServiceUsing IBRestoreService you can restore a backup made with 
IBBackupService or gbak. The following code from the sample application sets 
the properties required to restore the database.procedure 
TMainDm.SetIbRestoreProperties;
begin
  with IBRestore do
  begin
    SetCommonProperties(IBRestore);
    Verbose := True;
    DatabaseName.Clear;
    DatabaseName.Add(IbDbPath + IbDbName);
    BackupFile.Clear;
    BackupFile.Add(IbDbPath + IbDbBackup);
  end; //with
end;
Note that unlike IBBackupService the DatabaseName property of IBRestoreService 
is of type TStrings so you can create a multi-file database as part of the 
restore operation. You can also set the PageSize and PageBuffers properties if 
you want the page size or cache size of the restored database to differ from 
the original. In addition, the Options property provides all of the options 
provided by gbak as shown in the following table.DeactivateIndexes Do not 
rebuild indexes during the restore. NoShadow Do not recreate database shadow 
files. NoValidityCheck Do not restore data constraints. OneRelationAtATime 
Restore the metadata and data for each table together. Replace Overwrite the 
exiting database. CreateNewDb Create a new database file. UseAllSpace Does not 
reserve space on each data page for record versions. Useful for restoring a 
read-only database to make it as small as possible. The following code is the 
OnClick event for the Restore Database button.procedure 
TMainForm.RestoreBtnClick(Sender: TObject);
begin
  with MainDm.IBRestore do
  begin
    BuMemo.Lines.Clear;
    try
      ShowWait;
      Active := True;
      ServiceStart;
      while not EOF do
        BuMemo.Lines.Add(GetNextLine);
    finally
      Active := False;
      ShowNormal;
    end; //try
  end; //with
end;
This code is virtually identical to the code used to backup the database. Once 
again the Verbose property is set to True and the progress messages are added 
to the memo component by the while loop. 

[As partes desta mensagem que não continham texto foram removidas]



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

<*> Para ver as mensagens antigas, acesse:
    http://br.groups.yahoo.com/group/delphi-br/messages

<*> Para falar com o moderador, envie um e-mail para:
    [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a