59 |
|
|
60 |
|
TIBXServicesConnection = class(TIBXMonitoredConnection) |
61 |
|
private |
62 |
+ |
FConfigOverrides: TStrings; |
63 |
|
FDatabase: TIBDatabase; |
64 |
|
FFirebirdAPI: IFirebirdAPI; |
65 |
|
FConnectString: string; |
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; |
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; |
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; |
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; |
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 |
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, |
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; |
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 |
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; |
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; |
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 |
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; |
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 |
|
|