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 GetParamTypeName(ParamType: byte): Ansistring; |
93 |
+ |
function ISPB.GetDPBParamTypeName = GetParamTypeName; |
94 |
+ |
end; |
95 |
+ |
|
96 |
|
implementation |
97 |
|
|
98 |
|
uses FBMessages, IBUtils; |
99 |
|
|
100 |
+ |
const |
101 |
+ |
SPBPrefix = 'isc_spb_'; |
102 |
+ |
isc_spb_last_spb_constant = 13; |
103 |
+ |
SPBConstantNames: array[1..isc_spb_last_spb_constant] of String = ( |
104 |
+ |
'user_name', |
105 |
+ |
'sys_user_name', |
106 |
+ |
'sys_user_name_enc', |
107 |
+ |
'password', |
108 |
+ |
'password_enc', |
109 |
+ |
'command_line', |
110 |
+ |
'db_name', |
111 |
+ |
'verbose', |
112 |
+ |
'options', |
113 |
+ |
'connect_timeout', |
114 |
+ |
'dummy_packet_interval', |
115 |
+ |
'sql_role_name', |
116 |
+ |
'expected_db' |
117 |
+ |
); |
118 |
+ |
|
119 |
+ |
SPBConstantValues: array[1..isc_spb_last_spb_constant] of Integer = ( |
120 |
+ |
isc_spb_user_name, |
121 |
+ |
isc_spb_sys_user_name, |
122 |
+ |
isc_spb_sys_user_name_enc, |
123 |
+ |
isc_spb_password, |
124 |
+ |
isc_spb_password_enc, |
125 |
+ |
isc_spb_command_line, |
126 |
+ |
isc_spb_dbname, |
127 |
+ |
isc_spb_verbose, |
128 |
+ |
isc_spb_options, |
129 |
+ |
isc_spb_connect_timeout, |
130 |
+ |
isc_spb_dummy_packet_interval, |
131 |
+ |
isc_spb_sql_role_name, |
132 |
+ |
isc_spb_expected_db |
133 |
+ |
); |
134 |
+ |
|
135 |
+ |
{ TSPBItem } |
136 |
+ |
|
137 |
+ |
function TSPBItem.getParamTypeName: AnsiString; |
138 |
+ |
begin |
139 |
+ |
Result := LookupParamTypeName(getParamType); |
140 |
+ |
end; |
141 |
+ |
|
142 |
+ |
class function TSPBItem.LookupParamTypeName(ParamType: byte): AnsiString; |
143 |
+ |
var i: integer; |
144 |
+ |
begin |
145 |
+ |
Result := ''; |
146 |
+ |
for i := 1 to isc_spb_last_spb_constant do |
147 |
+ |
if SPBConstantValues [i] = ParamType then |
148 |
+ |
begin |
149 |
+ |
Result := SPBConstantNames[i]; |
150 |
+ |
break; |
151 |
+ |
end; |
152 |
+ |
end; |
153 |
+ |
|
154 |
|
{ TFBServiceManager } |
155 |
|
|
156 |
|
procedure TFBServiceManager.CheckServerName; |
225 |
|
Result := Query(nil,Request,RaiseExceptionOnError); |
226 |
|
end; |
227 |
|
|
228 |
+ |
{ TSPB } |
229 |
+ |
|
230 |
+ |
function TSPB.LookupItemType(ParamTypeName: AnsiString): byte; |
231 |
+ |
var i: integer; |
232 |
+ |
begin |
233 |
+ |
Result := 0; |
234 |
+ |
ParamTypeName := LowerCase(ParamTypeName); |
235 |
+ |
if Pos(SPBPrefix,ParamTypeName) = 1 then |
236 |
+ |
system.Delete(ParamTypeName,1,Length(SPBPrefix)); |
237 |
+ |
for i := 1 to isc_spb_last_spb_constant do |
238 |
+ |
if SPBConstantNames [i] = ParamTypeName then |
239 |
+ |
begin |
240 |
+ |
Result := SPBConstantValues[i]; |
241 |
+ |
break; |
242 |
+ |
end; |
243 |
+ |
end; |
244 |
+ |
|
245 |
+ |
constructor TSPB.Create(api: TFBClientAPI); |
246 |
+ |
begin |
247 |
+ |
inherited Create(api); |
248 |
+ |
FDataLength := 2; |
249 |
+ |
FBuffer^ := isc_spb_version; |
250 |
+ |
(FBuffer+1)^ := isc_spb_current_version; |
251 |
+ |
end; |
252 |
+ |
|
253 |
+ |
function TSPB.GetParamTypeName(ParamType: byte): Ansistring; |
254 |
+ |
begin |
255 |
+ |
Result := TSPBItem.LookupParamTypeName(ParamType); |
256 |
+ |
end; |
257 |
+ |
|
258 |
|
end. |
259 |
|
|