74 |
|
uses |
75 |
|
Classes, SysUtils, FBClientAPI, IBHeader, IBExternals, IB; |
76 |
|
|
77 |
– |
const |
78 |
– |
FBClientInterfaceVersion = '2.5'; |
79 |
– |
|
77 |
|
type |
78 |
|
|
79 |
|
{ TFB25Status } |
111 |
|
BLOB_put: TBLOB_put; |
112 |
|
isc_wait_for_event: Tisc_wait_for_event; |
113 |
|
isc_vax_integer: Tisc_vax_integer; |
117 |
– |
isc_portable_integer: Tisc_portable_integer; |
114 |
|
isc_blob_info: Tisc_blob_info; |
115 |
|
isc_blob_lookup_desc: Tisc_blob_lookup_desc; |
116 |
|
isc_open_blob2: Tisc_open_blob2; |
166 |
|
|
167 |
|
public |
168 |
|
{Helper Functions} |
173 |
– |
function DecodeInteger(bufptr: PByte; len: short): integer; override; |
169 |
|
procedure SQLEncodeDate(aDate: TDateTime; bufptr: PByte); override; |
170 |
|
function SQLDecodeDate(bufptr: PByte): TDateTime; override; |
171 |
|
procedure SQLEncodeTime(aTime: TDateTime; bufptr: PByte); override; |
201 |
|
function IsEmbeddedServer: boolean; override; |
202 |
|
function GetClientMajor: integer; override; |
203 |
|
function GetClientMinor: integer; override; |
204 |
+ |
function HasScollableCursors: boolean; |
205 |
|
|
206 |
|
{Firebird 3 API} |
207 |
|
function HasMasterIntf: boolean; |
214 |
|
uses FBMessages, |
215 |
|
{$IFDEF WINDOWS}Windows, {$ENDIF} |
216 |
|
{$IFDEF FPC} Dynlibs, {$ENDIF} |
217 |
< |
FB25Attachment, FB25Transaction, FB25Services, FBParamBlock, |
218 |
< |
IBUtils; |
217 |
> |
FB25Attachment, FB25Transaction, FB25Services, |
218 |
> |
IBUtils, FBAttachment, FBTransaction, FBServices; |
219 |
|
|
220 |
|
{ Stubs for 6.0 only functions } |
221 |
|
function isc_rollback_retaining_stub(status_vector : PISC_STATUS; |
343 |
|
BLOB_put := GetProcAddr('BLOB_put'); {do not localize} |
344 |
|
isc_wait_for_event := GetProcAddr('isc_wait_for_event'); {do not localize} |
345 |
|
isc_vax_integer := GetProcAddr('isc_vax_integer'); {do not localize} |
350 |
– |
isc_portable_integer := GetProcAddr('isc_portable_integer'); {do not localize} |
346 |
|
isc_blob_info := GetProcAddr('isc_blob_info'); {do not localize} |
347 |
|
isc_blob_lookup_desc := GetProcAddr('isc_blob_lookup_desc'); {do not localize} |
348 |
|
isc_open_blob2 := GetProcAddr('isc_open_blob2'); {do not localize} |
546 |
|
Result := 5; |
547 |
|
end; |
548 |
|
|
549 |
< |
function TFB25ClientAPI.HasMasterIntf: boolean; |
549 |
> |
function TFB25ClientAPI.HasScollableCursors: boolean; |
550 |
|
begin |
551 |
|
Result := false; |
552 |
|
end; |
553 |
|
|
554 |
< |
function TFB25ClientAPI.GetIMaster: TObject; |
554 |
> |
function TFB25ClientAPI.HasMasterIntf: boolean; |
555 |
|
begin |
556 |
< |
Result := nil; |
556 |
> |
Result := false; |
557 |
|
end; |
558 |
|
|
559 |
< |
function TFB25ClientAPI.DecodeInteger(bufptr: PByte; len: short): integer; |
559 |
> |
function TFB25ClientAPI.GetIMaster: TObject; |
560 |
|
begin |
561 |
< |
Result := isc_portable_integer(bufptr,len); |
561 |
> |
Result := nil; |
562 |
|
end; |
563 |
|
|
564 |
|
procedure TFB25ClientAPI.SQLEncodeDate(aDate: TDateTime; bufptr: PByte); |
596 |
|
procedure TFB25ClientAPI.SQLEncodeTime(aTime: TDateTime; bufptr: PByte); |
597 |
|
var |
598 |
|
tm_date: TCTimeStructure; |
599 |
< |
Hr, Mt, S, Ms: Word; |
599 |
> |
Hr, Mt, S: Word; |
600 |
> |
DMs: cardinal; {DMs = decimilliseconds} |
601 |
|
begin |
602 |
< |
DecodeTime(aTime, Hr, Mt, S, Ms); |
602 |
> |
FBDecodeTime(aTime, Hr, Mt, S, DMs); |
603 |
|
with tm_date do begin |
604 |
|
tm_sec := S; |
605 |
|
tm_min := Mt; |
609 |
|
tm_year := 0; |
610 |
|
end; |
611 |
|
isc_encode_sql_time(@tm_date, PISC_TIME(bufptr)); |
612 |
< |
if Ms > 0 then |
613 |
< |
Inc(PISC_TIME(bufptr)^,Ms*10); |
612 |
> |
if DMs > 0 then |
613 |
> |
Inc(PISC_TIME(bufptr)^,DMs); |
614 |
|
end; |
615 |
|
|
616 |
|
function TFB25ClientAPI.SQLDecodeTime(bufptr: PByte): TDateTime; |
617 |
|
var |
618 |
|
tm_date: TCTimeStructure; |
619 |
< |
msecs: Word; |
619 |
> |
DMs: cardinal; {DMs = decimilliseconds} |
620 |
|
begin |
621 |
|
isc_decode_sql_time(PISC_TIME(bufptr), @tm_date); |
622 |
|
try |
623 |
< |
msecs := (PISC_TIME(bufptr)^ mod 10000) div 10; |
624 |
< |
result := EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
625 |
< |
Word(tm_date.tm_sec), msecs) |
623 |
> |
DMs := PISC_TIME(bufptr)^ mod 10000; |
624 |
> |
result := FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
625 |
> |
Word(tm_date.tm_sec), DMs) |
626 |
|
except |
627 |
|
on E: EConvertError do begin |
628 |
|
IBError(ibxeInvalidDataConversion, [nil]); |
634 |
|
var |
635 |
|
tm_date: TCTimeStructure; |
636 |
|
Yr, Mn, Dy, Hr, Mt, S, Ms: Word; |
637 |
+ |
DMs: cardinal; |
638 |
|
begin |
639 |
|
DecodeDate(aDateTime, Yr, Mn, Dy); |
640 |
< |
DecodeTime(aDateTime, Hr, Mt, S, Ms); |
640 |
> |
FBDecodeTime(aDateTime, Hr, Mt, S, DMs); |
641 |
|
with tm_date do begin |
642 |
|
tm_sec := S; |
643 |
|
tm_min := Mt; |
647 |
|
tm_year := Yr - 1900; |
648 |
|
end; |
649 |
|
isc_encode_date(@tm_date, PISC_QUAD(bufptr)); |
650 |
< |
if Ms > 0 then |
651 |
< |
Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,Ms*10); |
650 |
> |
if DMs > 0 then |
651 |
> |
Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,DMs); |
652 |
|
end; |
653 |
|
|
654 |
|
function TFB25ClientAPI.SQLDecodeDateTime(bufptr: PByte): TDateTime; |
655 |
|
var |
656 |
|
tm_date: TCTimeStructure; |
657 |
< |
msecs: Word; |
657 |
> |
Dmsecs: Word; |
658 |
|
begin |
659 |
|
isc_decode_date(PISC_QUAD(bufptr), @tm_date); |
660 |
|
try |
661 |
|
result := EncodeDate(Word(tm_date.tm_year + 1900), Word(tm_date.tm_mon + 1), |
662 |
|
Word(tm_date.tm_mday)); |
663 |
< |
msecs := (PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000) div 10; |
663 |
> |
Dmsecs := PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000; |
664 |
|
if result >= 0 then |
665 |
< |
result := result + EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
666 |
< |
Word(tm_date.tm_sec), msecs) |
665 |
> |
result := result + FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
666 |
> |
Word(tm_date.tm_sec), Dmsecs) |
667 |
|
else |
668 |
< |
result := result - EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
669 |
< |
Word(tm_date.tm_sec), msecs) |
668 |
> |
result := result - FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
669 |
> |
Word(tm_date.tm_sec), Dmsecs) |
670 |
|
except |
671 |
|
on E: EConvertError do begin |
672 |
|
IBError(ibxeInvalidDataConversion, [nil]); |