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

Comparing:
ibx/branches/journaling/fbintf/IBUtils.pas (file contents), Revision 363 by tony, Tue Dec 7 13:30:05 2021 UTC vs.
ibx/branches/udr/client/IBUtils.pas (file contents), Revision 394 by tony, Sat Feb 12 23:26:48 2022 UTC

# Line 720 | Line 720 | type
720      property OnProgressEvent: TOnProgressEvent read FOnProgressEvent write FOnProgressEvent; {Progress Bar Support}
721   end;
722  
723 < TJnlEntryType = (jeTransStart, jeTransCommit, jeTransCommitRet, jeTransRollback,
724 <                   jeTransRollbackRet, jeTransEnd, jeQuery,jeUnknown);
723 > TJnlEntryType = (jeTransStart, jeTransCommit, jeTransCommitFail, jeTransCommitRet, jeTransRollback,
724 >                   jeTransRollbackFail, jeTransRollbackRet, jeQuery,jeUnknown);
725  
726   TJnlEntry = record
727     JnlEntryType: TJnlEntryType;
728     Timestamp: TDateTime;
729 <   SessionID: integer;
730 <   TransactionID: integer;
731 <   OldTransactionID: integer;
729 >   AttachmentID: cardinal;
730 >   SessionID: cardinal;
731 >   TransactionID: cardinal;
732 >   OldTransactionID: cardinal;
733     TransactionName: AnsiString;
734     TPB: ITPB;
735     DefaultCompletion: TTransactionCompletion;
# Line 741 | Line 742 | type
742  
743     TJournalProcessor = class(TSQLTokeniser)
744      private
745 <      type TLineState = (lsInit, lsJnlFound, lsGotTimestamp, lsGotJnlType,  lsGotSessionID,
745 >      type TLineState = (lsInit, lsJnlFound, lsGotTimestamp, lsGotJnlType,
746 >                          lsGotAttachmentID, lsGotSessionID,
747                            lsGotTransactionID,  lsGotOldTransactionID, lsGotText1Length,
748                            lsGotText1, lsGotText2Length, lsGotText2);
749      private
# Line 793 | Line 795 | function FBFormatDateTime(fmt: AnsiStrin
795   function FormatTimeZoneOffset(EffectiveTimeOffsetMins: integer): AnsiString;
796   function DecodeTimeZoneOffset(TZOffset: AnsiString; var dstOffset: integer): boolean;
797   function StripLeadingZeros(Value: AnsiString): AnsiString;
796 function TryStrToNumeric(S: Ansistring; out Value: int64; out scale: integer): boolean;
797 function NumericToDouble(aValue: Int64; aScale: integer): double;
798   function StringToHex(octetString: string; MaxLineLength: integer=0): string; overload;
799   procedure StringToHex(octetString: string; TextOut: TStrings; MaxLineLength: integer=0); overload;
800  
# Line 2015 | Line 2015 | begin
2015      end;
2016   end;
2017  
2018 function TryStrToNumeric(S: Ansistring; out Value: int64; out scale: integer): boolean;
2019 var i: integer;
2020    ds: integer;
2021    exponent: integer;
2022 begin
2023  Result := false;
2024  ds := 0;
2025  exponent := 0;
2026  S := Trim(S);
2027  Value := 0;
2028  scale := 0;
2029  if Length(S) = 0 then
2030    Exit;
2031  {$IF declared(DefaultFormatSettings)}
2032  with DefaultFormatSettings do
2033  {$ELSE}
2034  {$IF declared(FormatSettings)}
2035  with FormatSettings do
2036  {$IFEND}
2037  {$IFEND}
2038  begin
2039    for i := length(S) downto 1 do
2040    begin
2041      if S[i] = AnsiChar(DecimalSeparator) then
2042      begin
2043          if ds <> 0 then Exit; {only one allowed}
2044          ds := i;
2045          dec(exponent);
2046          system.Delete(S,i,1);
2047      end
2048      else
2049      if S[i] in ['+','-'] then
2050      begin
2051       if (i > 1) and not (S[i-1] in ['e','E']) then
2052          Exit; {malformed}
2053      end
2054      else
2055      if S[i] in ['e','E'] then {scientific notation}
2056      begin
2057        if ds <> 0 then Exit; {not permitted in exponent}
2058        if exponent <> 0 then Exit; {only one allowed}
2059        exponent := i;
2060      end
2061      else
2062      if not (S[i] in ['0'..'9']) then
2063      {Note: ThousandSeparator not allowed by Delphi specs}
2064          Exit; {bad character}
2065    end;
2066
2067    if exponent > 0 then
2068    begin
2069      Result := TryStrToInt(system.copy(S,exponent+1,maxint),Scale);
2070      if Result then
2071      begin
2072        {adjust scale for decimal point}
2073        if ds <> 0 then
2074          Scale := Scale - (exponent - ds);
2075        Result := TryStrToInt64(system.copy(S,1,exponent-1),Value);
2076      end;
2077    end
2078    else
2079    begin
2080      if ds <> 0 then
2081        scale := ds - Length(S) - 1;
2082      Result := TryStrToInt64(S,Value);
2083    end;
2084  end;
2085 end;
2086
2087 function NumericToDouble(aValue: Int64; aScale: integer): double;
2088 begin
2089  Result := aValue * IntPower(10,aScale)
2090 end;
2091
2092
2018   function StringToHex(octetString: string; MaxLineLength: integer): string; overload;
2019  
2020    function ToHex(aValue: byte): string;
# Line 2870 | Line 2795 | begin
2795      end;
2796  
2797     sqltComma:
2798 <     if not (LineState in [lsGotTimestamp,lsGotSessionID,lsGotTransactionID,lsGotText1,lsGotText2]) then
2798 >     if not (LineState in [lsGotTimestamp,lsGotAttachmentID,lsGotSessionID,lsGotTransactionID,lsGotText1,lsGotText2]) then
2799         LineState := lsInit;
2800  
2801     sqltNumberString:
2802       case LineState of
2803       lsGotTimestamp:
2804         begin
2805 +         AttachmentID := StrToInt(TokenText);
2806 +         LineState := lsGotAttachmentID;
2807 +       end;
2808 +
2809 +     lsGotAttachmentID:
2810 +       begin
2811           SessionID := StrToInt(TokenText);
2812           LineState := lsGotSessionID;
2813         end;
# Line 2884 | Line 2815 | begin
2815       lsGotSessionID:
2816         begin
2817           TransactionID := StrToInt(TokenText);
2818 <         if JnlEntryType in [jeTransCommit, jeTransRollback] then
2818 >         if JnlEntryType in [jeTransCommit, jeTransCommitFail, jeTransRollback, jeTransRollbackFail] then
2819           begin
2820             if assigned(FOnNextJournalEntry) then
2821               OnNextJournalEntry(JnlEntry);
# Line 2910 | Line 2841 | begin
2841             end;
2842  
2843           jeTransCommitRet,
2844 +         jeTransCommitFail,
2845 +         jeTransRollbackFail,
2846           jeTransRollbackRet:
2847             begin
2848               OldTransactionID := StrToInt(TokenText);
# Line 2962 | Line 2895 | begin
2895      Result := jeTransRollback;
2896    'r':
2897      Result := jeTransRollbackRet;
2965  'E':
2966    Result := jeTransEnd;
2898    'Q':
2899      Result := jeQuery;
2900 +  'F':
2901 +    Result := jeTransCommitFail;
2902 +  'f':
2903 +    Result := jeTransRollbackFail;
2904    end;
2905   end;
2906  
# Line 2976 | Line 2911 | begin
2911      Result := 'Transaction Start';
2912    jeTransCommit:
2913      Result := 'Commit';
2914 +  jeTransCommitFail:
2915 +    Result := 'Commit (Failed)';
2916    jeTransCommitRet:
2917      Result := 'Commit Retaining';
2918    jeTransRollback:
2919      Result := 'Rollback';
2920 +  jeTransRollbackFail:
2921 +    Result := 'Rollback (Failed)';
2922    jeTransRollbackRet:
2923      Result := 'Rollback Retaining';
2985  jeTransEnd:
2986    Result := 'Transaction End';
2924    jeQuery:
2925      Result := 'Query';
2926    jeUnknown:

Comparing:
ibx/branches/journaling/fbintf/IBUtils.pas (property svn:eol-style), Revision 363 by tony, Tue Dec 7 13:30:05 2021 UTC vs.
ibx/branches/udr/client/IBUtils.pas (property svn:eol-style), Revision 394 by tony, Sat Feb 12 23:26:48 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines