ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/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 266 by tony, Wed Dec 26 18:34:32 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 165 | Line 165 | type
165      isc_array_get_slice: Tisc_array_get_slice;
166      isc_array_put_slice: Tisc_array_put_slice;
167      isc_prepare_transaction: Tisc_prepare_transaction;
168 +    isc_version: Tisc_Version;
169  
170    public
171      {Helper Functions}
# Line 210 | Line 211 | type
211  
212     end;
213  
213 var
214  Firebird25ClientAPI: TFB25ClientAPI = nil;
215
214   implementation
215  
216   uses FBMessages,
# Line 323 | Line 321 | end;
321   threadvar
322    FStatusVector: TStatusVector;
323  
324 + { TFB25ActivityReporter }
325 +
326   function TFB25Status.StatusVector: PStatusVector;
327   begin
328    Result := @FStatusVector;
# Line 338 | Line 338 | begin
338   end;
339   {$ENDIF}
340  
341 < procedure TFB25ClientAPI.LoadInterface;
341 > function TFB25ClientAPI.LoadInterface: boolean;
342   begin
343 <  inherited LoadInterface;
343 >  Result := inherited LoadInterface;
344    BLOB_get := GetProcAddr('BLOB_get'); {do not localize}
345    BLOB_put := GetProcAddr('BLOB_put'); {do not localize}
346    isc_wait_for_event := GetProcAddr('isc_wait_for_event'); {do not localize}
# Line 385 | Line 385 | begin
385    isc_array_get_slice := GetProcAddr('isc_array_get_slice'); {do not localize}
386    isc_array_put_slice := GetProcAddr('isc_array_put_slice'); {do not localize}
387    isc_prepare_transaction  := GetProcAddr('isc_prepare_transaction'); {do not localize}
388 +  isc_version  := GetProcAddr('isc_version'); {do not localize}
389  
390    FIBServiceAPIPresent := true;
391 <  isc_rollback_retaining := GetProcAddress(IBLibrary, 'isc_rollback_retaining'); {do not localize}
391 >  isc_rollback_retaining := GetProcAddress(FFBLibrary.IBLibrary, 'isc_rollback_retaining'); {do not localize}
392    if Assigned(isc_rollback_retaining) then
393    begin
394      isc_service_attach := GetProcAddr('isc_service_attach'); {do not localize}
# Line 415 | Line 416 | begin
416      isc_encode_sql_time := @isc_encode_sql_time_stub;
417      isc_encode_timestamp := @isc_encode_timestamp_stub;
418    end;
419 +  Result := Result and assigned(isc_attach_database);
420 + end;
421 +
422 + function TFB25ClientAPI.GetAPI: IFirebirdAPI;
423 + begin
424 +  Result := self;
425   end;
426  
427 < constructor TFB25ClientAPI.Create;
427 > constructor TFB25ClientAPI.Create(aFBLibrary: TFBLibrary);
428   begin
429 <  inherited;
429 >  inherited Create(aFBLibrary);
430    FStatus := TFB25Status.Create(self);
431    FStatusIntf := FStatus;
425  Firebird25ClientAPI := self;
432   end;
433  
434   destructor TFB25ClientAPI.Destroy;
435   begin
436    FStatusIntf := nil;
431  Firebird25ClientAPI := nil;
437    inherited Destroy;
438   end;
439  
# Line 445 | Line 450 | end;
450  
451   function TFB25ClientAPI.AllocateDPB: IDPB;
452   begin
453 <  Result := TDPB.Create;
453 >  Result := TDPB.Create(self);
454   end;
455  
456   function TFB25ClientAPI.OpenDatabase(DatabaseName: AnsiString; DPB: IDPB;
457                                      RaiseExceptionOnConnectError: boolean): IAttachment;
458   begin
459 <   Result := TFB25Attachment.Create(DatabaseName,DPB,RaiseExceptionOnConnectError);
459 >   Result := TFB25Attachment.Create(self,DatabaseName,DPB,RaiseExceptionOnConnectError);
460     if not Result.IsConnected then
461       Result := nil;
462   end;
# Line 459 | Line 464 | end;
464   function TFB25ClientAPI.CreateDatabase(DatabaseName: AnsiString; DPB: IDPB;
465    RaiseExceptionOnError: boolean): IAttachment;
466   begin
467 <  Result := TFB25Attachment.CreateDatabase(DatabaseName, DPB, RaiseExceptionOnError );
467 >  Result := TFB25Attachment.CreateDatabase(self,DatabaseName, DPB, RaiseExceptionOnError );
468     if (Result <> nil) and not Result.IsConnected then
469       Result := nil;
470   end;
# Line 467 | Line 472 | end;
472   function TFB25ClientAPI.CreateDatabase(sql: AnsiString; aSQLDialect: integer;
473    RaiseExceptionOnError: boolean): IAttachment;
474   begin
475 <  Result := TFB25Attachment.CreateDatabase(sql,aSQLDialect, RaiseExceptionOnError );
475 >  Result := TFB25Attachment.CreateDatabase(self,sql,aSQLDialect, RaiseExceptionOnError );
476     if (Result <> nil) and not Result.IsConnected then
477       Result := nil;
478   end;
479  
480   function TFB25ClientAPI.AllocateSPB: ISPB;
481   begin
482 <  Result := TSPB.Create;
482 >  Result := TSPB.Create(self);
483   end;
484  
485   function TFB25ClientAPI.AllocateTPB: ITPB;
486   begin
487 <  Result := TTPB.Create;
487 >  Result := TTPB.Create(self);
488   end;
489  
490   function TFB25ClientAPI.GetServiceManager(ServerName: AnsiString;
491    Protocol: TProtocol; SPB: ISPB): IServiceManager;
492   begin
493    if HasServiceAPI then
494 <    Result := TFB25ServiceManager.Create(ServerName,Protocol,SPB)
494 >    Result := TFB25ServiceManager.Create(self,ServerName,Protocol,SPB)
495    else
496      Result := nil;
497   end;
# Line 495 | Line 500 | function TFB25ClientAPI.GetServiceManage
500    Port: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager;
501   begin
502    if HasServiceAPI then
503 <    Result := TFB25ServiceManager.Create(ServerName,Protocol,SPB,Port)
503 >    Result := TFB25ServiceManager.Create(self,ServerName,Protocol,SPB,Port)
504    else
505      Result := nil;
506   end;
# Line 503 | Line 508 | end;
508   function TFB25ClientAPI.StartTransaction(Attachments: array of IAttachment;
509    TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction;
510   begin
511 <  Result := TFB25Transaction.Create(Attachments,TPB,DefaultCompletion);
511 >  Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion);
512   end;
513  
514   function TFB25ClientAPI.StartTransaction(Attachments: array of IAttachment;
515    TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction;
516   begin
517 <  Result := TFB25Transaction.Create(Attachments,TPB,DefaultCompletion);
517 >  Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion);
518   end;
519  
520   function TFB25ClientAPI.HasServiceAPI: boolean;
# Line 526 | Line 531 | function TFB25ClientAPI.IsEmbeddedServer
531   begin
532    Result := false;
533   {$IFDEF UNIX}
534 <  Result := Pos('libfbembed',FFBLibraryName) = 1;
534 >  Result := Pos('libfbembed',FFBLibrary.GetLibraryName) = 1;
535   {$ENDIF}
536   {$IFDEF WINDOWS}
537 <  Result := CompareText(FFBLibraryName,FIREBIRD_EMBEDDED) = 0;
537 >  Result := CompareText(FFBLibrary.GetLibraryName,FIREBIRD_EMBEDDED) = 0;
538   {$ENDIF}
539   end;
540  
# Line 599 | Line 604 | begin
604      tm_mon := 0;
605      tm_year := 0;
606    end;
607 <  with Firebird25ClientAPI do
603 <    isc_encode_sql_time(@tm_date, PISC_TIME(bufptr));
607 >  isc_encode_sql_time(@tm_date, PISC_TIME(bufptr));
608    if Ms > 0 then
609      Inc(PISC_TIME(bufptr)^,Ms*10);
610   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines