Subject RE: [IBO] Exporting the database directly to the client over the network
Author IBO Support List
I'm sorry but this goes a little bit over my head. I am not sure whether or not the API supports this. IBO only supports whatever the API supports.
 
Jason


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Sunday, August 16, 2015 8:09 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Exporting the database directly to the client over the network

Hi Jason,

I suppose you're referring to TIBOBackupService. So far I have the following code in my demo project:

    LStream := TMemoryStream.Create;
    try
      LBackupService := TIBOBackupService.Create(nil);
      try
        LBackupService.LoginPrompt := False;
        LBackupService.Params.Add('user_name=' + SERVER_USERNAME);
        LBackupService.Params.Add('password=' + SERVER_PASSWORD);
        LBackupService.Options := [IgnoreLimbo];
        LBackupService.Protocol := cpTCP_IP;
        LBackupService.ServerName := SERVER_NAME + '/' + SERVER_PORT;
        LBackupService.DatabaseName := DATABASE_ALIAS;
        LBackupService.BackupFile.Text := 'stdout';
        LBackupService.Attach;
        LBackupService.ServiceStart;
        while not LBackupService.Eof do
        begin
          if Canceled then
          begin
            LBackupService.Detach;
            Exit;
          end;
    
          LChunk := LBackupService.GetNextChunk;
          LStream.WriteBuffer(PChar(LChunk)^, Length(LChunk));
          Application.ProcessMessages;
        end;
      finally
        LBackupService.Free;
      end;
    finally
      LStream.Free;
    end;


I got working backups when I filled in the file name to be an actual file. As pointed out earlier, however, I need the backups to stay in memory. Some data is coming through when I used 'stdout' instead, but depending on whether I use GetNextChunk or GetNextLine, I get no more than a few hundreds of kilobytes at most, whereas the proper backup is around 70MB. Also looking at the contents of those methods, they seem to assume text and do all kinds of decoding.

If IBO in its current state should be able to handle my use case, what changes do I need to make for it to work? Also, can it be done without losing logging? Gbak writes that to stderr when using stdout for data. I don't care so much for all the details, but would like to make sure the backup actually succeeded...

Thanks,