79 |
|
{ TFB25Status } |
80 |
|
|
81 |
|
TFB25Status = class(TFBStatus,IStatus) |
82 |
+ |
protected |
83 |
+ |
function GetIBMessage: Ansistring; override; |
84 |
|
public |
85 |
+ |
function Clone: IStatus; override; |
86 |
|
function StatusVector: PStatusVector; override; |
87 |
+ |
function InErrorState: boolean; override; |
88 |
|
end; |
89 |
|
|
90 |
|
{ TFB25ClientAPI } |
168 |
|
isc_prepare_transaction: Tisc_prepare_transaction; |
169 |
|
isc_version: Tisc_Version; |
170 |
|
isc_interprete: Tisc_interprete; |
171 |
+ |
fb_interpret: Tfb_interpret; |
172 |
|
|
173 |
|
public |
174 |
|
{Helper Functions} |
178 |
|
function SQLDecodeTime(bufptr: PByte): TDateTime; override; |
179 |
|
procedure SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PByte); override; |
180 |
|
function SQLDecodeDateTime(bufptr: PByte): TDateTime; override; |
176 |
– |
function FormatStatus(Status: TFBStatus): AnsiString; override; |
181 |
|
public |
182 |
|
{IFirebirdAPI} |
183 |
|
|
190 |
|
{Start Transaction against multiple databases} |
191 |
|
function AllocateTPB: ITPB; |
192 |
|
function StartTransaction(Attachments: array of IAttachment; |
193 |
< |
TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction; overload; |
193 |
> |
TPB: array of byte; DefaultCompletion: TTransactionCompletion; aName: AnsiString=''): ITransaction; overload; |
194 |
|
function StartTransaction(Attachments: array of IAttachment; |
195 |
< |
TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction; overload; |
195 |
> |
TPB: ITPB; DefaultCompletion: TTransactionCompletion; aName: AnsiString=''): ITransaction; overload; |
196 |
|
|
197 |
|
{Service Manager} |
198 |
|
function AllocateSPB: ISPB; |
325 |
|
|
326 |
|
{ TFB25ActivityReporter } |
327 |
|
|
328 |
+ |
function TFB25Status.GetIBMessage: Ansistring; |
329 |
+ |
var psb: PStatusVector; |
330 |
+ |
local_buffer: array[0..IBHugeLocalBufferLength - 1] of AnsiChar; |
331 |
+ |
begin |
332 |
+ |
psb := StatusVector; |
333 |
+ |
Result := ''; |
334 |
+ |
with FOwner as TFB25ClientAPI do |
335 |
+ |
if assigned(fb_interpret) then |
336 |
+ |
begin |
337 |
+ |
if fb_interpret(@local_buffer,sizeof(local_buffer),@psb) > 0 then |
338 |
+ |
Result := strpas(local_buffer); |
339 |
+ |
end |
340 |
+ |
else |
341 |
+ |
if assigned(isc_interprete) then |
342 |
+ |
while isc_interprete(@local_buffer,@psb) > 0 do |
343 |
+ |
begin |
344 |
+ |
if (Result <> '') and (Result[Length(Result)] <> LF) then |
345 |
+ |
Result := Result + LineEnding + '-'; |
346 |
+ |
Result := Result + strpas(local_buffer); |
347 |
+ |
end; |
348 |
+ |
end; |
349 |
+ |
|
350 |
+ |
function TFB25Status.Clone: IStatus; |
351 |
+ |
begin |
352 |
+ |
Result := TFB25Status.Copy(self); |
353 |
+ |
end; |
354 |
+ |
|
355 |
|
function TFB25Status.StatusVector: PStatusVector; |
356 |
|
begin |
357 |
|
Result := @FStatusVector; |
358 |
|
end; |
359 |
|
|
360 |
+ |
function TFB25Status.InErrorState: boolean; |
361 |
+ |
begin |
362 |
+ |
Result := StatusVector^[0] > 0; |
363 |
+ |
end; |
364 |
+ |
|
365 |
|
|
366 |
|
{ TFB25ClientAPI } |
367 |
|
|
421 |
|
isc_prepare_transaction := GetProcAddr('isc_prepare_transaction'); {do not localize} |
422 |
|
isc_version := GetProcAddr('isc_version'); {do not localize} |
423 |
|
isc_interprete := GetProcAddr('isc_interprete'); {do not localize} |
424 |
+ |
fb_interpret := GetProcAddr('fb_interpret'); {do not localize} |
425 |
|
|
426 |
|
FIBServiceAPIPresent := true; |
427 |
|
isc_rollback_retaining := GetProcAddress(FFBLibrary.IBLibrary, 'isc_rollback_retaining'); {do not localize} |
542 |
|
end; |
543 |
|
|
544 |
|
function TFB25ClientAPI.StartTransaction(Attachments: array of IAttachment; |
545 |
< |
TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction; |
545 |
> |
TPB: array of byte; DefaultCompletion: TTransactionCompletion; aName: AnsiString): ITransaction; |
546 |
|
begin |
547 |
< |
Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion); |
547 |
> |
Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion,aName); |
548 |
|
end; |
549 |
|
|
550 |
|
function TFB25ClientAPI.StartTransaction(Attachments: array of IAttachment; |
551 |
< |
TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction; |
551 |
> |
TPB: ITPB; DefaultCompletion: TTransactionCompletion; aName: AnsiString): ITransaction; |
552 |
|
begin |
553 |
< |
Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion); |
553 |
> |
Result := TFB25Transaction.Create(self,Attachments,TPB,DefaultCompletion, aName); |
554 |
|
end; |
555 |
|
|
556 |
|
function TFB25ClientAPI.HasServiceAPI: boolean; |
707 |
|
end; |
708 |
|
end; |
709 |
|
|
673 |
– |
function TFB25ClientAPI.FormatStatus(Status: TFBStatus): AnsiString; |
674 |
– |
var psb: PStatusVector; |
675 |
– |
local_buffer: array[0..IBHugeLocalBufferLength - 1] of AnsiChar; |
676 |
– |
begin |
677 |
– |
psb := Status.StatusVector; |
678 |
– |
Result := ''; |
679 |
– |
while isc_interprete(@local_buffer,@psb) > 0 do |
680 |
– |
begin |
681 |
– |
if (Result <> '') and (Result[Length(Result)] <> LF) then |
682 |
– |
Result := Result + LineEnding + '-'; |
683 |
– |
Result := Result + strpas(local_buffer); |
684 |
– |
end; |
685 |
– |
end; |
686 |
– |
|
710 |
|
end. |
711 |
|
|
712 |
|
|