qlixes

FirebirdDbSettings

May 6th, 2015
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.74 KB | None | 0 0
  1. unit FirebirdDbSettings;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, ModelDbSettings;
  9.  
  10. const
  11.   protocol = 'firebird-2.5';
  12.   port = '3050';
  13.   {$IFDEF MSWINDOWS}
  14.     DbLib = 'fbclient.dll';
  15.   {$ENDIF}
  16.   {$IFDEF UNIX}
  17.     DbLib = 'libfbclient.so.2.5.3';
  18.   {$ENDIF}
  19.  
  20. type
  21.  
  22.   { TDbSettings }
  23.  
  24.   TFirebirdDbSettings = class(TModelDbSettings)
  25.   protected
  26.     //FDbSettings:TModelDbSettings;
  27.     FDbHost: String;
  28.     FDbLibrary: String;
  29.     FDbName: String;
  30.     FDbPassword: String;
  31.     FDbPath: String;
  32.     FDbPort: Word;
  33.     FDbProtocol: String;
  34.     FDbUser: String;
  35.   public
  36.     Constructor Create;
  37.   published
  38.     property DbHost:String read FDbHost;
  39.     property DbPort:Word read FDbPort;
  40.     property DbPath:String read FDbPath;
  41.     property DbName:String read FDbName;
  42.     property DbUser:String read FDbUser;
  43.     property DbPassword:String read FDbPassword;
  44.     property DbProtocol:String read FDbProtocol;
  45.     property DbLibrary:String read FDbLibrary;
  46.   end;
  47.  
  48. implementation
  49.  
  50. { TDbSettings }
  51.  
  52. constructor TFirebirdDbSettings.Create;
  53. begin
  54.   with self.FDbIni do
  55.   begin
  56.     //Create('HSoft.ini');
  57.     //Write('Server');
  58.     Header('firebird');
  59.     FDbHost:=Read('Server','localhost');
  60.     Write('Port',port);
  61.     FDbPort:=strtoint(Read('Port',port));
  62.     //Write('Path');
  63.     FDbPath:=Read('Path');
  64.     //Write('Name');
  65.     FDbName:=Read('Name');
  66.     //Write('User');
  67.     //FDbUser:=Read('User',DbUser);
  68.     FDbUser:=self.DbUser;
  69.     //Write('Password');
  70.     //FDbPassword:=Read('Password',DbPassword);
  71.     FDbPassword:=self.DbPassword;
  72.     Write('Protocol',protocol);
  73.     FDbProtocol:=Read('Protocol',protocol);
  74.     BackupSettings;
  75.   end;
  76.   FDbLibrary:=self.DbLibrary+DbLib;
  77. end;
  78.  
  79. end.
Advertisement
Add Comment
Please, Sign In to add comment