ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/runtime/nongui/IBDatabase.pas
(Generate patch)

Comparing ibx/trunk/runtime/nongui/IBDatabase.pas (file contents):
Revision 266 by tony, Wed Dec 26 18:34:32 2018 UTC vs.
Revision 267 by tony, Fri Dec 28 10:44:23 2018 UTC

# Line 185 | Line 185 | type
185    private
186      FCloseAction: TIBDatabaseCloseActions;
187      FAttachment: IAttachment;
188 +    FConfigOverrides: TStrings;
189      FCreateDatabase: boolean;
190      FCreateIfNotExists: boolean;
191      FAllowStreamedConnected: boolean;
# Line 210 | Line 211 | type
211      FUseDefaultSystemCodePage: boolean;
212      FUseHiddenPassword: boolean;
213      FFirebirdAPI: IFirebirdAPI;
213    FWireCompression: boolean;
214      procedure EnsureInactive;
215      function GetAuthenticationMethod: string;
216      function GetDBSQLDialect: Integer;
# Line 220 | Line 220 | type
220      function GetFirebirdAPI: IFirebirdAPI;
221      function GetRemoteProtocol: string;
222      function GetSQLObjectsCount: Integer;
223 +    function GetWireCompression: boolean;
224 +    procedure SetConfigOverrides(AValue: TStrings);
225      procedure SetFirebirdLibraryPathName(AValue: TIBFileName);
226      procedure SetSQLDialect(const Value: Integer);
227 +    procedure SetWireCompression(AValue: boolean);
228      procedure ValidateClientSQLDialect;
229      procedure DBParamsChange(Sender: TObject);
230      procedure DBParamsChanging(Sender: TObject);
231 +    function GenerateDPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): IDPB;
232      function GetSQLObject(Index: Integer): TIBBase;
233      function GetSQLObjectCount: Integer;
234      function GetIdleTimer: Integer;
# Line 303 | Line 307 | type
307      property FirebirdLibraryPathName: TIBFileName read FFirebirdLibraryPathName
308                                               write SetFirebirdLibraryPathName;
309      property Params: TStrings read FDBParams write SetDBParams;
310 +    property ConfigOverrides: TStrings read FConfigOverrides write SetConfigOverrides;
311      property LoginPrompt default True;
312      property DefaultTransaction: TIBTransaction read FDefaultTransaction
313                                                   write SetDefaultTransaction;
# Line 312 | Line 317 | type
317      property TraceFlags: TTraceFlags read FTraceFlags write FTraceFlags;
318      property UseDefaultSystemCodePage: boolean read FUseDefaultSystemCodePage
319                                                 write FUseDefaultSystemCodePage;
320 <    property WireCompression: boolean read FWireCompression write FWireCompression;
320 >    property WireCompression: boolean read GetWireCompression write SetWireCompression
321 >             stored false;
322      property AfterConnect;
323      property AfterDisconnect;
324      property BeforeConnect;
# Line 378 | Line 384 | type
384      function AddSQLObject(ds: TIBBase): Integer;
385      procedure RemoveSQLObject(Idx: Integer);
386      procedure RemoveSQLObjects;
387 +    function GenerateTPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): ITPB;
388  
389    protected
390      procedure Loaded; override;
# Line 505 | Line 512 | type
512                                            write SetTransaction;
513    end;
514  
508 function GenerateDPB(FirebirdAPI: IFirebirdAPI; sl: TStrings; WireCompression: boolean): IDPB;
509 function GenerateTPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): ITPB;
510
515  
516   implementation
517  
# Line 522 | Line 526 | begin
526    LoginPrompt := True;
527    FSQLObjects := TList.Create;
528    FTransactions := TList.Create;
529 +  FConfigOverrides := TStringList.Create;
530    FDBName := '';
531    FDBParams := TStringList.Create;
532    FSQLHourGlass := true;
# Line 558 | Line 563 | begin
563    RemoveSQLObjects;
564    RemoveTransactions;
565    FInternalTransaction.Free;
566 +  FConfigOverrides.Free;
567    FDBParams.Free;
568    FSQLObjects.Free;
569    FTransactions.Free;
# Line 1096 | Line 1102 | begin
1102       begin
1103         FDBParamsChanged := False;
1104         if not FUseHiddenPassword and (not LoginPrompt and not (csDesigning in ComponentState)) or (FHiddenPassword = '') then
1105 <         DPB := GenerateDPB(FirebirdAPI,TempDBParams,WireCompression)
1105 >         DPB := GenerateDPB(FirebirdAPI,TempDBParams)
1106         else
1107         begin
1108            TempDBParams.Values['password'] := FHiddenPassword;
1109 <          DPB := GenerateDPB(FirebirdAPI,TempDBParams,WireCompression);
1109 >          DPB := GenerateDPB(FirebirdAPI,TempDBParams);
1110         end;
1111       end;
1112  
# Line 1364 | Line 1370 | begin
1370      IBError(ibxeSQLDialectInvalid, [nil]);
1371   end;
1372  
1373 + procedure TIBDataBase.SetWireCompression(AValue: boolean);
1374 + var Index: integer;
1375 + begin
1376 +  if AValue then
1377 +    FConfigOverrides.Values['WireCompression'] := 'true'
1378 +  else
1379 +  begin
1380 +    Index := FConfigOverrides.IndexOfName('WireCompression');
1381 +    if Index <> -1 then
1382 +      FConfigOverrides.Delete(Index);
1383 +  end;
1384 + end;
1385 +
1386   function TIBDataBase.GetDBSQLDialect: Integer;
1387   begin
1388    CheckActive;
# Line 1422 | Line 1441 | begin
1441    Result := FSQLObjects.Count;
1442   end;
1443  
1444 + function TIBDataBase.GetWireCompression: boolean;
1445 + begin
1446 +  Result := CompareText(FConfigOverrides.Values['WireCompression'],'true') = 0;
1447 + end;
1448 +
1449 + procedure TIBDataBase.SetConfigOverrides(AValue: TStrings);
1450 + begin
1451 +  if FConfigOverrides = AValue then Exit;
1452 +  FConfigOverrides.Assign(AValue);
1453 + end;
1454 +
1455   procedure TIBDataBase.SetFirebirdLibraryPathName(AValue: TIBFileName);
1456   begin
1457    if FFirebirdLibraryPathName = AValue then Exit;
# Line 2318 | Line 2348 | end;
2348    parameter buffer, and return it and its length
2349    in DPB and DPBLength, respectively. }
2350  
2351 < function GenerateDPB(FirebirdAPI: IFirebirdAPI; sl: TStrings; WireCompression: boolean): IDPB;
2351 > function TIBDatabase.GenerateDPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): IDPB;
2352   var
2353    i, j: Integer;
2354    DPBVal: UShort;
# Line 2389 | Line 2419 | begin
2419        end;
2420      end;
2421    end;
2422 <  if WireCompression then
2423 <    Result.Add(isc_dpb_config).SetAsString('WireCompression=true');
2422 >  if FConfigOverrides.Count > 0 then
2423 >    Result.Add(isc_dpb_config).SetAsString(FConfigOverrides.Text);
2424   end;
2425  
2426   { GenerateTPB -
# Line 2398 | Line 2428 | end;
2428    of the transaction parameters, generate a transaction
2429    parameter buffer, and return it and its length in
2430    TPB and TPBLength, respectively. }
2431 < function GenerateTPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): ITPB;
2431 > function TIBTransaction.GenerateTPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): ITPB;
2432   var
2433    i, j, TPBVal: Integer;
2434    ParamName, ParamValue: string;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines