Subject Re: [ib-support] Two problems/questions with GBAK
Author Artur Anjos
Hi Joe,

I have the same exact problems. The only way that I found was to delete the
file first. Let me talk about my experience:

I'm not using the return value from GBak. I ask for help with this
ERRORLEVEL code too, but - sorry - I don't remember what where the results.

I'm parsing the output file and watch for an error or for the ok message.

Once (few months ago) I post (twice) a feature request to FB in
firebird-devel@ asking for someone to put NUMERIC ERROR CODES on the
messages of this log. I hate to parse for strings, and I really think that
Numeric Error Codes is a must in a log file. I did not have a single answer
for this (except Helen - this time without the hat that I like so much -
saying that she misses Numeric Error Codes too).

( Sean, are you there?! Please, please, please, we need Numeric Error Codes
in GBak! )

What I'm doing now is simple: since we can not trust in GBAK backup files,
once I do the backup I restore it to a 'temporary' place (I delete the log
first). Next, I parse the log file and see if GBAK 'Went Home' or not. Like
a child, if it doesn't I call all the hospitals, police and fireman's....

Small Note: I never found a way to test and debug this in a good way. For
example, I'm not sure if some errors just stop GBak, or maybe there were
just 'warnings' and it still going home happily.

I take this approach because was the only way to make sure that I had a
reliable backup. Still got some problems to deal with: I need more or less
2.5x times the size of database of free space in the hard disk, sometimes
the restore operation could be really slow (and take some resources from the
server), ...

Also I had some problems to get an ASCII file with the error messages, but
Carlos Macao give me this help. If you want all error messages in a file I
can give this to you.


Hope this helps,

Artur

----- Original Message -----
From: "Joe Martinez" <joe@...>
To: "Interbase Support" <ib-support@yahoogroups.com>
Sent: Friday, May 03, 2002 9:03 PM
Subject: [ib-support] Two problems/questions with GBAK


> I'm trying to call GBAK from my application to provide a backup
> function. I am using FB 1.0, and calling GBAK.EXE via WinExec().
>
> Problems:
>
> 1) If I use the -Y switch to redirect the output to a file, that only
> works if the specified output file does not already exist. If it
> already exists, it neither overwrites nor appends to the file. It just
> does nothing with the output. Is there any way of making it overwrite
> the file?
>
> 2) I believe I read in a previous post, that in Windows, you could read
> the return value from GBAK to see if the backup was successful or not.
> When I call WinExec, I always get the same return value (33), whether
> the backup was successful or not. According to the Win32 reference, a
> return code greater than 31 means success, but I'm guessing that that's
> only telling me that it successfully called GBAK. It seems to be saying
> nothing about the actual return code from GBAK. How can I get that?
>
> Thanks,
> Joe
>