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

Comparing ibx/trunk/runtime/nongui/IBXServices.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 59 | Line 59 | type
59  
60    TIBXServicesConnection = class(TIBXMonitoredConnection)
61    private
62 +    FConfigOverrides: TStrings;
63      FDatabase: TIBDatabase;
64      FFirebirdAPI: IFirebirdAPI;
65      FConnectString: string;
# Line 73 | Line 74 | type
74      FProtocol: TProtocol;
75      FServerVersionNo: array [1..4] of integer;
76      FExpectedDB: string;
76    FWireCompression: boolean;
77      procedure CheckActive;
78      procedure CheckInactive;
79      procedure CheckServerName;
# Line 81 | Line 81 | type
81      function GetFirebirdAPI: IFirebirdAPI;
82      function GetServerVersionNo(index: integer): integer;
83      function GetSPBConstName(action: byte): string;
84 +    function GetWireCompression: boolean;
85      procedure HandleException(Sender: TObject);
86      procedure HandleSecContextException(Sender: TIBXControlService; var action: TSecContextAction);
87      function Login(var aServerName: string; LoginParams: TStrings): Boolean;
88      procedure ParamsChanging(Sender: TObject);
89 +    procedure SetConfigOverrides(AValue: TStrings);
90      procedure SetConnectString(AValue: string);
91      procedure SetFirebirdLibraryPathName(AValue: TIBFileName);
92      procedure SetParams(AValue: TStrings);
93      procedure SetPortNo(AValue: string);
94      procedure SetProtocol(AValue: TProtocol);
95      procedure SetServerName(AValue: string);
96 +    procedure SetWireCompression(AValue: boolean);
97    protected
98      procedure DoConnect; override;
99      procedure DoDisconnect; override;
# Line 114 | Line 117 | type
117    published
118      property Connected;
119      property ConnectString: string read FConnectString write SetConnectString;
120 +    property ConfigOverrides: TStrings read FConfigOverrides write SetConfigOverrides;
121      property FirebirdLibraryPathName: TIBFileName read FFirebirdLibraryPathName
122                                               write SetFirebirdLibraryPathName;
123      property LoginPrompt default True;
# Line 122 | Line 126 | type
126      property Params: TStrings read FParams write SetParams;
127      property ServerName: string read FServerName write SetServerName;
128      property TraceFlags;
129 <    property WireCompression: boolean read FWireCompression write FWireCompression;
129 >    property WireCompression: boolean read GetWireCompression write SetWireCompression
130 >                stored false;
131      property AfterConnect;
132      property AfterDisconnect;
133      property BeforeConnect;
# Line 2779 | Line 2784 | end;
2784   }
2785   function TIBXServicesConnection.GenerateSPB(sl: TStrings): ISPB;
2786   var
2787 <  i, j, SPBServerVal: UShort;
2787 >  i, j: integer;
2788 >  SPBServerVal: UShort;
2789    param_name, param_value: String;
2790   begin
2791    { The SPB is initially empty, with the exception that
# Line 2789 | Line 2795 | begin
2795  
2796    { Iterate through the textual service parameters, constructing
2797     a SPB on-the-fly }
2792  if sl.Count > 0 then
2798    for i := 0 to sl.Count - 1 do
2799    begin
2800     { Get the parameter's name and value from the list,
# Line 2827 | Line 2832 | begin
2832        end;
2833      end;
2834    end;
2835 <  if WireCompression then
2836 <    Result.Add(isc_spb_config).AsString := 'WireCompression=true';
2835 >  if FConfigOverrides.Count > 0 then
2836 >    Result.Add(isc_spb_config).SetAsString(FConfigOverrides.Text);
2837   end;
2838  
2839   function TIBXServicesConnection.GetFirebirdAPI: IFirebirdAPI;
# Line 2869 | Line 2874 | begin
2874      end;
2875   end;
2876  
2877 + function TIBXServicesConnection.GetWireCompression: boolean;
2878 + begin
2879 +  Result := CompareText(FConfigOverrides.Values['WireCompression'],'true') = 0;
2880 + end;
2881 +
2882   procedure TIBXServicesConnection.HandleException(Sender: TObject);
2883   var aParent: TComponent;
2884   begin
# Line 2969 | Line 2979 | begin
2979    CheckInactive;
2980   end;
2981  
2982 + procedure TIBXServicesConnection.SetConfigOverrides(AValue: TStrings);
2983 + begin
2984 +  if FConfigOverrides = AValue then Exit;
2985 +  FConfigOverrides.Assign(AValue);
2986 + end;
2987 +
2988   procedure TIBXServicesConnection.SetConnectString(AValue: string);
2989   var aServiceName: AnsiString;
2990      aProtocol: TProtocolAll;
# Line 3007 | Line 3023 | begin
3023    FConnectString := MakeConnectString(FServerName,'service_mgr',FProtocol,FPortNo);
3024   end;
3025  
3026 + procedure TIBXServicesConnection.SetWireCompression(AValue: boolean);
3027 + var Index: integer;
3028 + begin
3029 +  if AValue then
3030 +    FConfigOverrides.Values['WireCompression'] := 'true'
3031 +  else
3032 +  begin
3033 +    Index := FConfigOverrides.IndexOfName('WireCompression');
3034 +    if Index <> -1 then
3035 +      FConfigOverrides.Delete(Index);
3036 +  end;
3037 + end;
3038 +
3039   procedure TIBXServicesConnection.DoConnect;
3040  
3041    procedure ParseServerVersionNo;
# Line 3058 | Line 3087 | begin
3087    {Get Connect String from Database Connect String}
3088    begin
3089      FFirebirdAPI := FDatabase.FirebirdAPI;
3090 +    FConfigOverrides.Assign(FDatabase.ConfigOverrides);
3091      if ParseConnectString(FDatabase.Attachment.GetConnectString,aServerName,aDBName,aProtocol,aPortNo) and
3092        (aProtocol = Local) and
3093        (FDatabase.Attachment.GetRemoteProtocol <> '') then
# Line 3160 | Line 3190 | begin
3190    inherited Create(AOwner);
3191    FServerName := '';
3192    FParams := TStringList.Create;
3193 +  FConfigOverrides := TStringList.Create;
3194    Setlength(FIBXServices,0);
3195    TStringList(FParams).OnChanging := @ParamsChanging;
3196    FService := nil;
# Line 3176 | Line 3207 | begin
3207    inherited Destroy;
3208    Setlength(FIBXServices,0);
3209    if assigned(FParams) then FParams.Free;
3210 +  if assigned (FConfigOverrides) then FConfigOverrides.Free;
3211    FFirebirdAPI := nil;
3212   end;
3213  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines