Subject Re: [IBO] IBOAdmin documentation
Author mspencewasunavailable
--- In IBObjects@yahoogroups.com, Toby Leonard <TobyL@...> wrote:
>
> mspencewasunavailable wrote:
> > I need to let my users do backups and restores from the
application.
> > I've downloaded IBOAdmin, which seems like it ought to be able
to do
> > what I want, and I've managed to successfully compile and
install it.
> >
> > Is there any documentation anywhere on how to use it? Examples
of its
> > use?
>
> Here's the function I use to restore DBs with it. Backup is
pretty much done
> by replacing "Restore" with "Backup" and removing the APageSize
param. We
> only use the embedded version, so no idea if this will work on
Classic.
>
> This is adapted from the examples Helen mentioned.
>
> function RestoreFirebirdDB(
> ABackupFileName, ADBFileName, AUsername, APassword: String;
> AOptions: TRestoreOptions; APageSize: Integer; ASession:
TIB_Session):
> Boolean;
> var
> RestoreSvc: TIBORestoreService;
> begin
> Result := False;
>
> if not FileExists(ABackupFileName) then
> begin
> Exit;
> end;
>
> try
> RestoreSvc := TIBORestoreService.Create(nil);
> try
> RestoreSvc.Session := ASession;
> RestoreSvc.BackupFile.Add(ABackupFileName);
> RestoreSvc.DatabaseName.Add(ADBFileName);
> RestoreSvc.PageSize := APageSize;
> RestoreSvc.Options := AOptions;
> RestoreSvc.LoginPrompt := False;
> RestoreSvc.Params.Add('user_name=' + AUsername);
> RestoreSvc.Params.Add('password=' + APassword);
>
> RestoreSvc.Active := True;
> try
> RestoreSvc.ServiceStart;
> while RestoreSvc.IsServiceRunning do
> begin
> Sleep(1);
> end;
> finally
> RestoreSvc.Active := False;
> end;
>
> Result := True;
> finally
> RestoreSvc.Free;
> end;
> except
> // Trap IBO Admin exceptions and just return False. All
others go through
> // to the caller.
> on EIBOInterBaseError do
> begin
> end;
> on EIBOInterBaseRoleError do
> begin
> end;
> on EIBOClientError do
> begin
> end;
> else
> raise;
> end;
> end;
>
> --
> Toby
>

Thanks, Toby. It seems to work with the superserver version as well.