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 |
|
|
430 |
|
procedure TOutputBlockItem.SetString(out S: AnsiString; Buf: PByte; |
431 |
|
Len: integer; CodePage: TSystemCodePage); |
432 |
|
var rs: RawByteString; |
433 |
+ |
i: integer; |
434 |
|
begin |
435 |
< |
system.SetString(rs,PAnsiChar(Buf),len); |
435 |
> |
{There seems to be a memory manager problem with SetString that can cause |
436 |
> |
an unhandled exception at the end of a program if it is used to set the |
437 |
> |
string. Safer to copy characters one by one. Note that Setlength does |
438 |
> |
not work around the bug either.} |
439 |
> |
rs := ''; |
440 |
> |
for i := 0 to len-1 do |
441 |
> |
rs := rs + PAnsiChar(buf+i)^; |
442 |
> |
// system.SetString(rs,PAnsiChar(Buf),len); |
443 |
|
SetCodePage(rs,CodePage,false); |
444 |
|
S := rs; |
445 |
|
end; |
504 |
|
Result := ''; |
505 |
|
with FItemData^ do |
506 |
|
case FDataType of |
507 |
+ |
dtIntegerFixed, |
508 |
|
dtInteger: |
509 |
|
Result := IntToStr(getAsInteger); |
510 |
|
dtByte: |
780 |
|
begin |
781 |
|
for i := 0 to length(FItems) - 1 do |
782 |
|
begin |
783 |
< |
for j := 0 to Length(FItems[i]^.FSubItems) -1 do |
784 |
< |
dispose(FItems[i]^.FSubItems[j]); |
785 |
< |
dispose(FItems[i]); |
783 |
> |
if FItems[i] <> nil then |
784 |
> |
begin |
785 |
> |
for j := 0 to Length(FItems[i]^.FSubItems) -1 do |
786 |
> |
if FItems[i]^.FSubItems[j] <> nil then |
787 |
> |
dispose(FItems[i]^.FSubItems[j]); |
788 |
> |
dispose(FItems[i]); |
789 |
> |
end; |
790 |
|
end; |
791 |
|
FreeMem(FBuffer); |
792 |
|
inherited Destroy; |
862 |
|
else |
863 |
|
begin |
864 |
|
item := TOutputBlockItem.Create(self,(aItems[i])); |
865 |
< |
writeln(Indent,'ItemType = ',byte(FBufPtr^),' Value = ',(item as TOutputBlockItem).GetAsString); |
865 |
> |
try |
866 |
> |
writeln(Indent,'ItemType = ',byte(FBufPtr^),' Value = ',(item as TOutputBlockItem).GetAsString); |
867 |
> |
except |
868 |
> |
writeln(Indent,'Unknown ItemType = ',byte(FBufPtr^)); |
869 |
> |
end; |
870 |
|
end; |
871 |
|
end; |
872 |
|
end; |
883 |
|
if byte(FBuffer[i]) = isc_info_end then break; |
884 |
|
end; |
885 |
|
writeln; |
886 |
+ |
for i := 0 to getBufSize - 1 do |
887 |
+ |
begin |
888 |
+ |
if chr(FBuffer[i]) in [' '..'~'] then |
889 |
+ |
write(chr(Buffer[i])) |
890 |
+ |
else |
891 |
+ |
write('.'); |
892 |
+ |
if byte(FBuffer[i]) = isc_info_end then break; |
893 |
+ |
end; |
894 |
+ |
writeln; |
895 |
|
end; |
896 |
|
|
897 |
|
{ TDBInfoItem } |
1094 |
|
while (P < FBufPtr + FSize) and (P^ <> isc_info_flag_end) do |
1095 |
|
begin |
1096 |
|
SetLength(FSubItems,i+1); |
1097 |
+ |
FSubItems[i] := nil; |
1098 |
|
case group of |
1099 |
|
isc_info_svc_svr_db_info: |
1100 |
|
case integer(P^) of |
1106 |
|
FSubItems[i] := AddStringItem(P); |
1107 |
|
|
1108 |
|
else |
1109 |
< |
IBError(ibxeOutputParsingError, [integer(P^)]); |
1109 |
> |
IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]); |
1110 |
|
end; |
1111 |
|
|
1112 |
|
isc_info_svc_get_license: |
1115 |
|
isc_spb_lic_key: |
1116 |
|
FSubItems[i] := AddIntegerItem(P); |
1117 |
|
else |
1118 |
< |
IBError(ibxeOutputParsingError, [integer(P^)]); |
1118 |
> |
IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]); |
1119 |
|
end; |
1120 |
|
|
1121 |
|
isc_info_svc_limbo_trans: |
1134 |
|
isc_spb_tra_state: |
1135 |
|
FSubItems[i] := AddByteItem(P); |
1136 |
|
else |
1137 |
< |
IBError(ibxeOutputParsingError, [integer(P^)]); |
1137 |
> |
IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]); |
1138 |
|
end; |
1139 |
|
|
1140 |
|
isc_info_svc_get_users: |
1152 |
|
FSubItems[i] := AddStringItem(P); |
1153 |
|
|
1154 |
|
else |
1155 |
< |
IBError(ibxeOutputParsingError, [integer(P^)]); |
1155 |
> |
IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,FSize - (P-FBufPtr))]); |
1156 |
|
end; |
1157 |
|
|
1158 |
|
end; |
1203 |
|
while (P < Buffer + getBufSize) and (P^ <> isc_info_end) do |
1204 |
|
begin |
1205 |
|
SetLength(FItems,i+1); |
1206 |
+ |
FItems[i] := nil; |
1207 |
|
case integer(P^) of |
1208 |
|
isc_info_svc_line, |
1209 |
|
isc_info_svc_get_env, |
1238 |
|
|
1239 |
|
|
1240 |
|
else |
1241 |
< |
IBError(ibxeOutputParsingError, [integer(P^)]); |
1241 |
> |
IBError(ibxeOutputParsingError, [integer(P^),BufToStr(P,getBufSize - (P-Buffer))]); |
1242 |
|
end; |
1243 |
|
P := P + FItems[i]^.FSize; |
1244 |
|
Inc(i); |