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

Comparing ibx/trunk/fbintf/client/FBOutputBlock.pas (file contents):
Revision 143 by tony, Fri Feb 23 12:11:21 2018 UTC vs.
Revision 144 by tony, Sat Feb 24 23:15:51 2018 UTC

# Line 302 | Line 302 | implementation
302  
303   uses FBMessages {$IFNDEF FPC}, TypInfo {$ENDIF};
304  
305 + function BufToStr(P: PByte; Len: integer):AnsiString;
306 + begin
307 +  SetLength(Result,Len);
308 +  Move(P^,Result[1],Len);
309 + end;
310 +
311   {$IFDEF FPC}
312   { TOutputBlockItemGroup }
313  
# Line 490 | Line 496 | begin
496    Result := '';
497    with FItemData^ do
498    case FDataType of
499 +  dtIntegerFixed,
500    dtInteger:
501      Result := IntToStr(getAsInteger);
502    dtByte:
# Line 765 | Line 772 | var i, j: integer;
772   begin
773    for i := 0 to length(FItems) - 1 do
774    begin
775 <    for j := 0 to Length(FItems[i]^.FSubItems) -1 do
776 <      dispose(FItems[i]^.FSubItems[j]);
777 <    dispose(FItems[i]);
775 >    if FItems[i] <> nil then
776 >    begin
777 >      for j := 0 to Length(FItems[i]^.FSubItems) -1 do
778 >        if FItems[i]^.FSubItems[j] <> nil then
779 >          dispose(FItems[i]^.FSubItems[j]);
780 >      dispose(FItems[i]);
781 >    end;
782    end;
783    FreeMem(FBuffer);
784    inherited Destroy;
# Line 843 | Line 854 | begin
854      else
855        begin
856          item := TOutputBlockItem.Create(self,(aItems[i]));
857 <        writeln(Indent,'ItemType = ',byte(FBufPtr^),' Value = ',(item as TOutputBlockItem).GetAsString);
857 >        try
858 >          writeln(Indent,'ItemType = ',byte(FBufPtr^),' Value = ',(item as TOutputBlockItem).GetAsString);
859 >        except
860 >          writeln(Indent,'Unknown ItemType = ',byte(FBufPtr^));
861 >        end;
862        end;
863      end;
864    end;
# Line 860 | Line 875 | begin
875      if byte(FBuffer[i]) = isc_info_end then break;
876    end;
877    writeln;
878 +  for i := 0 to getBufSize - 1 do
879 +  begin
880 +    if chr(FBuffer[i]) in [' '..'~'] then
881 +      write(chr(Buffer[i]))
882 +    else
883 +      write('.');
884 +    if byte(FBuffer[i]) = isc_info_end then break;
885 +  end;
886 +  writeln;
887   end;
888  
889   { TDBInfoItem }
# Line 1062 | Line 1086 | begin
1086      while (P < FBufPtr + FSize) and (P^ <> isc_info_flag_end) do
1087      begin
1088        SetLength(FSubItems,i+1);
1089 +      FSubItems[i] := nil;
1090        case group of
1091        isc_info_svc_svr_db_info:
1092          case integer(P^) of
# Line 1073 | Line 1098 | begin
1098              FSubItems[i] := AddStringItem(P);
1099  
1100            else
1101 <            IBError(ibxeOutputParsingError, [integer(P^)]);
1101 >            IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]);
1102            end;
1103  
1104        isc_info_svc_get_license:
# Line 1082 | Line 1107 | begin
1107          isc_spb_lic_key:
1108            FSubItems[i] := AddIntegerItem(P);
1109          else
1110 <          IBError(ibxeOutputParsingError, [integer(P^)]);
1110 >          IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]);
1111          end;
1112  
1113        isc_info_svc_limbo_trans:
# Line 1101 | Line 1126 | begin
1126         isc_spb_tra_state:
1127           FSubItems[i] := AddByteItem(P);
1128         else
1129 <         IBError(ibxeOutputParsingError, [integer(P^)]);
1129 >         IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]);
1130         end;
1131  
1132        isc_info_svc_get_users:
# Line 1119 | Line 1144 | begin
1144            FSubItems[i] := AddStringItem(P);
1145  
1146          else
1147 <          IBError(ibxeOutputParsingError, [integer(P^)]);
1147 >          IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]);
1148          end;
1149  
1150        end;
# Line 1170 | Line 1195 | begin
1195    while  (P < Buffer + getBufSize) and (P^ <> isc_info_end) do
1196    begin
1197      SetLength(FItems,i+1);
1198 +    FItems[i] := nil;
1199      case integer(P^) of
1200      isc_info_svc_line,
1201      isc_info_svc_get_env,
# Line 1204 | Line 1230 | begin
1230  
1231  
1232      else
1233 <       IBError(ibxeOutputParsingError, [integer(P^)]);
1233 >       IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,getBufSize - (P-Buffer))]);
1234      end;
1235      P := P + FItems[i]^.FSize;
1236      Inc(i);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines