Einzelnen Beitrag anzeigen

neo4a

Registriert seit: 22. Jan 2007
Ort: Ingolstadt
362 Beiträge
 
Delphi XE2 Architect
 
#8

Re: Portable Firebird Server 2.1.3

  Alt 16. Nov 2009, 18:54
Ich habe das Demo-Projekt noch einmal aktiviert (Download).

Hier noch ein paar Infos zur Vorgehensweise und zu verwendeten Tools:

Ein Standard-Firebird-Verzeichnis hat knapp 9MB. Das habe ich in eine Ressourcen-Datei gepackt. Mit BoxedApp kann ich die Ressourcen zur Laufzeit auspacken. Das sieht etwa so aus:

Delphi-Quellcode:
procedure TForm1.StartClick(Sender: TObject);
var s:string;path:string;
begin
  path:=ExtractFilepath(Application.ExeName)+'';
  if not FileExists(path+'\bin\fbclient.dll') then
    CreateVirtualFile(path+'\bin\fbclient.dll','RES__BIN_FBCLIENT_DLL');
  if not FileExists(path+'\bin\fbrmclib.dll') then
    CreateVirtualFile(path+'\bin\fbrmclib.dll','RES__BIN_FBRMCLIB_DLL');
  if not FileExists(path+'\bin\fbserver.exe') then
    CreateVirtualFile(path+'\bin\fbserver.exe','RES__BIN_FBSERVER_EXE');
  if not FileExists(path+'\bin\gbak.exe') then
    CreateVirtualFile(path+'\bin\gbak.exe','RES__BIN_GBAK_EXE');
  if not FileExists(path+'\bin\gfix.exe') then
    CreateVirtualFile(path+'\bin\gfix.exe','RES__BIN_GFIX_EXE');
  if not FileExists(path+'\bin\gsec.exe') then
    CreateVirtualFile(path+'\bin\gsec.exe','RES__BIN_GSEC_EXE');
  if not FileExists(path+'\bin\gstat.exe') then
    CreateVirtualFile(path+'\bin\gstat.exe','RES__BIN_GSTAT_EXE');
  if not FileExists(path+'\bin\ib_util.dll') then
    CreateVirtualFile(path+'\bin\ib_util.dll','RES__BIN_IB_UTIL_DLL');
  if not FileExists(path+'\bin\icudt30.dll') then
    CreateVirtualFile(path+'\bin\icudt30.dll','RES__BIN_ICUDT30_DLL');
  if not FileExists(path+'\bin\icuin30.dll') then
    CreateVirtualFile(path+'\bin\icuin30.dll','RES__BIN_ICUIN30_DLL');
  if not FileExists(path+'\bin\icuuc30.dll') then
    CreateVirtualFile(path+'\bin\icuuc30.dll','RES__BIN_ICUUC30_DLL');
  if not FileExists(path+'\bin\Microsoft.VC80.CRT.manifest') then
    CreateVirtualFile(path+'\bin\Microsoft.VC80.CRT.manifest','RES__BIN_MICROSOFT_VC80_CRT_MANIFEST');
  if not FileExists(path+'\bin\msvcp80.dll') then
    CreateVirtualFile(path+'\bin\msvcp80.dll','RES__BIN_MSVCP80_DLL');
  if not FileExists(path+'\bin\msvcr80.dll') then
    CreateVirtualFile(path+'\bin\msvcr80.dll','RES__BIN_MSVCR80_DLL');
  if not FileExists(path+'\bin\nbackup.exe') then
    CreateVirtualFile(path+'\bin\nbackup.exe','RES__BIN_NBACKUP_EXE');
  if not FileExists(path+'\firebird.conf') then
    CreateVirtualFile(path+'\firebird.conf','RES__FIREBIRD_CONF');
  if not FileExists(path+'\firebird.log') then
    CreateVirtualFile(path+'\firebird.log','RES__FIREBIRD_LOG');
  if not FileExists(path+'\firebird.msg') then
    CreateVirtualFile(path+'\firebird.msg','RES__FIREBIRD_MSG');
  if not FileExists(path+'\intl\fbintl.conf') then
    CreateVirtualFile(path+'\intl\fbintl.conf','RES__INTL_FBINTL_CONF');
  if not FileExists(path+'\intl\fbintl.dll') then
    CreateVirtualFile(path+'\intl\fbintl.dll','RES__INTL_FBINTL_DLL');
  if not FileExists(path+'\security2.fdb') then
    CreateVirtualFile(path+'\security2.fdb','RES__SECURITY2_FDB');
  if not FileExists(path+'\udf\fbudf.dll') then
    CreateVirtualFile(path+'\udf\fbudf.dll','RES__UDF_FBUDF_DLL');
  if not FileExists(path+'\udf\ib_udf.dll') then
    CreateVirtualFile(path+'\udf\ib_udf.dll','RES__UDF_IB_UDF_DLL');
  if not FileExists(path+'\aliases.conf') then begin
    CreateVirtualFile(path+'\aliases.conf',''); //Leere Datei
    CreateAliases(path+'\aliases.conf'); //Sammle die Datenbanken im Unterverzeichnis
  end;
  AliasListBox.Items.LoadFromFile(path+'\aliases.conf');
  if AliasListBox.Items.Count>0 then begin
    AliasListBox.ItemIndex:=0;
    SetCS;
  end;
  fbserverhandle:=0;
  s:=path+'\bin\fbserver.exe';
  caption:=s;
  if FileExists(s) then begin
    Caption:=Format(Application.Title+' (gestartet auf %s)',[JvComputerInfoEx1.Identification.IPAddress]);
    fbserverhandle:=ExecAndWait(s,Format(' -a -n -p %d',[PortEdit.Value])); //Starte den Child-Prozess
  end;
end;

procedure TForm1.StopClick(Sender: TObject);
begin
  if fbserverhandle>0 then begin
    Caption:=Format(Application.Title+' (gestoppt auf %s)',[JvComputerInfoEx1.Identification.IPAddress]);
    TerminateProcess(fbserverhandle, 1);
    CloseHandle(fbserverhandle);
    fbserverhandle:=0;
  end;

end;

initialization

   BoxedAppSDK_Init;

finalization
   BoxedAppSDK_Exit;
Die resultierende Exe hat ca. 11-12 MB, die dann mittels PECompact auf ca. 3MB eingedampft werden kann. Aus Sicht meines Programmes habe ich den FB-Server "voll im Griff" und kann ihn nach Belieben starten/stoppen, Datenbanken sichern, die Konfiguration on the fly anpassen etc. Bestehende Konfiguration sind dabei kein Problem und alles ist ohne Installation voll portabel.

--
Andreas
Andreas
  Mit Zitat antworten Zitat