ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/3.0/FB30ClientAPI.pas
(Generate patch)

Comparing ibx/branches/udr/client/3.0/FB30ClientAPI.pas (file contents):
Revision 370 by tony, Wed Jan 5 14:59:15 2022 UTC vs.
Revision 371 by tony, Wed Jan 5 15:21:22 2022 UTC

# Line 48 | Line 48 | type
48    protected
49      FStatus: Firebird.IStatus;
50      FDirty: boolean;
51 +    function GetIBMessage: Ansistring; override;
52    public
53      destructor Destroy; override;
54      procedure Init;
# Line 84 | Line 85 | type
85                               goes out of scope.}
86      procedure CheckPlugins;
87    public
88 <    constructor Create(aFBLibrary: TFBLibrary);
88 >    constructor Create(aFBLibrary: TFBLibrary); overload;
89 >    constructor Create(aMaster: Firebird.IMaster); overload;
90      destructor Destroy; override;
91  
92      function StatusIntf: Firebird.IStatus;
93      procedure Check4DataBaseError; overload;
94      procedure Check4DataBaseError(st: Firebird.IStatus); overload;
95 +    function FormatStatus(Status: Firebird.IStatus): AnsiString;
96      function InErrorState: boolean;
97      function LoadInterface: boolean; override;
98      procedure FBShutdown; override;
# Line 146 | Line 149 | type
149      function SQLDecodeTime(bufptr: PByte): TDateTime;  override;
150      procedure SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PByte); override;
151      function SQLDecodeDateTime(bufptr: PByte): TDateTime; override;
149    function FormatStatus(Status: TFBStatus): AnsiString; override;
150    function FormatFBStatus(Status: Firebird.IStatus): AnsiString;
152  
153      {Firebird 4 Extensions}
154      procedure SQLDecFloatEncode(aValue: tBCD; SQLType: cardinal; bufptr: PByte);
# Line 260 | Line 261 | constructor TFB30StatusObject.Create(aOw
261    status: Firebird.IStatus; prefix: Ansistring);
262   begin
263    inherited Create(aOwner,prefix);
264 <  FStatus := status;
264 >  FStatus := status.clone;
265   end;
266  
267   { TFB30Status }
268  
269 + function TFB30Status.GetIBMessage: Ansistring;
270 + begin
271 +  Result := (FOwner as TFB30ClientAPI).FormatStatus(FStatus);
272 + end;
273 +
274   destructor TFB30Status.Destroy;
275   begin
276    FreeHandle;
# Line 364 | Line 370 | var
370    fb_get_master_interface: Tfb_get_master_interface;
371   begin
372    Result := inherited LoadInterface;
373 <  fb_get_master_interface := GetProcAddress(GetFBLibrary.GetHandle, 'fb_get_master_interface'); {do not localize}
374 <  if assigned(fb_get_master_interface) then
373 >  if (FMaster = nil) and (GetFBLibrary <> nil) then {get from library}
374 >  begin
375 >    fb_get_master_interface := GetProcAddress(GetFBLibrary.GetHandle, 'fb_get_master_interface'); {do not localize}
376 >    if assigned(fb_get_master_interface) then
377 >      FMaster := fb_get_master_interface;
378 >  end;
379 >  if FMaster <> nil then
380    begin
370    FMaster := fb_get_master_interface;
381      FUtil := FMaster.getUtilInterface;
382      FProvider := FMaster.getDispatcher;
383      FConfigManager := FMaster.getConfigManager;
# Line 402 | Line 412 | begin
412    FStatusIntf := FStatus;
413   end;
414  
415 + constructor TFB30ClientAPI.Create(aMaster: Firebird.IMaster);
416 + begin
417 +  inherited Create(nil);
418 +  FMaster := aMaster;
419 +  FStatus := TFB30Status.Create(self);
420 +  FStatusIntf := FStatus;
421 +  if FMaster <> nil then
422 +  begin
423 +    FUtil := FMaster.getUtilInterface;
424 +    FProvider := FMaster.getDispatcher;
425 +    FConfigManager := FMaster.getConfigManager;
426 +    CheckPlugins;
427 +  end;
428 + end;
429 +
430   destructor TFB30ClientAPI.Destroy;
431   begin
432    FStatus.FreeHandle;
# Line 428 | Line 453 | begin
453      raise EIBInterBaseError.Create(TFB30StatusObject.Create(self,st));
454   end;
455  
456 + function TFB30ClientAPI.FormatStatus(Status: Firebird.IStatus): AnsiString;
457 + var local_buffer: array[0..IBHugeLocalBufferLength - 1] of AnsiChar;
458 + begin
459 +  Result := '';
460 +  if UtilIntf.formatStatus(@local_buffer,sizeof(local_buffer) - 1,Status) > 0 then
461 +    Result := strpas(local_buffer);
462 + end;
463 +
464   function TFB30ClientAPI.InErrorState: boolean;
465   begin
466    Result := FStatus.InErrorState;
# Line 600 | Line 633 | begin
633    Result := Result + SQLDecodeTime(bufPtr);
634   end;
635  
603 function TFB30ClientAPI.FormatStatus(Status: TFBStatus): AnsiString;
604 begin
605  Result := FormatFBStatus((Status as TFB30Status).GetStatus);
606 end;
607
608 function TFB30ClientAPI.FormatFBStatus(Status: Firebird.IStatus): AnsiString;
609 var local_buffer: array[0..IBHugeLocalBufferLength - 1] of AnsiChar;
610 begin
611  Result := '';
612  if UtilIntf.formatStatus(@local_buffer,sizeof(local_buffer) - 1,Status) > 0 then
613    Result := strpas(local_buffer);
614 end;
615
636   procedure TFB30ClientAPI.SQLDecFloatEncode(aValue: tBCD; SQLType: cardinal;
637    bufptr: PByte);
638   var DecFloat16: IDecFloat16;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines