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 359 by tony, Tue Dec 7 09:37:32 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 150 | Line 146 | type
146      isc_detach_database: Tisc_detach_database;
147      isc_attach_database: Tisc_attach_database;
148      isc_database_info: Tisc_database_info;
149 +    isc_transaction_info: Tisc_transaction_info;
150      isc_start_transaction: Tisc_start_transaction;
151      isc_start_multiple: Tisc_start_multiple;
152      isc_commit_transaction: Tisc_commit_transaction;
# Line 170 | Line 167 | type
167  
168    public
169      {Helper Functions}
173    function DecodeInteger(bufptr: PByte; len: short): integer; override;
170      procedure SQLEncodeDate(aDate: TDateTime; bufptr: PByte); override;
171      function SQLDecodeDate(bufptr: PByte): TDateTime; override;
172      procedure SQLEncodeTime(aTime: TDateTime; bufptr: PByte); override;
# Line 218 | Line 214 | implementation
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;
# Line 347 | Line 343 | begin
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}
# Line 373 | Line 368 | begin
368    isc_detach_database := GetProcAddr('isc_detach_database'); {do not localize}
369    isc_attach_database := GetProcAddr('isc_attach_database'); {do not localize}
370    isc_database_info := GetProcAddr('isc_database_info'); {do not localize}
371 +  isc_transaction_info := GetProcAddr('isc_transaction_info'); {do not localize}
372    isc_start_transaction := GetProcAddr('isc_start_transaction'); {do not localize}
373    isc_start_multiple := GetProcAddr('isc_start_multiple'); {do not localize}
374    isc_commit_transaction := GetProcAddr('isc_commit_transaction'); {do not localize}
# Line 561 | Line 557 | begin
557    Result := nil;
558   end;
559  
564 function TFB25ClientAPI.DecodeInteger(bufptr: PByte; len: short): integer;
565 begin
566  Result := isc_portable_integer(bufptr,len);
567 end;
568
560   procedure TFB25ClientAPI.SQLEncodeDate(aDate: TDateTime; bufptr: PByte);
561   var
562    tm_date: TCTimeStructure;
# Line 601 | Line 592 | end;
592   procedure TFB25ClientAPI.SQLEncodeTime(aTime: TDateTime; bufptr: PByte);
593   var
594    tm_date: TCTimeStructure;
595 <  Hr, Mt, S, Ms: Word;
595 >  Hr, Mt, S: Word;
596 >  DMs: cardinal; {DMs = decimilliseconds}
597   begin
598 <  DecodeTime(aTime, Hr, Mt, S, Ms);
598 >  FBDecodeTime(aTime, Hr, Mt, S, DMs);
599    with tm_date do begin
600      tm_sec := S;
601      tm_min := Mt;
# Line 613 | Line 605 | begin
605      tm_year := 0;
606    end;
607    isc_encode_sql_time(@tm_date, PISC_TIME(bufptr));
608 <  if Ms > 0 then
609 <    Inc(PISC_TIME(bufptr)^,Ms*10);
608 >  if DMs > 0 then
609 >    Inc(PISC_TIME(bufptr)^,DMs);
610   end;
611  
612   function TFB25ClientAPI.SQLDecodeTime(bufptr: PByte): TDateTime;
613   var
614    tm_date: TCTimeStructure;
615 <  msecs: Word;
615 >  DMs: cardinal; {DMs = decimilliseconds}
616   begin
617    isc_decode_sql_time(PISC_TIME(bufptr), @tm_date);
618    try
619 <    msecs :=  (PISC_TIME(bufptr)^ mod 10000) div 10;
620 <    result := EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
621 <                         Word(tm_date.tm_sec), msecs)
619 >    DMs :=  PISC_TIME(bufptr)^ mod 10000;
620 >    result := FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
621 >                         Word(tm_date.tm_sec), DMs)
622    except
623      on E: EConvertError do begin
624        IBError(ibxeInvalidDataConversion, [nil]);
# Line 638 | Line 630 | procedure TFB25ClientAPI.SQLEncodeDateTi
630   var
631    tm_date: TCTimeStructure;
632    Yr, Mn, Dy, Hr, Mt, S, Ms: Word;
633 +  DMs: cardinal;
634   begin
635    DecodeDate(aDateTime, Yr, Mn, Dy);
636 <  DecodeTime(aDateTime, Hr, Mt, S, Ms);
636 >  FBDecodeTime(aDateTime, Hr, Mt, S, DMs);
637    with tm_date do begin
638      tm_sec := S;
639      tm_min := Mt;
# Line 650 | Line 643 | begin
643      tm_year := Yr - 1900;
644    end;
645    isc_encode_date(@tm_date, PISC_QUAD(bufptr));
646 <  if Ms > 0 then
647 <    Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,Ms*10);
646 >  if DMs > 0 then
647 >    Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,DMs);
648   end;
649  
650   function TFB25ClientAPI.SQLDecodeDateTime(bufptr: PByte): TDateTime;
651   var
652    tm_date: TCTimeStructure;
653 <  msecs: Word;
653 >  Dmsecs: Word;
654   begin
655    isc_decode_date(PISC_QUAD(bufptr), @tm_date);
656    try
657      result := EncodeDate(Word(tm_date.tm_year + 1900), Word(tm_date.tm_mon + 1),
658                          Word(tm_date.tm_mday));
659 <    msecs := (PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000) div 10;
659 >    Dmsecs := PISC_TIMESTAMP(bufptr)^.timestamp_time mod 10000;
660      if result >= 0 then
661 <      result := result + EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
662 <                                    Word(tm_date.tm_sec), msecs)
661 >      result := result + FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
662 >                                    Word(tm_date.tm_sec), Dmsecs)
663      else
664 <      result := result - EncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
665 <                                    Word(tm_date.tm_sec), msecs)
664 >      result := result - FBEncodeTime(Word(tm_date.tm_hour), Word(tm_date.tm_min),
665 >                                    Word(tm_date.tm_sec), Dmsecs)
666    except
667      on E: EConvertError do begin
668        IBError(ibxeInvalidDataConversion, [nil]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines