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

Comparing ibx/trunk/fbintf/client/2.5/FB25ClientAPI.pas (file contents):
Revision 308 by tony, Sat Jul 18 10:26:30 2020 UTC vs.
Revision 345 by tony, Mon Aug 23 14:22:29 2021 UTC

# Line 74 | Line 74 | interface
74   uses
75    Classes, SysUtils, FBClientAPI, IBHeader, IBExternals, IB;
76  
77 const
78  FBClientInterfaceVersion = '2.5';
79
77   type
78  
79    { TFB25Status }
# Line 114 | Line 111 | type
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;
# Line 170 | Line 166 | type
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;
# Line 218 | Line 213 | implementation
213   uses FBMessages,
214      {$IFDEF WINDOWS}Windows, {$ENDIF}
215      {$IFDEF FPC} Dynlibs, {$ENDIF}
216 <  FB25Attachment, FB25Transaction, FB25Services, FBParamBlock,
217 <  IBUtils;
216 >  FB25Attachment, FB25Transaction, FB25Services,
217 >  IBUtils, FBAttachment, FBTransaction, FBServices;
218  
219   { Stubs for 6.0 only functions }
220   function isc_rollback_retaining_stub(status_vector   : PISC_STATUS;
# Line 347 | Line 342 | begin
342    BLOB_put := GetProcAddr('BLOB_put'); {do not localize}
343    isc_wait_for_event := GetProcAddr('isc_wait_for_event'); {do not localize}
344    isc_vax_integer := GetProcAddr('isc_vax_integer'); {do not localize}
350  isc_portable_integer := GetProcAddr('isc_portable_integer'); {do not localize}
345    isc_blob_info := GetProcAddr('isc_blob_info'); {do not localize}
346    isc_blob_lookup_desc := GetProcAddr('isc_blob_lookup_desc');  {do not localize}
347    isc_open_blob2 := GetProcAddr('isc_open_blob2'); {do not localize}
# Line 561 | Line 555 | begin
555    Result := nil;
556   end;
557  
564 function TFB25ClientAPI.DecodeInteger(bufptr: PByte; len: short): integer;
565 begin
566  Result := isc_portable_integer(bufptr,len);
567 end;
568
558   procedure TFB25ClientAPI.SQLEncodeDate(aDate: TDateTime; bufptr: PByte);
559   var
560    tm_date: TCTimeStructure;
# Line 601 | Line 590 | end;
590   procedure TFB25ClientAPI.SQLEncodeTime(aTime: TDateTime; bufptr: PByte);
591   var
592    tm_date: TCTimeStructure;
593 <  Hr, Mt, S, Ms: Word;
593 >  Hr, Mt, S: Word;
594 >  DMs: cardinal; {DMs = decimilliseconds}
595   begin
596 <  DecodeTime(aTime, Hr, Mt, S, Ms);
596 >  FBDecodeTime(aTime, Hr, Mt, S, DMs);
597    with tm_date do begin
598      tm_sec := S;
599      tm_min := Mt;
# Line 613 | Line 603 | begin
603      tm_year := 0;
604    end;
605    isc_encode_sql_time(@tm_date, PISC_TIME(bufptr));
606 <  if Ms > 0 then
607 <    Inc(PISC_TIME(bufptr)^,Ms*10);
606 >  if DMs > 0 then
607 >    Inc(PISC_TIME(bufptr)^,DMs);
608   end;
609  
610   function TFB25ClientAPI.SQLDecodeTime(bufptr: PByte): TDateTime;
611   var
612    tm_date: TCTimeStructure;
613 <  msecs: Word;
613 >  DMs: cardinal; {DMs = decimilliseconds}
614   begin
615    isc_decode_sql_time(PISC_TIME(bufptr), @tm_date);
616    try
617 <    msecs :=  (PISC_TIME(bufptr)^ mod 10000) div 10;
618 <    result := EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
619 <                         Word(tm_date.tm_sec), msecs)
617 >    DMs :=  PISC_TIME(bufptr)^ mod 10000;
618 >    result := FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
619 >                         Word(tm_date.tm_sec), DMs)
620    except
621      on E: EConvertError do begin
622        IBError(ibxeInvalidDataConversion, [nil]);
# Line 638 | Line 628 | procedure TFB25ClientAPI.SQLEncodeDateTi
628   var
629    tm_date: TCTimeStructure;
630    Yr, Mn, Dy, Hr, Mt, S, Ms: Word;
631 +  DMs: cardinal;
632   begin
633    DecodeDate(aDateTime, Yr, Mn, Dy);
634 <  DecodeTime(aDateTime, Hr, Mt, S, Ms);
634 >  FBDecodeTime(aDateTime, Hr, Mt, S, DMs);
635    with tm_date do begin
636      tm_sec := S;
637      tm_min := Mt;
# Line 650 | Line 641 | begin
641      tm_year := Yr - 1900;
642    end;
643    isc_encode_date(@tm_date, PISC_QUAD(bufptr));
644 <  if Ms > 0 then
645 <    Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,Ms*10);
644 >  if DMs > 0 then
645 >    Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,DMs);
646   end;
647  
648   function TFB25ClientAPI.SQLDecodeDateTime(bufptr: PByte): TDateTime;
649   var
650    tm_date: TCTimeStructure;
651 <  msecs: Word;
651 >  Dmsecs: Word;
652   begin
653    isc_decode_date(PISC_QUAD(bufptr), @tm_date);
654    try
655      result := EncodeDate(Word(tm_date.tm_year + 1900), Word(tm_date.tm_mon + 1),
656                          Word(tm_date.tm_mday));
657 <    msecs := (PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000) div 10;
657 >    Dmsecs := PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000;
658      if result >= 0 then
659 <      result := result + EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
660 <                                    Word(tm_date.tm_sec), msecs)
659 >      result := result + FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
660 >                                    Word(tm_date.tm_sec), Dmsecs)
661      else
662 <      result := result - EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
663 <                                    Word(tm_date.tm_sec), msecs)
662 >      result := result - FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
663 >                                    Word(tm_date.tm_sec), Dmsecs)
664    except
665      on E: EConvertError do begin
666        IBError(ibxeInvalidDataConversion, [nil]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines