73 |
|
FBuffer: PByte; |
74 |
|
FBufSize: integer; |
75 |
|
FBufferParsed: boolean; |
76 |
+ |
FFirebirdClientAPI: TFBClientAPI; |
77 |
|
procedure ParseBuffer; |
78 |
|
{$IFDEF DEBUGOUTPUTBLOCK} |
79 |
|
procedure FormattedPrint(const aItems: array of POutputBlockItemData; |
97 |
|
function AddDateTimeItem(BufPtr: PByte): POutputBlockItemData; |
98 |
|
function AddOctetString(BufPtr: PByte): POutputBlockItemData; |
99 |
|
public |
100 |
< |
constructor Create(aSize: integer = DefaultBufferSize); |
100 |
> |
constructor Create(api: TFBClientAPI; aSize: integer = DefaultBufferSize); |
101 |
|
destructor Destroy; override; |
102 |
|
function Buffer: PByte; |
103 |
|
function getBufSize: integer; |
117 |
|
FOwner: TOutputBlock; |
118 |
|
FOwnerIntf: IUnknown; |
119 |
|
FItemData: POutputBlockItemData; |
120 |
+ |
FFirebirdClientAPI: TFBClientAPI; |
121 |
|
protected |
122 |
|
function GetItem(index: integer): POutputBlockItemData; |
123 |
|
function Find(ItemType: byte): POutputBlockItemData; |
193 |
|
function AddSpecialItem(BufPtr: PByte): POutputBlockItemData; override; |
194 |
|
procedure DoParseBuffer; override; |
195 |
|
public |
196 |
< |
constructor Create(aSize: integer=DBInfoDefaultBufferSize); |
196 |
> |
constructor Create(api: TFBClientAPI; aSize: integer = DefaultBufferSize); |
197 |
|
{$IFNDEF FPC} |
198 |
|
function Find(ItemType: byte): IDBInfoItem; |
199 |
|
{$ENDIF} |
261 |
|
function AddListItem(BufPtr: PByte): POutputBlockItemData; override; |
262 |
|
procedure DoParseBuffer; override; |
263 |
|
public |
264 |
< |
constructor Create(aSize: integer = 1024); |
264 |
> |
constructor Create(api: TFBClientAPI; aSize: integer= DefaultBufferSize); |
265 |
|
end; |
266 |
|
|
267 |
|
IBlobInfoItem = interface |
297 |
|
protected |
298 |
|
procedure DoParseBuffer; override; |
299 |
|
public |
300 |
< |
constructor Create(aSize: integer=DBInfoDefaultBufferSize); |
300 |
> |
constructor Create(api: TFBClientAPI; aSize: integer = DefaultBufferSize); |
301 |
|
end; |
302 |
|
|
303 |
|
implementation |
411 |
|
if (index >= 0) and (index < Length(FItemData^.FSubItems)) then |
412 |
|
Result := FItemData^.FSubItems[index] |
413 |
|
else |
414 |
< |
with FirebirdClientAPI do |
414 |
> |
with FFirebirdClientAPI do |
415 |
|
IBError(ibxeOutputBlockIndexError,[index]); |
416 |
|
end; |
417 |
|
|
452 |
|
inherited Create; |
453 |
|
FOwner := AOwner; |
454 |
|
FOwnerIntf := AOwner; |
455 |
+ |
FFirebirdClientAPI := AOwner.FFirebirdClientAPI; |
456 |
|
FItemData := Data; |
457 |
|
end; |
458 |
|
|
481 |
|
with FItemData^ do |
482 |
|
case FDataType of |
483 |
|
dtIntegerFixed: |
484 |
< |
with FirebirdClientAPI do |
484 |
> |
with FFirebirdClientAPI do |
485 |
|
Result := DecodeInteger(FBufPtr+1,4); |
486 |
|
|
487 |
|
dtByte, |
488 |
|
dtInteger: |
489 |
< |
with FirebirdClientAPI do |
489 |
> |
with FFirebirdClientAPI do |
490 |
|
begin |
491 |
|
len := DecodeInteger(FBufPtr+1,2); |
492 |
|
Result := DecodeInteger(FBufPtr+3,len); |
519 |
|
end; |
520 |
|
dtString2: |
521 |
|
begin |
522 |
< |
with FirebirdClientAPI do |
522 |
> |
with FFirebirdClientAPI do |
523 |
|
len := DecodeInteger(FBufPtr+1,2); |
524 |
|
SetString(Result,FBufPtr+3,len,CP_ACP); |
525 |
|
end; |
526 |
|
dtOctetString: |
527 |
|
begin |
528 |
< |
with FirebirdClientAPI do |
528 |
> |
with FFirebirdClientAPI do |
529 |
|
len := DecodeInteger(FBufPtr+1,2); |
530 |
|
SetString(Result,FBufPtr+3,len,CP_NONE); |
531 |
|
end; |
566 |
|
var aDate: integer; |
567 |
|
aTime: integer; |
568 |
|
begin |
569 |
< |
with FItemData^, FirebirdClientAPI do |
569 |
> |
with FItemData^, FFirebirdClientAPI do |
570 |
|
if FDataType = dtDateTime then |
571 |
|
begin |
572 |
|
aDate := DecodeInteger(FBufPtr+3,4); |
593 |
|
end; |
594 |
|
dtString2: |
595 |
|
begin |
596 |
< |
with FirebirdClientAPI do |
596 |
> |
with FFirebirdClientAPI do |
597 |
|
len := DecodeInteger(FBufPtr+1,2); |
598 |
|
if (count > 0) and (count < len) then len := count; |
599 |
|
Result := stream.Write((FBufPtr+3)^,len); |
650 |
|
end |
651 |
|
else |
652 |
|
begin |
653 |
< |
with FirebirdClientAPI do |
653 |
> |
with FFirebirdClientAPI do |
654 |
|
FDataLength := DecodeInteger(FBufPtr+1, 2); |
655 |
|
FSize := FDataLength + 3; |
656 |
|
end; |
665 |
|
begin |
666 |
|
FDataType := dtString2; |
667 |
|
FBufPtr := BufPtr; |
668 |
< |
with FirebirdClientAPI do |
668 |
> |
with FFirebirdClientAPI do |
669 |
|
FDataLength := DecodeInteger(FBufPtr+1, 2); |
670 |
|
FSize := FDataLength + 3; |
671 |
|
SetLength(FSubItems,0); |
705 |
|
begin |
706 |
|
FDataType := dtBytes; |
707 |
|
FBufPtr := BufPtr; |
708 |
< |
with FirebirdClientAPI do |
708 |
> |
with FFirebirdClientAPI do |
709 |
|
FDataLength := DecodeInteger(FBufPtr+1, 2); |
710 |
|
FSize := FDataLength + 3; |
711 |
|
SetLength(FSubItems,0); |
745 |
|
begin |
746 |
|
FDataType := dtDateTime; |
747 |
|
FBufPtr := BufPtr; |
748 |
< |
with FirebirdClientAPI do |
748 |
> |
with FFirebirdClientAPI do |
749 |
|
FDataLength := DecodeInteger(FBufPtr+1, 2); |
750 |
|
FSize := FDataLength + 3; |
751 |
|
SetLength(FSubItems,0); |
759 |
|
begin |
760 |
|
FDataType := dtOctetString; |
761 |
|
FBufPtr := BufPtr; |
762 |
< |
with FirebirdClientAPI do |
762 |
> |
with FFirebirdClientAPI do |
763 |
|
FDataLength := DecodeInteger(FBufPtr+1, 2); |
764 |
|
FSize := FDataLength + 3; |
765 |
|
SetLength(FSubItems,0); |
766 |
|
end; |
767 |
|
end; |
768 |
|
|
769 |
< |
constructor TOutputBlock.Create(aSize: integer); |
769 |
> |
constructor TOutputBlock.Create(api: TFBClientAPI; aSize: integer); |
770 |
|
begin |
771 |
|
inherited Create; |
772 |
+ |
FFirebirdClientAPI := api; |
773 |
|
FBufSize := aSize; |
774 |
|
GetMem(FBuffer,aSize); |
775 |
|
if FBuffer = nil then |
969 |
|
SetLength(Result,TableCounts); |
970 |
|
P := FBufPtr + 3; |
971 |
|
for i := 0 to TableCounts -1 do |
972 |
< |
with FirebirdClientAPI do |
972 |
> |
with FFirebirdClientAPI do |
973 |
|
begin |
974 |
|
Result[i].TableID := DecodeInteger(P,2); |
975 |
|
Inc(P,2); |
988 |
|
Result := inherited AddSpecialItem(BufPtr); |
989 |
|
with Result^ do |
990 |
|
begin |
991 |
< |
with FirebirdClientAPI do |
991 |
> |
with FFirebirdClientAPI do |
992 |
|
FDataLength := DecodeInteger(FBufPtr+1,2); |
993 |
|
FSize := FDataLength + 3; |
994 |
|
end; |
1070 |
|
end; |
1071 |
|
{$ENDIF} |
1072 |
|
|
1073 |
< |
constructor TDBInformation.Create(aSize: integer); |
1073 |
> |
constructor TDBInformation.Create(api: TFBClientAPI; aSize: integer); |
1074 |
|
begin |
1075 |
< |
inherited Create(aSize); |
1075 |
> |
inherited Create(api,aSize); |
1076 |
|
FIntegerType := dtInteger; |
1077 |
|
end; |
1078 |
|
|
1089 |
|
group := byte(BufPtr^); |
1090 |
|
if group in [isc_info_svc_get_users,isc_info_svc_limbo_trans] then |
1091 |
|
begin |
1092 |
< |
with FirebirdClientAPI do |
1092 |
> |
with FFirebirdClientAPI do |
1093 |
|
Result^.FSize := DecodeInteger(P,2) + 3; |
1094 |
|
Inc(P,2); |
1095 |
|
end; |
1184 |
|
Result := inherited AddSpecialItem(BufPtr); |
1185 |
|
with Result^ do |
1186 |
|
begin |
1187 |
< |
with FirebirdClientAPI do |
1187 |
> |
with FFirebirdClientAPI do |
1188 |
|
FDataLength := DecodeInteger(FBufPtr+1, 2); |
1189 |
|
|
1190 |
|
P := FBufPtr + 3; {skip length bytes} |
1270 |
|
|
1271 |
|
if byte(BufPtr^) = isc_info_sql_records then |
1272 |
|
begin |
1273 |
< |
with FirebirdClientAPI do |
1273 |
> |
with FFirebirdClientAPI do |
1274 |
|
Result^.FSize := DecodeInteger(P,2) + 3; |
1275 |
|
Inc(P,2); |
1276 |
|
with Result^ do |
1346 |
|
end; |
1347 |
|
end; |
1348 |
|
|
1349 |
< |
constructor TSQLInfoResultsBuffer.Create(aSize: integer); |
1349 |
> |
constructor TSQLInfoResultsBuffer.Create(api: TFBClientAPI; aSize: integer); |
1350 |
|
begin |
1351 |
< |
inherited Create(aSize); |
1351 |
> |
inherited Create(api,aSize); |
1352 |
|
FIntegerType := dtInteger; |
1353 |
|
end; |
1354 |
|
|
1378 |
|
end; |
1379 |
|
end; |
1380 |
|
|
1381 |
< |
constructor TBlobInfo.Create(aSize: integer); |
1381 |
> |
constructor TBlobInfo.Create(api: TFBClientAPI; aSize: integer); |
1382 |
|
begin |
1383 |
< |
inherited Create(aSize); |
1383 |
> |
inherited Create(api,aSize); |
1384 |
|
FIntegerType := dtInteger; |
1385 |
|
end; |
1386 |
|
|