ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/client/2.5/FB25ClientAPI.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/2.5/FB25ClientAPI.pas (file contents):
Revision 143 by tony, Fri Feb 23 12:11:21 2018 UTC vs.
Revision 263 by tony, Thu Dec 6 15:55:01 2018 UTC

# Line 95 | Line 95 | type
95      FStatusIntf: IStatus;   {Keep a reference to the interface - automatic destroy
96                               when this class is freed and last reference to IStatus
97                               goes out of scope.}
98  protected
99    {$IFDEF UNIX}
100    function GetFirebirdLibList: string; override;
101    {$ENDIF}
102    procedure LoadInterface; override;
98    public
99 <    constructor Create;
99 >    constructor Create(aFBLibrary: TFBLibrary);
100      destructor Destroy; override;
101      function StatusVector: PISC_STATUS;
102 +    function LoadInterface: boolean; override;
103 +    function GetAPI: IFirebirdAPI; override;
104 +    {$IFDEF UNIX}
105 +    function GetFirebirdLibList: string; override;
106 +    {$ENDIF}
107      property IBServiceAPIPresent: boolean read FIBServiceAPIPresent;
108      property Status: TFB25Status read FStatus;
109  
# Line 210 | Line 210 | type
210  
211     end;
212  
213 var
214  Firebird25ClientAPI: TFB25ClientAPI = nil;
215
213   implementation
214  
215   uses FBMessages,
# Line 323 | Line 320 | end;
320   threadvar
321    FStatusVector: TStatusVector;
322  
323 + { TFB25ActivityReporter }
324 +
325   function TFB25Status.StatusVector: PStatusVector;
326   begin
327    Result := @FStatusVector;
# Line 338 | Line 337 | begin
337   end;
338   {$ENDIF}
339  
340 < procedure TFB25ClientAPI.LoadInterface;
340 > function TFB25ClientAPI.LoadInterface: boolean;
341   begin
342 <  inherited LoadInterface;
342 >  Result := inherited LoadInterface;
343    BLOB_get := GetProcAddr('BLOB_get'); {do not localize}
344    BLOB_put := GetProcAddr('BLOB_put'); {do not localize}
345    isc_wait_for_event := GetProcAddr('isc_wait_for_event'); {do not localize}
# Line 387 | Line 386 | begin
386    isc_prepare_transaction  := GetProcAddr('isc_prepare_transaction'); {do not localize}
387  
388    FIBServiceAPIPresent := true;
389 <  isc_rollback_retaining := GetProcAddress(IBLibrary, 'isc_rollback_retaining'); {do not localize}
389 >  isc_rollback_retaining := GetProcAddress(FFBLibrary.IBLibrary, 'isc_rollback_retaining'); {do not localize}
390    if Assigned(isc_rollback_retaining) then
391    begin
392      isc_service_attach := GetProcAddr('isc_service_attach'); {do not localize}
# Line 415 | Line 414 | begin
414      isc_encode_sql_time := @isc_encode_sql_time_stub;
415      isc_encode_timestamp := @isc_encode_timestamp_stub;
416    end;
417 +  Result := Result and assigned(isc_attach_database);
418 + end;
419 +
420 + function TFB25ClientAPI.GetAPI: IFirebirdAPI;
421 + begin
422 +  Result := self;
423   end;
424  
425 < constructor TFB25ClientAPI.Create;
425 > constructor TFB25ClientAPI.Create(aFBLibrary: TFBLibrary);
426   begin
427 <  inherited;
427 >  inherited Create(aFBLibrary);
428    FStatus := TFB25Status.Create(self);
429    FStatusIntf := FStatus;
425  Firebird25ClientAPI := self;
430   end;
431  
432   destructor TFB25ClientAPI.Destroy;
433   begin
434    FStatusIntf := nil;
431  Firebird25ClientAPI := nil;
435    inherited Destroy;
436   end;
437  
# Line 445 | Line 448 | end;
448  
449   function TFB25ClientAPI.AllocateDPB: IDPB;
450   begin
451 <  Result := TDPB.Create;
451 >  Result := TDPB.Create(self);
452   end;
453  
454   function TFB25ClientAPI.OpenDatabase(DatabaseName: AnsiString; DPB: IDPB;
455                                      RaiseExceptionOnConnectError: boolean): IAttachment;
456   begin
457 <   Result := TFB25Attachment.Create(DatabaseName,DPB,RaiseExceptionOnConnectError);
457 >   Result := TFB25Attachment.Create(self,DatabaseName,DPB,RaiseExceptionOnConnectError);
458     if not Result.IsConnected then
459       Result := nil;
460   end;
# Line 459 | Line 462 | end;
462   function TFB25ClientAPI.CreateDatabase(DatabaseName: AnsiString; DPB: IDPB;
463    RaiseExceptionOnError: boolean): IAttachment;
464   begin
465 <  Result := TFB25Attachment.CreateDatabase(DatabaseName, DPB, RaiseExceptionOnError );
465 >  Result := TFB25Attachment.CreateDatabase(self,DatabaseName, DPB, RaiseExceptionOnError );
466     if (Result <> nil) and not Result.IsConnected then
467       Result := nil;
468   end;
# Line 467 | Line 470 | end;
470   function TFB25ClientAPI.CreateDatabase(sql: AnsiString; aSQLDialect: integer;
471    RaiseExceptionOnError: boolean): IAttachment;
472   begin
473 <  Result := TFB25Attachment.CreateDatabase(sql,aSQLDialect, RaiseExceptionOnError );
473 >  Result := TFB25Attachment.CreateDatabase(self,sql,aSQLDialect, RaiseExceptionOnError );
474     if (Result <> nil) and not Result.IsConnected then
475       Result := nil;
476   end;
477  
478   function TFB25ClientAPI.AllocateSPB: ISPB;
479   begin
480 <  Result := TSPB.Create;
480 >  Result := TSPB.Create(self);
481   end;
482  
483   function TFB25ClientAPI.AllocateTPB: ITPB;
484   begin
485 <  Result := TTPB.Create;
485 >  Result := TTPB.Create(self);
486   end;
487  
488   function TFB25ClientAPI.GetServiceManager(ServerName: AnsiString;
489    Protocol: TProtocol; SPB: ISPB): IServiceManager;
490   begin
491    if HasServiceAPI then
492 <    Result := TFB25ServiceManager.Create(ServerName,Protocol,SPB)
492 >    Result := TFB25ServiceManager.Create(self,ServerName,Protocol,SPB)
493    else
494      Result := nil;
495   end;
# Line 495 | Line 498 | function TFB25ClientAPI.GetServiceManage
498    Port: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager;
499   begin
500    if HasServiceAPI then
501 <    Result := TFB25ServiceManager.Create(ServerName,Protocol,SPB,Port)
501 >    Result := TFB25ServiceManager.Create(self,ServerName,Protocol,SPB,Port)
502    else
503      Result := nil;
504   end;
# Line 503 | Line 506 | end;
506   function TFB25ClientAPI.StartTransaction(Attachments: array of IAttachment;
507    TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction;
508   begin
509 <  Result := TFB25Transaction.Create(Attachments,TPB,DefaultCompletion);
509 >  Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion);
510   end;
511  
512   function TFB25ClientAPI.StartTransaction(Attachments: array of IAttachment;
513    TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction;
514   begin
515 <  Result := TFB25Transaction.Create(Attachments,TPB,DefaultCompletion);
515 >  Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion);
516   end;
517  
518   function TFB25ClientAPI.HasServiceAPI: boolean;
# Line 526 | Line 529 | function TFB25ClientAPI.IsEmbeddedServer
529   begin
530    Result := false;
531   {$IFDEF UNIX}
532 <  Result := Pos('libfbembed',FFBLibraryName) = 1;
532 >  Result := Pos('libfbembed',FFBLibrary.GetLibraryName) = 1;
533   {$ENDIF}
534   {$IFDEF WINDOWS}
535 <  Result := CompareText(FFBLibraryName,FIREBIRD_EMBEDDED) = 0;
535 >  Result := CompareText(FFBLibrary.GetLibraryName,FIREBIRD_EMBEDDED) = 0;
536   {$ENDIF}
537   end;
538  
# Line 599 | Line 602 | begin
602      tm_mon := 0;
603      tm_year := 0;
604    end;
605 <  with Firebird25ClientAPI do
603 <    isc_encode_sql_time(@tm_date, PISC_TIME(bufptr));
605 >  isc_encode_sql_time(@tm_date, PISC_TIME(bufptr));
606    if Ms > 0 then
607      Inc(PISC_TIME(bufptr)^,Ms*10);
608   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines