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 308 by tony, Sat Jul 18 10:26:30 2020 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 102 | Line 104 | type
104       function getAsString: AnsiString;
105       function getAsByte: byte;
106       procedure addByte(aValue: byte);
107 +     procedure addShortInt(aValue: ShortInt);
108       procedure addShortInteger(aValue: integer);
109       procedure setAsByte(aValue: byte);
110       procedure setAsByte2(aValue: byte);
# Line 194 | Line 197 | type
197  
198    TDPB = class (TCustomParamBlock<TDPBItem,IDPBItem>, IDPB)
199    public
200 <    constructor Create;
200 >    constructor Create(api: TFBClientAPI);
201    end;
202  
203    { TTPB }
204  
205    TTPB = class (TCustomParamBlock<TTPBItem,ITPBItem>, ITPB)
206    public
207 <    constructor Create;
207 >    constructor Create(api: TFBClientAPI);
208    end;
209  
210    { TSPB }
211  
212    TSPB = class (TCustomParamBlock<TSPBItem,ISPBItem>, ISPB)
213    public
214 <   constructor Create;
214 >   constructor Create(api: TFBClientAPI);
215    end;
216  
217    { TSRB }
# Line 223 | Line 226 | type
226  
227    TBPB = class (TCustomParamBlock<TBPBItem,IBPBItem>, IBPB)
228    public
229 <   constructor Create;
229 >   constructor Create(api: TFBClientAPI);
230    end;
231  
232    TDIRB = class (TCustomParamBlock<TDIRBItem,IDIRBItem>, IDIRB);
# Line 275 | Line 278 | begin
278      begin
279        FOwner.UpdateRequestItemSize(self,count + 4);
280        Result := source.Read((FBufPtr+3)^,count);
281 <      with FirebirdClientAPI do
281 >      with FFirebirdClientAPI do
282          EncodeInteger(Result,2,FBufPtr+1);
283        (FBufPtr+Result + 3)^ := isc_info_end;
284        if Result <> count then
# Line 303 | Line 306 | constructor TParamBlockItem.Create(AOwne
306   begin
307    inherited Create;
308    FOwner := AOwner;
309 +  FFirebirdClientAPI := AOwner.FFirebirdClientAPI;
310    FOwnerIntf := AOwner;
311    FParamData := Data;
312   end;
313  
314   function TParamBlockItem.getAsInteger: integer;
315   begin
316 <  with FirebirdClientAPI, FParamData^ do
316 >  with FFirebirdClientAPI, FParamData^ do
317    case FDataType of
318    dtInteger:
319      Result := DecodeInteger(FBufPtr+1,4);
# Line 354 | Line 358 | begin
358      end;
359    dtString2:
360      begin
361 <      with FirebirdClientAPI do
361 >      with FFirebirdClientAPI do
362          len := DecodeInteger(FBufPtr+1,2);
363        SetString(Result,PAnsiChar(FBufPtr+3),len);
364      end;
# Line 390 | Line 394 | begin
394    end;
395   end;
396  
397 + procedure TParamBlockItem.addShortInt(aValue: ShortInt);
398 + var len: integer;
399 +    P: PByte;
400 + begin
401 +  with FParamData^ do
402 +  begin
403 +    P := FBufPtr + FBufLength;
404 +    len := FBufLength + 1;
405 +    FOwner.UpdateRequestItemSize(self,len);
406 +    PShortInt(P)^ := aValue;
407 +  end;
408 + end;
409 +
410   procedure TParamBlockItem.addShortInteger(aValue: integer);
411   var len: integer;
412      P: PByte;
# Line 399 | Line 416 | begin
416      P := FBufPtr + FBufLength;
417      len := FBufLength + 2;
418      FOwner.UpdateRequestItemSize(self,len);
419 <    with FirebirdClientAPI do
419 >    with FFirebirdClientAPI do
420        EncodeInteger(aValue,2,P);
421    end;
422   end;
# Line 435 | Line 452 | begin
452    begin
453      if FBufLength <> 5 then
454        FOwner.UpdateRequestItemSize(self,5);
455 <    with FirebirdClientAPI do
455 >    with FFirebirdClientAPI do
456        EncodeInteger(aValue,4,FBufPtr+1);
457      FDataType := dtInteger;
458    end;
# Line 450 | Line 467 | begin
467      if FBufLength <> 6 then
468        FOwner.UpdateRequestItemSize(self,6);
469      (FBufPtr+1)^ := $4;
470 <    with FirebirdClientAPI do
470 >    with FFirebirdClientAPI do
471        EncodeInteger(aValue,4,FBufPtr+2);
472      FDataType := dtInteger1;
473    end;
# Line 464 | Line 481 | begin
481    begin
482      if FBufLength <> 7 then
483        FOwner.UpdateRequestItemSize(self,7);
484 <    with FirebirdClientAPI do
484 >    with FFirebirdClientAPI do
485      begin
486        EncodeInteger(4,2,FBufPtr+1); {Encode length as two bytes}
487        EncodeInteger(aValue,4,FBufPtr+3);
# Line 479 | Line 496 | begin
496    begin
497      if FBufLength <> 3 then
498        FOwner.UpdateRequestItemSize(self,3);
499 <    with FirebirdClientAPI do
499 >    with FFirebirdClientAPI do
500        EncodeInteger(aValue,2,FBufPtr+1);
501      FDataType := dtShortInteger;
502    end;
# Line 491 | Line 508 | begin
508    begin
509      if FBufLength <> 2 then
510        FOwner.UpdateRequestItemSize(self,2);
511 <    with FirebirdClientAPI do
511 >    with FFirebirdClientAPI do
512        EncodeInteger(aValue,1,FBufPtr+1);
513      FDataType := dtTinyInteger;
514    end;
# Line 526 | Line 543 | begin
543      if len > 65535 then
544        IBError(ibxStringTooLong,[aValue,65535]);
545      FOwner.UpdateRequestItemSize(self,len + 3);
546 <    with FirebirdClientAPI do
546 >    with FFirebirdClientAPI do
547        EncodeInteger(len,2,FBufPtr+1);
548      if len > 0 then
549        Move(aValue[1],(FBufPtr+3)^,len);
# Line 636 | Line 653 | begin
653    end;
654   end;
655  
656 < constructor TParamBlock.Create;
656 > constructor TParamBlock.Create(api: TFBClientAPI);
657   begin
658    inherited Create;
659 +  FFirebirdClientAPI := api;
660    GetMem(FBuffer,128);
661    if FBuffer = nil then
662      OutOfMemoryError;
# Line 804 | Line 822 | end;
822  
823   { TDPB }
824  
825 < constructor TDPB.Create;
825 > constructor TDPB.Create(api: TFBClientAPI);
826   begin
827 <  inherited Create;
827 >  inherited Create(api);
828    FDataLength := 1;
829    FBuffer^ := isc_dpb_version1;
830   end;
831  
832   { TTPB }
833  
834 < constructor TTPB.Create;
834 > constructor TTPB.Create(api: TFBClientAPI);
835   begin
836 <  inherited Create;
836 >  inherited Create(api);
837    FDataLength := 1;
838    FBuffer^ := isc_tpb_version3;
839   end;
840  
841   { TSPB }
842  
843 < constructor TSPB.Create;
843 > constructor TSPB.Create(api: TFBClientAPI);
844   begin
845 <  inherited Create;
845 >  inherited Create(api);
846    FDataLength := 2;
847    FBuffer^ := isc_spb_version;
848    (FBuffer+1)^ := isc_spb_current_version;
# Line 832 | Line 850 | end;
850  
851   { TBPB }
852  
853 < constructor TBPB.Create;
853 > constructor TBPB.Create(api: TFBClientAPI);
854   begin
855 <  inherited Create;
855 >  inherited Create(api);
856    FDataLength := 1;
857    FBuffer^ := isc_bpb_version1;
858   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines