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

Comparing ibx/trunk/fbintf/client/3.0/FB30Attachment.pas (file contents):
Revision 291 by tony, Fri Apr 17 10:26:08 2020 UTC vs.
Revision 345 by tony, Mon Aug 23 14:22:29 2021 UTC

# Line 37 | Line 37 | unit FB30Attachment;
37   interface
38  
39   uses
40 <  Classes, SysUtils, FBAttachment, FB30ClientAPI, Firebird, IB, FBActivityMonitor, FBParamBlock;
40 >  Classes, SysUtils, FBAttachment, FBClientAPI, FB30ClientAPI, Firebird, IB,
41 >  FBActivityMonitor, FBParamBlock;
42  
43   type
44  
# Line 47 | Line 48 | type
48    private
49      FAttachmentIntf: Firebird.IAttachment;
50      FFirebird30ClientAPI: TFB30ClientAPI;
51 +    FTimeZoneServices: ITimeZoneServices;
52 +    FUsingRemoteICU: boolean;
53 +    procedure SetUseRemoteICU(aValue: boolean);
54    protected
55      procedure CheckHandle; override;
56    public
# Line 96 | Line 100 | type
100      function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; override;
101      function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; override;
102      procedure getFBVersion(version: TStrings);
103 +    function HasDecFloatSupport: boolean; override;
104 +    function HasBatchMode: boolean; override;
105 +
106 +    {Time Zone Support}
107 +    function GetTimeZoneServices: ITimeZoneServices; override;
108 +    function HasTimeZoneSupport: boolean; override;
109    end;
110  
111   implementation
112  
113   uses FB30Transaction, FB30Statement, FB30Array, FB30Blob, FBMessages,
114 <  FBOutputBlock, FB30Events, IBUtils;
114 >  FBOutputBlock, FB30Events, IBUtils, FB30TimeZoneServices;
115  
116   type
117    { TVersionCallback }
# Line 109 | Line 119 | type
119    TVersionCallback = class(Firebird.IVersionCallbackImpl)
120    private
121      FOutput: TStrings;
122 +    FFirebirdClientAPI: TFBClientAPI;
123    public
124 <    constructor Create(output: TStrings);
124 >    constructor Create(FirebirdClientAPI: TFBClientAPI; output: TStrings);
125      procedure callback(status: Firebird.IStatus; text: PAnsiChar); override;
126    end;
127  
128   { TVersionCallback }
129  
130 < constructor TVersionCallback.Create(output: TStrings);
130 > constructor TVersionCallback.Create(FirebirdClientAPI: TFBClientAPI;
131 >  output: TStrings);
132   begin
133    inherited Create;
134 +  FFirebirdClientAPI := FirebirdClientAPI;
135    FOutput := output;
136   end;
137  
138   procedure TVersionCallback.callback(status: Firebird.IStatus; text: PAnsiChar);
139 + var StatusObj: TFB30StatusObject;
140   begin
141 +  if ((status.getState and status.STATE_ERRORS) <> 0) then
142 +  begin
143 +    StatusObj := TFB30StatusObject.Create(FFirebirdClientAPI,status);
144 +    try
145 +      raise EIBInterBaseError.Create(StatusObj);
146 +    finally
147 +      StatusObj.Free;
148 +    end;
149 +  end;
150    FOutput.Add(text);
151   end;
152  
153  
154   { TFB30Attachment }
155  
156 + procedure TFB30Attachment.SetUseRemoteICU(aValue: boolean);
157 + begin
158 +  if (FUsingRemoteICU <> aValue) and (GetODSMajorVersion >= 13) then
159 +  begin
160 +    if aValue then
161 +      ExecImmediate([isc_tpb_write,isc_tpb_wait,isc_tpb_concurrency],'SET BIND OF TIME ZONE TO EXTENDED')
162 +    else
163 +      ExecImmediate([isc_tpb_write,isc_tpb_wait,isc_tpb_concurrency],'SET BIND OF TIME ZONE TO NATIVE');
164 +    FUsingRemoteICU := aValue;
165 +  end;
166 + end;
167 +
168   procedure TFB30Attachment.CheckHandle;
169   begin
170    if FAttachmentIntf = nil then
# Line 235 | Line 270 | begin
270        FAttachmentIntf := nil
271      else
272        GetODSAndConnectionInfo;
273 +
274    end;
275   end;
276  
# Line 251 | Line 287 | begin
287        FHasDefaultCharSet := false;
288        FCodePage := CP_NONE;
289        FCharSetID := 0;
290 +      FTimeZoneServices := nil;
291      end;
292   end;
293  
# Line 380 | Line 417 | procedure TFB30Attachment.getFBVersion(v
417   var bufferObj: TVersionCallback;
418   begin
419    version.Clear;
420 <  bufferObj := TVersionCallback.Create(version);
420 >  bufferObj := TVersionCallback.Create(Firebird30ClientAPI,version);
421    try
422      with FFirebird30ClientAPI do
423      begin
# Line 392 | Line 429 | begin
429    end;
430   end;
431  
432 + function TFB30Attachment.HasDecFloatSupport: boolean;
433 + begin
434 +  Result := (FFirebird30ClientAPI.GetClientMajor >= 4) and
435 +   (GetODSMajorVersion >= 13);
436 + end;
437 +
438 + function TFB30Attachment.HasBatchMode: boolean;
439 + begin
440 +  Result := FFirebird30ClientAPI.Firebird4orLater and
441 +     (GetODSMajorVersion >= 13);
442 + end;
443 +
444 + function TFB30Attachment.GetTimeZoneServices: ITimeZoneServices;
445 + begin
446 +  if not HasTimeZoneSupport then
447 +    IBError(ibxeNotSupported,[]);
448 +
449 +  if FTimeZoneServices = nil then
450 +    FTimeZoneServices := TFB30TimeZoneServices.Create(self);
451 +  Result := FTimeZoneServices;
452 + end;
453 +
454 + function TFB30Attachment.HasTimeZoneSupport: boolean;
455 + begin
456 +  Result := (FFirebird30ClientAPI.GetClientMajor >= 4) and
457 +   (GetODSMajorVersion >= 13);
458 + end;
459 +
460   end.
461  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines