78 |
|
type |
79 |
|
{ TFBServiceManager } |
80 |
|
|
81 |
+ |
{ TFB25ServiceManager } |
82 |
+ |
|
83 |
|
TFB25ServiceManager = class(TFBServiceManager,IServiceManager) |
84 |
|
private |
85 |
|
FHandle: TISC_SVC_HANDLE; |
94 |
|
{IServiceManager} |
95 |
|
procedure Detach(Force: boolean=false); override; |
96 |
|
function IsAttached: boolean; |
97 |
< |
procedure Start(Request: ISRB); |
98 |
< |
function Query(SQPB: ISQPB; Request: ISRB): IServiceQueryResults; override; |
97 |
> |
function Start(Request: ISRB; RaiseExceptionOnError: boolean=true): boolean; |
98 |
> |
function Query(SQPB: ISQPB; Request: ISRB; RaiseExceptionOnError: boolean=true): IServiceQueryResults; override; |
99 |
|
end; |
100 |
|
|
101 |
|
implementation |
155 |
|
Result := FHandle <> nil; |
156 |
|
end; |
157 |
|
|
158 |
< |
procedure TFB25ServiceManager.Start(Request: ISRB); |
158 |
> |
function TFB25ServiceManager.Start(Request: ISRB; RaiseExceptionOnError: boolean |
159 |
> |
): boolean; |
160 |
|
begin |
161 |
+ |
Result := true; |
162 |
|
CheckActive; |
163 |
|
with Firebird25ClientAPI do |
164 |
< |
if isc_service_start(StatusVector, @FHandle, nil, |
164 |
> |
begin |
165 |
> |
Result := isc_service_start(StatusVector, @FHandle, nil, |
166 |
|
(Request as TSRB).getDataLength, |
167 |
< |
(Request as TSRB).getBuffer) > 0 then |
168 |
< |
IBDataBaseError; |
167 |
> |
(Request as TSRB).getBuffer) = 0; |
168 |
> |
if not Result and RaiseExceptionOnError then |
169 |
> |
IBDataBaseError; |
170 |
> |
end; |
171 |
|
end; |
172 |
|
|
173 |
< |
function TFB25ServiceManager.Query(SQPB: ISQPB; Request: ISRB |
174 |
< |
): IServiceQueryResults; |
173 |
> |
function TFB25ServiceManager.Query(SQPB: ISQPB; Request: ISRB; |
174 |
> |
RaiseExceptionOnError: boolean): IServiceQueryResults; |
175 |
|
var QueryResults: TServiceQueryResults; |
176 |
|
begin |
177 |
|
CheckActive; |
185 |
|
(Request as TSRB).getBuffer, |
186 |
|
QueryResults.getBufSize, |
187 |
|
QueryResults.Buffer) > 0 then |
188 |
< |
IBDataBaseError; |
188 |
> |
begin |
189 |
> |
if RaiseExceptionOnError then |
190 |
> |
IBDataBaseError |
191 |
> |
else |
192 |
> |
Result := nil; |
193 |
> |
end; |
194 |
|
end |
195 |
|
else |
196 |
|
if isc_service_query(StatusVector, @FHandle, nil, |
200 |
|
(Request as TSRB).getBuffer, |
201 |
|
QueryResults.getBufSize, |
202 |
|
QueryResults.Buffer) > 0 then |
203 |
< |
IBDataBaseError; |
204 |
< |
|
203 |
> |
begin |
204 |
> |
if RaiseExceptionOnError then |
205 |
> |
IBDataBaseError |
206 |
> |
else |
207 |
> |
Result := nil; |
208 |
> |
end; |
209 |
|
end; |
210 |
|
|
211 |
|
end. |