TFBAdmin
From Free Pascal wiki
Jump to navigationJump to searchOverview
Note: TFBAdmin requires FPC version 2.6.2 or higher. Graphical components are included in at least Lazarus 1.2+
TFBAdmin in the FBAdmin unit is used for the administration of the database. It provides the following functionality:
- add, modify or delete database users
- backup and restore databases using single or multiple (split) files
- get general database information
- get the database log file listing important database events and errors
There is also a Lazarus component and demo that allows use of the FPC TFBAdmin component.
Example
This shows how to create a multi file backup of a database on a linux server; 3 backup files, size limited to 600MB; backup progress shown in a TMemo:
procedure TForm1.logadm(Sender: TObject; msg: string; IBAdminAction: string);
begin
Memo1.Lines.add(IBAdminAction+' : '+msg);
end;
procedure TForm1.backup;
var
Admin:TFBAdmin;
sl:TStringList;
begin
Admin:=TFBAdmin.Create(self);
sl:=TStringList.create;
try
Admin.UseExceptions:=true;
Admin.Host:='192.168.2.98';
Admin.Protocol:=IBSPTCPIP;
Admin.User:='sysdba';
Admin.Password:='masterkey';
Admin.Connect;
Admin.OnOutput:=@logadm;
sl.Add('/home/firebird/test.bak1');
sl.Add('/home/firebird/test.bak2');
sl.Add('/home/firebird/test.bak3');
Admin.BackupMultiFile('/home/firebird/test.gdb',sl,600000000,[IBBkpVerbose]);
finally
sl.Destroy;
Admin.Destroy; //disconnects automatically
end;
end;
A demo program is also available in the examples directory of the fcl-db package.
See also
- firebird Using Firebird with FPC/Lazarus sqldb.