Чтение онлайн

ЖАНРЫ

Советы по Delphi. Версия 1.4.3 от 1.1.2001

Озеров Валентин

Шрифт:

 FParadoxLangDriver : String;

 FMaxFileHandles : Integer;

 FNetFileDir : String;

 FTableLevel : String;

 FBlockSize : Integer;

 FDefaultDriver : String;

 FStrictIntegrity : Boolean;

 FAutoODBC : Boolean;

 procedure Init;

 procedure SetLocalShare(Value : Boolean);

 procedure SetMinBufSize(Value : Integer);

 procedure SetMaxBufSize(Value : Integer);

 procedure SetSystemLangDriver(Value : String);

 procedure SetParadoxLangDriver(Value : String);

 procedure SetMaxFileHandles(Value : Integer);

 procedure SetNetFileDir(Value : String);

 procedure SetTableLevel(Value : String);

 procedure SetBlockSize(Value : Integer);

 procedure SetDefaultDriver(Value : String);

 procedure SetAutoODBC(Value : Boolean);

 procedure SetStrictIntegrity(Value : Boolean);

 procedure UpdateCFGFile(path, item, value : string);

protected

public

 constructor Create(AOwner: TComponent); override;

 destructor Destroy; override;

published

 property LocalShare : Boolean read FLocalShare write SetLocalShare;

 property MinBufSize : Integer read FMinBufSize write SetMinBufSize;

 property MaxBufSize : Integer read FMaxBufSize write SetMaxBufSize;

 property SystemLangDriver : String read FSystemLangDriver write SetSystemLangDriver;

 property ParadoxLangDriver : String read FParadoxLangDriver write SetParadoxLangDriver;

 property MaxFileHandles : Integer read FMaxFileHandles write SetMaxFileHandles;

 property NetFileDir : String read FNetFileDir write SetNetFileDir;

 property TableLevel : String read FTableLevel write SetTableLevel;

 property BlockSize : Integer read FBlockSize write SetBlockSize;

 property DefaultDriver : string read FDefaultDriver write SetDefaultDriver;

 property AutoODBC : Boolean read FAutoODBC write SetAutoODBC;

 property StrictIntegrity : Boolean read FStrictIntegrity write SetStrictIntegrity;

end;

procedure Register;

implementation

function StrToBoolean(Value : string) : Boolean;

begin

 if (UpperCase(Value) = 'TRUE') or (UpperCase(Value) = 'ON') or (UpperCase(Value) = 'YES') or (UpperCase(Value) = '.T.' ) then Result := True

 else Result := False;

end;

function BooleanToStr(Value : Boolean) : String;

begin

 if Value then Result := 'TRUE'

 else Result := 'FALSE';

end;

procedure Register;

begin

 RegisterComponents('Data Access', [TBDEConfig]);

end;

procedure TBDEConfig.Init;

var

 h: hDBICur;

 pCfgDes: pCFGDesc;

 n, v : string;

begin

 Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPersistent,'\SYSTEM\INIT', h));

 GetMem(pCfgDes, sizeof(CFGDesc));

 try

FillChar(pCfgDes^, sizeof(CFGDesc), #0);

while (DbiGetNextRecord(h, dbiWRITELOCK, pCfgDes, nil) = DBIERR_NONE) do begin

n := StrPas(pCfgDes^.szNodeName);

v := StrPas(pCfgDes^.szValue);

if n = 'LOCAL SHARE' then FLocalShare := StrToBoolean(v)

else if n = 'MINBUFSIZE' then FMinBufSize := StrToInt(v)

else if n = 'MAXBUFSIZE' then FMaxBufSize := StrToInt(v)

else if n = 'MAXFILEHANDLES' then FMaxFileHandles := StrToInt(v)

Поделиться с друзьями: