70 |
|
when this class is freed and last reference to IStatus |
71 |
|
goes out of scope.} |
72 |
|
procedure CheckPlugins; |
73 |
– |
protected |
74 |
– |
{$IFDEF UNIX} |
75 |
– |
function GetFirebirdLibList: string; override; |
76 |
– |
{$ENDIF} |
77 |
– |
procedure LoadInterface; override; |
73 |
|
public |
74 |
< |
constructor Create; |
74 |
> |
constructor Create(aFBLibrary: TFBLibrary); |
75 |
|
destructor Destroy; override; |
76 |
|
|
77 |
|
function StatusIntf: Firebird.IStatus; |
78 |
|
procedure Check4DataBaseError; |
79 |
|
function InErrorState: boolean; |
80 |
+ |
function LoadInterface: boolean; override; |
81 |
+ |
function GetAPI: IFirebirdAPI; override; |
82 |
+ |
{$IFDEF UNIX} |
83 |
+ |
function GetFirebirdLibList: string; override; |
84 |
+ |
{$ENDIF} |
85 |
|
|
86 |
|
public |
87 |
|
{IFirebirdAPI} |
129 |
|
property ProviderIntf: Firebird.IProvider read FProvider; |
130 |
|
end; |
131 |
|
|
132 |
– |
var Firebird30ClientAPI: TFB30ClientAPI; |
133 |
– |
|
132 |
|
implementation |
133 |
|
|
134 |
|
uses FBParamBlock, FB30Attachment, {$IFDEF FPC}dynlibs{$ELSE} windows{$ENDIF}, |
197 |
|
end; |
198 |
|
{$ENDIF} |
199 |
|
|
200 |
< |
procedure TFB30ClientAPI.LoadInterface; |
200 |
> |
function TFB30ClientAPI.LoadInterface: boolean; |
201 |
|
var |
202 |
|
fb_get_master_interface: Tfb_get_master_interface; |
203 |
|
begin |
204 |
< |
inherited LoadInterface; |
205 |
< |
fb_get_master_interface := GetProcAddress(IBLibrary, 'fb_get_master_interface'); {do not localize} |
204 |
> |
Result := inherited LoadInterface; |
205 |
> |
fb_get_master_interface := GetProcAddress(GetFBLibrary.GetHandle, 'fb_get_master_interface'); {do not localize} |
206 |
|
if assigned(fb_get_master_interface) then |
207 |
|
begin |
208 |
|
FMaster := fb_get_master_interface; |
211 |
|
FConfigManager := FMaster.getConfigManager; |
212 |
|
CheckPlugins; |
213 |
|
end; |
214 |
+ |
Result := Result and HasMasterIntf; |
215 |
+ |
end; |
216 |
+ |
|
217 |
+ |
function TFB30ClientAPI.GetAPI: IFirebirdAPI; |
218 |
+ |
begin |
219 |
+ |
Result := self; |
220 |
|
end; |
221 |
|
|
222 |
< |
constructor TFB30ClientAPI.Create; |
222 |
> |
constructor TFB30ClientAPI.Create(aFBLibrary: TFBLibrary); |
223 |
|
begin |
224 |
< |
inherited; |
224 |
> |
inherited Create(aFBLibrary); |
225 |
|
FStatus := TFB30Status.Create(self); |
226 |
|
FStatusIntf := FStatus; |
223 |
– |
Firebird30ClientAPI := self; |
227 |
|
end; |
228 |
|
|
229 |
|
destructor TFB30ClientAPI.Destroy; |
257 |
|
|
258 |
|
function TFB30ClientAPI.AllocateDPB: IDPB; |
259 |
|
begin |
260 |
< |
Result := TDPB.Create; |
260 |
> |
Result := TDPB.Create(self); |
261 |
|
end; |
262 |
|
|
263 |
|
function TFB30ClientAPI.AllocateTPB: ITPB; |
264 |
|
begin |
265 |
< |
Result := TTPB.Create; |
265 |
> |
Result := TTPB.Create(self); |
266 |
|
end; |
267 |
|
|
268 |
|
function TFB30ClientAPI.OpenDatabase(DatabaseName: AnsiString; DPB: IDPB; |
269 |
|
RaiseExceptionOnConnectError: boolean): IAttachment; |
270 |
|
begin |
271 |
< |
Result := TFB30Attachment.Create(DatabaseName, DPB, RaiseExceptionOnConnectError); |
271 |
> |
Result := TFB30Attachment.Create(self,DatabaseName, DPB, RaiseExceptionOnConnectError); |
272 |
|
if not Result.IsConnected then |
273 |
|
Result := nil; |
274 |
|
end; |
276 |
|
function TFB30ClientAPI.CreateDatabase(DatabaseName: AnsiString; DPB: IDPB; |
277 |
|
RaiseExceptionOnError: boolean): IAttachment; |
278 |
|
begin |
279 |
< |
Result := TFB30Attachment.CreateDatabase(DatabaseName,DPB, RaiseExceptionOnError); |
279 |
> |
Result := TFB30Attachment.CreateDatabase(self,DatabaseName,DPB, RaiseExceptionOnError); |
280 |
|
if not Result.IsConnected then |
281 |
|
Result := nil; |
282 |
|
end; |
284 |
|
function TFB30ClientAPI.CreateDatabase(sql: AnsiString; aSQLDialect: integer; |
285 |
|
RaiseExceptionOnError: boolean): IAttachment; |
286 |
|
begin |
287 |
< |
Result := TFB30Attachment.CreateDatabase(sql,aSQLDialect, RaiseExceptionOnError); |
287 |
> |
Result := TFB30Attachment.CreateDatabase(self,sql,aSQLDialect, RaiseExceptionOnError); |
288 |
|
if not Result.IsConnected then |
289 |
|
Result := nil; |
290 |
|
end; |
292 |
|
function TFB30ClientAPI.StartTransaction(Attachments: array of IAttachment; |
293 |
|
TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction; |
294 |
|
begin |
295 |
< |
Result := TFB30Transaction.Create(Attachments,TPB,DefaultCompletion); |
295 |
> |
Result := TFB30Transaction.Create(self,Attachments,TPB,DefaultCompletion); |
296 |
|
end; |
297 |
|
|
298 |
|
function TFB30ClientAPI.StartTransaction(Attachments: array of IAttachment; |
299 |
|
TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction; |
300 |
|
begin |
301 |
< |
Result := TFB30Transaction.Create(Attachments,TPB,DefaultCompletion); |
301 |
> |
Result := TFB30Transaction.Create(self,Attachments,TPB,DefaultCompletion); |
302 |
|
end; |
303 |
|
|
304 |
|
function TFB30ClientAPI.AllocateSPB: ISPB; |
305 |
|
begin |
306 |
< |
Result := TSPB.Create; |
306 |
> |
Result := TSPB.Create(self); |
307 |
|
end; |
308 |
|
|
309 |
|
function TFB30ClientAPI.GetServiceManager(ServerName: AnsiString; |
310 |
|
Protocol: TProtocol; SPB: ISPB): IServiceManager; |
311 |
|
begin |
312 |
< |
Result := TFB30ServiceManager.Create(ServerName,Protocol,SPB); |
312 |
> |
Result := TFB30ServiceManager.Create(self,ServerName,Protocol,SPB); |
313 |
|
end; |
314 |
|
|
315 |
|
function TFB30ClientAPI.GetServiceManager(ServerName: AnsiString; |
316 |
|
Port: Ansistring; Protocol: TProtocol; SPB: ISPB): IServiceManager; |
317 |
|
begin |
318 |
< |
Result := TFB30ServiceManager.Create(ServerName,Protocol,SPB,Port); |
318 |
> |
Result := TFB30ServiceManager.Create(self,ServerName,Protocol,SPB,Port); |
319 |
|
end; |
320 |
|
|
321 |
|
function TFB30ClientAPI.HasServiceAPI: boolean; |