Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit ModelDbSettings;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, IniSettings, ModelPath;
- {$I const.inc}
- type
- { TModelDbSettings }
- TModelDbSettings = class
- private
- FIniSettings:TIniSettings;
- FPath:TModelPath;
- FDbDriver:String;
- FDbUser:String;
- FDbPassword:String;
- FDbLibrary:String;
- public
- Constructor Create;
- procedure DbSettings;
- published
- property DbDriver:String read FDbDriver;
- property DbUser:String read FDbUser;
- property DbPassword:String read FDbPassword;
- property DbLibrary:String read FDbLibrary;
- property FDbIni:TIniSettings read FIniSettings;
- end;
- implementation
- { TModelDbSettings }
- constructor TModelDbSettings.Create;
- begin
- FIniSettings:=TIniSettings.Create(Company+'.ini');
- //bug masih blm bisa utk cek bila ada files
- if FIniSettings.IsExists then
- FIniSettings.Save
- else
- begin
- FIniSettings.Save;
- DbSettings;
- end;
- FPath:=TModelPath.Create;
- FPath.Add('lib');
- FDbLibrary:=FPath.Get('lib')+DS;
- FDbUser:=DB_USER;
- FDbPassword:=DB_PASSWORD;
- end;
- procedure TModelDbSettings.DbSettings;
- begin
- with FIniSettings do
- begin
- Header('$Database$');
- Write('Server');
- //Write('Port');
- Write('Path');
- Write('Name');
- //Write('Protocol');
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment