40 |
|
interface |
41 |
|
|
42 |
|
uses |
43 |
< |
Classes, SysUtils, IB, FBParamBlock, FBActivityMonitor; |
43 |
> |
Classes, SysUtils, IB, FBParamBlock, FBActivityMonitor, FBClientAPI; |
44 |
|
|
45 |
|
type |
46 |
|
|
57 |
|
FSPB: ISPB; |
58 |
|
procedure InternalAttach(ConnectString: AnsiString); virtual; abstract; |
59 |
|
public |
60 |
< |
constructor Create(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB; Port: AnsiString = ''); |
60 |
> |
constructor Create(api: TFBClientAPI; ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB; Port: AnsiString = ''); |
61 |
|
destructor Destroy; override; |
62 |
|
public |
63 |
|
{IServiceManager} |
64 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
65 |
|
function getSPB: ISPB; |
66 |
|
function getServerName: AnsiString; |
67 |
|
function getProtocol: TProtocol; |
76 |
|
|
77 |
|
implementation |
78 |
|
|
79 |
< |
uses FBMessages, FBClientAPI, IBUtils; |
79 |
> |
uses FBMessages, IBUtils; |
80 |
|
|
81 |
|
{ TFBServiceManager } |
82 |
|
|
86 |
|
IBError(ibxeServerNameMissing, [nil]); |
87 |
|
end; |
88 |
|
|
89 |
< |
constructor TFBServiceManager.Create(ServerName: AnsiString; |
89 |
> |
constructor TFBServiceManager.Create(api: TFBClientAPI; ServerName: AnsiString; |
90 |
|
Protocol: TProtocol; SPB: ISPB; Port: AnsiString); |
91 |
|
begin |
92 |
|
inherited Create; |
93 |
< |
FFirebirdAPI := FirebirdAPI; {Keep reference to interface} |
93 |
> |
FFirebirdAPI := api.getAPI; {Keep reference to interface} |
94 |
|
FProtocol := Protocol; |
95 |
|
FSPB := SPB; |
96 |
|
FServerName := ServerName; |
104 |
|
inherited Destroy; |
105 |
|
end; |
106 |
|
|
107 |
+ |
function TFBServiceManager.getFirebirdAPI: IFirebirdAPI; |
108 |
+ |
begin |
109 |
+ |
Result := FFirebirdAPI; |
110 |
+ |
end; |
111 |
+ |
|
112 |
|
function TFBServiceManager.getSPB: ISPB; |
113 |
|
begin |
114 |
|
Result := FSPB; |
138 |
|
|
139 |
|
function TFBServiceManager.AllocateSRB: ISRB; |
140 |
|
begin |
141 |
< |
Result := TSRB.Create; |
141 |
> |
Result := TSRB.Create(FFirebirdAPI as TFBClientAPI); |
142 |
|
end; |
143 |
|
|
144 |
|
function TFBServiceManager.AllocateSQPB: ISQPB; |
145 |
|
begin |
146 |
< |
Result := TSQPB.Create; |
146 |
> |
Result := TSQPB.Create(FFirebirdAPI as TFBClientAPI); |
147 |
|
end; |
148 |
|
|
149 |
|
function TFBServiceManager.Query(Request: ISRB; RaiseExceptionOnError: boolean |