ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/client/FBServices.pas
(Generate patch)
# Line 74 | Line 74
74      function Query(Request: ISRB; RaiseExceptionOnError: boolean=true): IServiceQueryResults;  overload;
75    end;
76  
77 + { TSPBItem }
78 +
79 +  TSPBItem = class(TParamBlockItem,ISPBItem)
80 +  public
81 +   function getParamTypeName: AnsiString; override;
82 +   class function LookupParamTypeName(ParamType: byte): AnsiString;
83 +  end;
84 +
85 + { TSPB }
86 +
87 +  TSPB = class (TCustomParamBlock<TSPBItem,ISPBItem>, ISPB)
88 +  protected
89 +   function LookupItemType(ParamTypeName: AnsiString): byte; override;
90 +  public
91 +   constructor Create(api: TFBClientAPI);
92 +   function GetDPBParamTypeName(ParamType: byte): Ansistring;
93 +  end;
94 +
95   implementation
96  
97   uses FBMessages, IBUtils;
98  
99 + const
100 +  SPBPrefix = 'isc_spb_';
101 +  isc_spb_last_spb_constant = 13;
102 +  SPBConstantNames: array[1..isc_spb_last_spb_constant] of String = (
103 +    'user_name',
104 +    'sys_user_name',
105 +    'sys_user_name_enc',
106 +    'password',
107 +    'password_enc',
108 +    'command_line',
109 +    'db_name',
110 +    'verbose',
111 +    'options',
112 +    'connect_timeout',
113 +    'dummy_packet_interval',
114 +    'sql_role_name',
115 +    'expected_db'
116 +  );
117 +
118 +  SPBConstantValues: array[1..isc_spb_last_spb_constant] of Integer = (
119 +    isc_spb_user_name,
120 +    isc_spb_sys_user_name,
121 +    isc_spb_sys_user_name_enc,
122 +    isc_spb_password,
123 +    isc_spb_password_enc,
124 +    isc_spb_command_line,
125 +    isc_spb_dbname,
126 +    isc_spb_verbose,
127 +    isc_spb_options,
128 +    isc_spb_connect_timeout,
129 +    isc_spb_dummy_packet_interval,
130 +    isc_spb_sql_role_name,
131 +    isc_spb_expected_db
132 +  );
133 +
134 + { TSPBItem }
135 +
136 + function TSPBItem.getParamTypeName: AnsiString;
137 + begin
138 +    Result := LookupParamTypeName(getParamType);
139 + end;
140 +
141 + class function TSPBItem.LookupParamTypeName(ParamType: byte): AnsiString;
142 + var i: integer;
143 + begin
144 +  Result := '';
145 +  for i := 1 to isc_spb_last_spb_constant do
146 +    if SPBConstantValues [i] = ParamType then
147 +    begin
148 +      Result := SPBConstantNames[i];
149 +      break;
150 +    end;
151 + end;
152 +
153   { TFBServiceManager }
154  
155   procedure TFBServiceManager.CheckServerName;
# Line 152 | Line 224
224     Result := Query(nil,Request,RaiseExceptionOnError);
225   end;
226  
227 + { TSPB }
228 +
229 + function TSPB.LookupItemType(ParamTypeName: AnsiString): byte;
230 + var i: integer;
231 + begin
232 +  Result := 0;
233 +  ParamTypeName := LowerCase(ParamTypeName);
234 +  if Pos(SPBPrefix,ParamTypeName) = 1 then
235 +    system.Delete(ParamTypeName,1,Length(SPBPrefix));
236 +  for i := 1 to isc_spb_last_spb_constant do
237 +    if SPBConstantNames [i] = ParamTypeName then
238 +    begin
239 +      Result := SPBConstantValues[i];
240 +      break;
241 +    end;
242 + end;
243 +
244 + constructor TSPB.Create(api: TFBClientAPI);
245 + begin
246 +  inherited Create(api);
247 +  FDataLength := 2;
248 +  FBuffer^ := isc_spb_version;
249 +  (FBuffer+1)^ := isc_spb_current_version;
250 + end;
251 +
252 + function TSPB.GetDPBParamTypeName(ParamType: byte): Ansistring;
253 + begin
254 +  Result := TSPBItem.LookupParamTypeName(ParamType);
255 + end;
256 +
257   end.
258  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines