74 |
|
uses |
75 |
|
Classes, SysUtils, FBClientAPI, IBHeader, IBExternals, IB; |
76 |
|
|
77 |
– |
const |
78 |
– |
FBClientInterfaceVersion = '2.5'; |
79 |
– |
|
77 |
|
type |
78 |
|
|
79 |
|
{ TFB25Status } |
215 |
|
uses FBMessages, |
216 |
|
{$IFDEF WINDOWS}Windows, {$ENDIF} |
217 |
|
{$IFDEF FPC} Dynlibs, {$ENDIF} |
218 |
< |
FB25Attachment, FB25Transaction, FB25Services, FBParamBlock, |
219 |
< |
IBUtils; |
218 |
> |
FB25Attachment, FB25Transaction, FB25Services, |
219 |
> |
IBUtils, FBAttachment, FBTransaction, FBServices; |
220 |
|
|
221 |
|
{ Stubs for 6.0 only functions } |
222 |
|
function isc_rollback_retaining_stub(status_vector : PISC_STATUS; |
598 |
|
procedure TFB25ClientAPI.SQLEncodeTime(aTime: TDateTime; bufptr: PByte); |
599 |
|
var |
600 |
|
tm_date: TCTimeStructure; |
601 |
< |
Hr, Mt, S, Ms: Word; |
601 |
> |
Hr, Mt, S: Word; |
602 |
> |
DMs: cardinal; {DMs = decimilliseconds} |
603 |
|
begin |
604 |
< |
DecodeTime(aTime, Hr, Mt, S, Ms); |
604 |
> |
FBDecodeTime(aTime, Hr, Mt, S, DMs); |
605 |
|
with tm_date do begin |
606 |
|
tm_sec := S; |
607 |
|
tm_min := Mt; |
611 |
|
tm_year := 0; |
612 |
|
end; |
613 |
|
isc_encode_sql_time(@tm_date, PISC_TIME(bufptr)); |
614 |
< |
if Ms > 0 then |
615 |
< |
Inc(PISC_TIME(bufptr)^,Ms*10); |
614 |
> |
if DMs > 0 then |
615 |
> |
Inc(PISC_TIME(bufptr)^,DMs); |
616 |
|
end; |
617 |
|
|
618 |
|
function TFB25ClientAPI.SQLDecodeTime(bufptr: PByte): TDateTime; |
619 |
|
var |
620 |
|
tm_date: TCTimeStructure; |
621 |
< |
msecs: Word; |
621 |
> |
DMs: cardinal; {DMs = decimilliseconds} |
622 |
|
begin |
623 |
|
isc_decode_sql_time(PISC_TIME(bufptr), @tm_date); |
624 |
|
try |
625 |
< |
msecs := (PISC_TIME(bufptr)^ mod 10000) div 10; |
626 |
< |
result := EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
627 |
< |
Word(tm_date.tm_sec), msecs) |
625 |
> |
DMs := PISC_TIME(bufptr)^ mod 10000; |
626 |
> |
result := FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
627 |
> |
Word(tm_date.tm_sec), DMs) |
628 |
|
except |
629 |
|
on E: EConvertError do begin |
630 |
|
IBError(ibxeInvalidDataConversion, [nil]); |
636 |
|
var |
637 |
|
tm_date: TCTimeStructure; |
638 |
|
Yr, Mn, Dy, Hr, Mt, S, Ms: Word; |
639 |
+ |
DMs: cardinal; |
640 |
|
begin |
641 |
|
DecodeDate(aDateTime, Yr, Mn, Dy); |
642 |
< |
DecodeTime(aDateTime, Hr, Mt, S, Ms); |
642 |
> |
FBDecodeTime(aDateTime, Hr, Mt, S, DMs); |
643 |
|
with tm_date do begin |
644 |
|
tm_sec := S; |
645 |
|
tm_min := Mt; |
649 |
|
tm_year := Yr - 1900; |
650 |
|
end; |
651 |
|
isc_encode_date(@tm_date, PISC_QUAD(bufptr)); |
652 |
< |
if Ms > 0 then |
653 |
< |
Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,Ms*10); |
652 |
> |
if DMs > 0 then |
653 |
> |
Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,DMs); |
654 |
|
end; |
655 |
|
|
656 |
|
function TFB25ClientAPI.SQLDecodeDateTime(bufptr: PByte): TDateTime; |
657 |
|
var |
658 |
|
tm_date: TCTimeStructure; |
659 |
< |
msecs: Word; |
659 |
> |
Dmsecs: Word; |
660 |
|
begin |
661 |
|
isc_decode_date(PISC_QUAD(bufptr), @tm_date); |
662 |
|
try |
663 |
|
result := EncodeDate(Word(tm_date.tm_year + 1900), Word(tm_date.tm_mon + 1), |
664 |
|
Word(tm_date.tm_mday)); |
665 |
< |
msecs := (PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000) div 10; |
665 |
> |
Dmsecs := PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000; |
666 |
|
if result >= 0 then |
667 |
< |
result := result + EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
668 |
< |
Word(tm_date.tm_sec), msecs) |
667 |
> |
result := result + FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
668 |
> |
Word(tm_date.tm_sec), Dmsecs) |
669 |
|
else |
670 |
< |
result := result - EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
671 |
< |
Word(tm_date.tm_sec), msecs) |
670 |
> |
result := result - FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min), |
671 |
> |
Word(tm_date.tm_sec), Dmsecs) |
672 |
|
except |
673 |
|
on E: EConvertError do begin |
674 |
|
IBError(ibxeInvalidDataConversion, [nil]); |