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 314 by tony, Sat Jul 18 10:26:30 2020 UTC vs.
Revision 315 by tony, Thu Feb 25 11:56:36 2021 UTC

# Line 73 | Line 73 | type
73      function Add(ParamType: byte): PParamBlockItemData;
74      function Find(ParamType: byte): PParamBlockItemData;
75      function GetItems(index: integer): PParamBlockItemData;
76 +    function LookupItemType(ParamTypeName: AnsiString): byte; virtual;
77    public
78      constructor Create(api: TFBClientAPI);
79      destructor Destroy; override;
# Line 101 | Line 102 | type
102    public
103       function getAsInteger: integer;
104       function getParamType: byte;
105 +     function getParamTypeName: AnsiString; virtual;
106       function getAsString: AnsiString;
107       function getAsByte: byte;
108       procedure addByte(aValue: byte);
# Line 118 | Line 120 | type
120       procedure SetAsString0(aValue: AnsiString);
121    end;
122  
121  { TDPBItem }
122
123  TDPBItem = class(TParamBlockItem,IDPBItem);
124
125  { TTPBItem }
126
127  TTPBItem = class(TParamBlockItem,ITPBItem);
128
129  { TSPBItem }
130
131  TSPBItem = class(TParamBlockItem,ISPBItem);
132
123    { TSRBItem }
124  
125    TSRBItem = class(TParamBlockItem,ISRBItem)
# Line 189 | Line 179 | type
179   {$ENDIF}
180    public
181      function Add(ParamType: byte): _IItem;
182 +    function AddByTypeName(ParamTypeName: AnsiString): _IItem;
183      function Find(ParamType: byte): _IItem;
184      function GetItems(index: integer): _IItem;
185    end;
186  
196  { TDPB }
197
198  TDPB = class (TCustomParamBlock<TDPBItem,IDPBItem>, IDPB)
199  public
200    constructor Create(api: TFBClientAPI);
201  end;
202
203  { TTPB }
204
205  TTPB = class (TCustomParamBlock<TTPBItem,ITPBItem>, ITPB)
206  public
207    constructor Create(api: TFBClientAPI);
208  end;
209
210  { TSPB }
211
212  TSPB = class (TCustomParamBlock<TSPBItem,ISPBItem>, ISPB)
213  public
214   constructor Create(api: TFBClientAPI);
215  end;
216
187    { TSRB }
188  
189    TSRB = class (TCustomParamBlock<TSRBItem,ISRBItem>, ISRB);
# Line 335 | Line 305 | begin
305    Result := byte(FParamData^.FBufPtr^);
306   end;
307  
308 + function TParamBlockItem.getParamTypeName: AnsiString;
309 + begin
310 +  Result := '';
311 + end;
312 +
313   function TParamBlockItem.getAsString: AnsiString;
314   var len: byte;
315   begin
# Line 364 | Line 339 | begin
339      end;
340    dtString0:
341        Result := strpas(PAnsiChar(FBufPtr+1));
342 <    else
343 <      IBError(ibxeOutputBlockTypeError,[nil]);
342 >  dtNone:
343 >      Result := '';
344 >  else
345 >    IBError(ibxeOutputBlockTypeError,[nil]);
346    end;
347   end;
348  
# Line 683 | Line 660 | end;
660  
661   function TParamBlock.getDataLength: integer;
662   begin
663 <  Result :=  FDataLength
663 >  Result :=  FDataLength;
664   end;
665  
666   function TParamBlock.AvailableBufferSpace: integer;
# Line 724 | Line 701 | begin
701     IBError(ibxePBIndexError,[index]);
702   end;
703  
704 + function TParamBlock.LookupItemType(ParamTypeName: AnsiString): byte;
705 + begin
706 +  IBError(ibxeNotSupported,[]);
707 + end;
708 +
709   function TParamBlock.getCount: integer;
710   begin
711    Result := Length(FItems);
# Line 753 | Line 735 | end;
735   procedure TParamBlock.PrintBuf;
736   var i: integer;
737   begin
738 <  write(ClassName,': ');
738 >  write(ClassName,': (',getDataLength,') ');
739    for i := 0 to getDataLength - 1 do
740      write(Format('%x ',[byte(FBuffer[i])]));
741    writeln
# Line 761 | Line 743 | end;
743  
744   { TCustomParamBlock }
745  
746 + function TCustomParamBlock<_TItem, _IItem>.AddByTypeName(ParamTypeName: AnsiString
747 +  ): _IItem;
748 + var ParamType: byte;
749 + begin
750 +  ParamType := LookupItemType(ParamTypeName);
751 +  if ParamType = 0 then
752 +    IBError(ibxeUnknownParamTypeName,[ClassName,ParamTypeName]);
753 +  Result := Add(ParamType);
754 + end;
755 +
756   {$IFDEF FPC}
757   function TCustomParamBlock<_TItem, _IItem>.Add(ParamType: byte): _IItem;
758   var Item: PParamBlockItemData;
# Line 784 | Line 776 | begin
776    Item := inherited getItems(index);
777    Result := _TItem.Create(self,Item);
778   end;
779 +
780   {$ELSE}
781   function TCustomParamBlock<_TItem, _IItem>.Add(ParamType: byte): _IItem;
782   var Item: PParamBlockItemData;
# Line 820 | Line 813 | begin
813   end;
814   {$ENDIF}
815  
823 { TDPB }
824
825 constructor TDPB.Create(api: TFBClientAPI);
826 begin
827  inherited Create(api);
828  FDataLength := 1;
829  FBuffer^ := isc_dpb_version1;
830 end;
831
832 { TTPB }
833
834 constructor TTPB.Create(api: TFBClientAPI);
835 begin
836  inherited Create(api);
837  FDataLength := 1;
838  FBuffer^ := isc_tpb_version3;
839 end;
840
841 { TSPB }
842
843 constructor TSPB.Create(api: TFBClientAPI);
844 begin
845  inherited Create(api);
846  FDataLength := 2;
847  FBuffer^ := isc_spb_version;
848  (FBuffer+1)^ := isc_spb_current_version;
849 end;
850
816   { TBPB }
817  
818   constructor TBPB.Create(api: TFBClientAPI);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines