Subject Re: [firebird-support] Re: Reorder RDB$Relations for backup
Author Ann W. Harrison
Leon,

I was quite serious about building your own gbak. First, create a
table in your database called BACKUP_ORDER, with fields relation_name
and backup_order. Store all the table names in your database with the
order you want backup to follow.



In the code module burp, look at the file backup.epp. There you'll find
a routine called write_relation. It has two requests like this:

FOR (REQUEST_HANDLE req_handle1)
X IN RDB$RELATIONS WITH X.RDB$SYSTEM_FLAG NE 1 OR
X.RDB$SYSTEM_FLAG MISSING

The second one isn't necessary since no database has been created
without those attributes since InterBase V4, but change both of them
anyway. What you want is

FOR (REQUEST_HANDLE req_handle1)
X IN RDB$RELATIONS CROSS Y IN BACKUP_ORDER
WITH X.RDB$RELATION_NAME = Y.RELATION_NAME AND
(X.RDB$SYSTEM_FLAG NE 1 OR
X.RDB$SYSTEM_FLAG MISSING)
SORTED BY Y.BACKUP_ORDER


Preprocess the file to produce backup.cpp. To do so, you'll need to
create an empty database called yachts.lnk and define the backup_order
table in it. That database should be in the directory with the new
version of the backup.epp The command line is gpre -m <input file>.epp
backup.cpp.

Copy your new backup.cpp into the source tree, replacing the old
backup.cpp and rebuild.

Regards,


Ann