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 |
|
|
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 |
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 |
+ |
|
105 |
+ |
{Time Zone Support} |
106 |
+ |
function GetTimeZoneServices: ITimeZoneServices; override; |
107 |
+ |
function HasTimeZoneSupport: boolean; override; |
108 |
|
end; |
109 |
|
|
110 |
|
implementation |
111 |
|
|
112 |
|
uses FB30Transaction, FB30Statement, FB30Array, FB30Blob, FBMessages, |
113 |
< |
FBOutputBlock, FB30Events, IBUtils; |
113 |
> |
FBOutputBlock, FB30Events, IBUtils, FB30TimeZoneServices; |
114 |
|
|
115 |
|
type |
116 |
|
{ TVersionCallback } |
118 |
|
TVersionCallback = class(Firebird.IVersionCallbackImpl) |
119 |
|
private |
120 |
|
FOutput: TStrings; |
121 |
+ |
FFirebirdClientAPI: TFBClientAPI; |
122 |
|
public |
123 |
< |
constructor Create(output: TStrings); |
123 |
> |
constructor Create(FirebirdClientAPI: TFBClientAPI; output: TStrings); |
124 |
|
procedure callback(status: Firebird.IStatus; text: PAnsiChar); override; |
125 |
|
end; |
126 |
|
|
127 |
|
{ TVersionCallback } |
128 |
|
|
129 |
< |
constructor TVersionCallback.Create(output: TStrings); |
129 |
> |
constructor TVersionCallback.Create(FirebirdClientAPI: TFBClientAPI; |
130 |
> |
output: TStrings); |
131 |
|
begin |
132 |
|
inherited Create; |
133 |
+ |
FFirebirdClientAPI := FirebirdClientAPI; |
134 |
|
FOutput := output; |
135 |
|
end; |
136 |
|
|
137 |
|
procedure TVersionCallback.callback(status: Firebird.IStatus; text: PAnsiChar); |
138 |
+ |
var StatusObj: TFB30StatusObject; |
139 |
|
begin |
140 |
+ |
if ((status.getState and status.STATE_ERRORS) <> 0) then |
141 |
+ |
begin |
142 |
+ |
StatusObj := TFB30StatusObject.Create(FFirebirdClientAPI,status); |
143 |
+ |
try |
144 |
+ |
raise EIBInterBaseError.Create(StatusObj); |
145 |
+ |
finally |
146 |
+ |
StatusObj.Free; |
147 |
+ |
end; |
148 |
+ |
end; |
149 |
|
FOutput.Add(text); |
150 |
|
end; |
151 |
|
|
152 |
|
|
153 |
|
{ TFB30Attachment } |
154 |
|
|
155 |
+ |
procedure TFB30Attachment.SetUseRemoteICU(aValue: boolean); |
156 |
+ |
begin |
157 |
+ |
if (FUsingRemoteICU <> aValue) and (GetODSMajorVersion >= 13) then |
158 |
+ |
begin |
159 |
+ |
if aValue then |
160 |
+ |
ExecImmediate([isc_tpb_write,isc_tpb_wait,isc_tpb_concurrency],'SET BIND OF TIME ZONE TO EXTENDED') |
161 |
+ |
else |
162 |
+ |
ExecImmediate([isc_tpb_write,isc_tpb_wait,isc_tpb_concurrency],'SET BIND OF TIME ZONE TO NATIVE'); |
163 |
+ |
FUsingRemoteICU := aValue; |
164 |
+ |
end; |
165 |
+ |
end; |
166 |
+ |
|
167 |
|
procedure TFB30Attachment.CheckHandle; |
168 |
|
begin |
169 |
|
if FAttachmentIntf = nil then |
269 |
|
FAttachmentIntf := nil |
270 |
|
else |
271 |
|
GetODSAndConnectionInfo; |
272 |
+ |
|
273 |
|
end; |
274 |
|
end; |
275 |
|
|
286 |
|
FHasDefaultCharSet := false; |
287 |
|
FCodePage := CP_NONE; |
288 |
|
FCharSetID := 0; |
289 |
+ |
FTimeZoneServices := nil; |
290 |
|
end; |
291 |
|
end; |
292 |
|
|
416 |
|
var bufferObj: TVersionCallback; |
417 |
|
begin |
418 |
|
version.Clear; |
419 |
< |
bufferObj := TVersionCallback.Create(version); |
419 |
> |
bufferObj := TVersionCallback.Create(Firebird30ClientAPI,version); |
420 |
|
try |
421 |
|
with FFirebird30ClientAPI do |
422 |
|
begin |
428 |
|
end; |
429 |
|
end; |
430 |
|
|
431 |
+ |
function TFB30Attachment.HasDecFloatSupport: boolean; |
432 |
+ |
begin |
433 |
+ |
Result := (FFirebird30ClientAPI.GetClientMajor >= 4) and |
434 |
+ |
(GetODSMajorVersion >= 13); |
435 |
+ |
end; |
436 |
+ |
|
437 |
+ |
function TFB30Attachment.GetTimeZoneServices: ITimeZoneServices; |
438 |
+ |
begin |
439 |
+ |
if not HasTimeZoneSupport then |
440 |
+ |
IBError(ibxeNotSupported,[]); |
441 |
+ |
|
442 |
+ |
if FTimeZoneServices = nil then |
443 |
+ |
FTimeZoneServices := TFB30TimeZoneServices.Create(self); |
444 |
+ |
Result := FTimeZoneServices; |
445 |
+ |
end; |
446 |
+ |
|
447 |
+ |
function TFB30Attachment.HasTimeZoneSupport: boolean; |
448 |
+ |
begin |
449 |
+ |
Result := (FFirebird30ClientAPI.GetClientMajor >= 4) and |
450 |
+ |
(GetODSMajorVersion >= 13); |
451 |
+ |
end; |
452 |
+ |
|
453 |
|
end. |
454 |
|
|