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

Comparing ibx/trunk/fbintf/client/FBParamBlock.pas (file contents):
Revision 143 by tony, Fri Feb 23 12:11:21 2018 UTC vs.
Revision 263 by tony, Thu Dec 6 15:55:01 2018 UTC

# Line 63 | Line 63 | type
63    private
64      FItems: array of PParamBlockItemData;
65      FBufferSize: integer;
66 +    FFirebirdClientAPI: TFBClientAPI;
67      procedure AdjustBuffer;
68      procedure MoveBy(Item: PParamBlockItemData; delta: integer);
69      procedure UpdateRequestItemSize(Item: TParamBlockItem; NewSize: integer);
# Line 73 | Line 74 | type
74      function Find(ParamType: byte): PParamBlockItemData;
75      function GetItems(index: integer): PParamBlockItemData;
76    public
77 <    constructor Create;
77 >    constructor Create(api: TFBClientAPI);
78      destructor Destroy; override;
79      function getBuffer: PByte;
80      function getDataLength: integer;
# Line 92 | Line 93 | type
93       FOwner: TParamBlock;
94       FOwnerIntf: IUnknown;
95       FParamData: PParamBlockItemData;
96 +     FFirebirdClientAPI: TFBClientAPI;
97    protected
98      property ParamData: PParamBlockItemData read FParamData;
99    public
# Line 194 | Line 196 | type
196  
197    TDPB = class (TCustomParamBlock<TDPBItem,IDPBItem>, IDPB)
198    public
199 <    constructor Create;
199 >    constructor Create(api: TFBClientAPI);
200    end;
201  
202    { TTPB }
203  
204    TTPB = class (TCustomParamBlock<TTPBItem,ITPBItem>, ITPB)
205    public
206 <    constructor Create;
206 >    constructor Create(api: TFBClientAPI);
207    end;
208  
209    { TSPB }
210  
211    TSPB = class (TCustomParamBlock<TSPBItem,ISPBItem>, ISPB)
212    public
213 <   constructor Create;
213 >   constructor Create(api: TFBClientAPI);
214    end;
215  
216    { TSRB }
# Line 223 | Line 225 | type
225  
226    TBPB = class (TCustomParamBlock<TBPBItem,IBPBItem>, IBPB)
227    public
228 <   constructor Create;
228 >   constructor Create(api: TFBClientAPI);
229    end;
230  
231    TDIRB = class (TCustomParamBlock<TDIRBItem,IDIRBItem>, IDIRB);
# Line 275 | Line 277 | begin
277      begin
278        FOwner.UpdateRequestItemSize(self,count + 4);
279        Result := source.Read((FBufPtr+3)^,count);
280 <      with FirebirdClientAPI do
280 >      with FFirebirdClientAPI do
281          EncodeInteger(Result,2,FBufPtr+1);
282        (FBufPtr+Result + 3)^ := isc_info_end;
283        if Result <> count then
# Line 303 | Line 305 | constructor TParamBlockItem.Create(AOwne
305   begin
306    inherited Create;
307    FOwner := AOwner;
308 +  FFirebirdClientAPI := AOwner.FFirebirdClientAPI;
309    FOwnerIntf := AOwner;
310    FParamData := Data;
311   end;
312  
313   function TParamBlockItem.getAsInteger: integer;
314   begin
315 <  with FirebirdClientAPI, FParamData^ do
315 >  with FFirebirdClientAPI, FParamData^ do
316    case FDataType of
317    dtInteger:
318      Result := DecodeInteger(FBufPtr+1,4);
# Line 354 | Line 357 | begin
357      end;
358    dtString2:
359      begin
360 <      with FirebirdClientAPI do
360 >      with FFirebirdClientAPI do
361          len := DecodeInteger(FBufPtr+1,2);
362        SetString(Result,PAnsiChar(FBufPtr+3),len);
363      end;
# Line 399 | Line 402 | begin
402      P := FBufPtr + FBufLength;
403      len := FBufLength + 2;
404      FOwner.UpdateRequestItemSize(self,len);
405 <    with FirebirdClientAPI do
405 >    with FFirebirdClientAPI do
406        EncodeInteger(aValue,2,P);
407    end;
408   end;
# Line 435 | Line 438 | begin
438    begin
439      if FBufLength <> 5 then
440        FOwner.UpdateRequestItemSize(self,5);
441 <    with FirebirdClientAPI do
441 >    with FFirebirdClientAPI do
442        EncodeInteger(aValue,4,FBufPtr+1);
443      FDataType := dtInteger;
444    end;
# Line 450 | Line 453 | begin
453      if FBufLength <> 6 then
454        FOwner.UpdateRequestItemSize(self,6);
455      (FBufPtr+1)^ := $4;
456 <    with FirebirdClientAPI do
456 >    with FFirebirdClientAPI do
457        EncodeInteger(aValue,4,FBufPtr+2);
458      FDataType := dtInteger1;
459    end;
# Line 464 | Line 467 | begin
467    begin
468      if FBufLength <> 7 then
469        FOwner.UpdateRequestItemSize(self,7);
470 <    with FirebirdClientAPI do
470 >    with FFirebirdClientAPI do
471      begin
472        EncodeInteger(4,2,FBufPtr+1); {Encode length as two bytes}
473        EncodeInteger(aValue,4,FBufPtr+3);
# Line 479 | Line 482 | begin
482    begin
483      if FBufLength <> 3 then
484        FOwner.UpdateRequestItemSize(self,3);
485 <    with FirebirdClientAPI do
485 >    with FFirebirdClientAPI do
486        EncodeInteger(aValue,2,FBufPtr+1);
487      FDataType := dtShortInteger;
488    end;
# Line 491 | Line 494 | begin
494    begin
495      if FBufLength <> 2 then
496        FOwner.UpdateRequestItemSize(self,2);
497 <    with FirebirdClientAPI do
497 >    with FFirebirdClientAPI do
498        EncodeInteger(aValue,1,FBufPtr+1);
499      FDataType := dtTinyInteger;
500    end;
# Line 526 | Line 529 | begin
529      if len > 65535 then
530        IBError(ibxStringTooLong,[aValue,65535]);
531      FOwner.UpdateRequestItemSize(self,len + 3);
532 <    with FirebirdClientAPI do
532 >    with FFirebirdClientAPI do
533        EncodeInteger(len,2,FBufPtr+1);
534      if len > 0 then
535        Move(aValue[1],(FBufPtr+3)^,len);
# Line 636 | Line 639 | begin
639    end;
640   end;
641  
642 < constructor TParamBlock.Create;
642 > constructor TParamBlock.Create(api: TFBClientAPI);
643   begin
644    inherited Create;
645 +  FFirebirdClientAPI := api;
646    GetMem(FBuffer,128);
647    if FBuffer = nil then
648      OutOfMemoryError;
# Line 804 | Line 808 | end;
808  
809   { TDPB }
810  
811 < constructor TDPB.Create;
811 > constructor TDPB.Create(api: TFBClientAPI);
812   begin
813 <  inherited Create;
813 >  inherited Create(api);
814    FDataLength := 1;
815    FBuffer^ := isc_dpb_version1;
816   end;
817  
818   { TTPB }
819  
820 < constructor TTPB.Create;
820 > constructor TTPB.Create(api: TFBClientAPI);
821   begin
822 <  inherited Create;
822 >  inherited Create(api);
823    FDataLength := 1;
824    FBuffer^ := isc_tpb_version3;
825   end;
826  
827   { TSPB }
828  
829 < constructor TSPB.Create;
829 > constructor TSPB.Create(api: TFBClientAPI);
830   begin
831 <  inherited Create;
831 >  inherited Create(api);
832    FDataLength := 2;
833    FBuffer^ := isc_spb_version;
834    (FBuffer+1)^ := isc_spb_current_version;
# Line 832 | Line 836 | end;
836  
837   { TBPB }
838  
839 < constructor TBPB.Create;
839 > constructor TBPB.Create(api: TFBClientAPI);
840   begin
841 <  inherited Create;
841 >  inherited Create(api);
842    FDataLength := 1;
843    FBuffer^ := isc_bpb_version1;
844   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines