Platform: Lazarus 1.8.1 (Fixed), FBC 3.0.5, Firebird Express for Lazarus 2.1.0, Windows Server Essentials 2016.
Goal: To make a small database management utility that can do the same tasks as gfix, gbak, gesc, but with a GUI interface.
Current problem: Unable to get TIBValidation Service to mend or validate.
I have looked at the IBX example for Services and I cannot get get mine to work the way the example does.
Here is the current status:
I have a TComboBox that allows the user to select the function they want to perform. Then I have two check boxes, one is "Include Checksums", the other checkbox is "Check only, do not fix". Finally, I have a TRadioGroup "Validation Scope" with two choices "Pages Only" or "Records and Pages". All of these are built by combining the options available in gfix and viewing the IBX example.
Here are the results:
Sweep: (works)
When I try to do a Mend or a Validate I get the error message:
[Debugger Exception Notification]
Project MyProject raised exception class 'EIBInterBaseError' with message:
bad parameters on attach or create database
secondary server attachments cannot validate databases
In file 'fbintf\client\FBClientAPI.pas' at line 254
[Ignore this exception type]
[Break] [Continue]
I have other IBX..x..Services in the same form and I thought they were causing the problem because they were currently .Active = True. So I set all their .Active := False; so there are
no other attachments to the database, except the TIBValidationService itself, yet, I still get the same error message. I see no difference between what I am doing and what is done in the example. I don't transfer the .ServiceIntf I just make each TIB..x..Service log in on it's own.
Next thing I need help with, is what options go together? You can see by my code snippet below that I am putting together options that I think are allowed. However, I could be wrong. Please have a look and correct where needed.
Thanks in advance for any help you can provide.
procedure TfrmDBStruct.IdxToValOpt(const fnc_idx: Integer; const chk_sums, chk_only: Boolean; const val_scope: Integer; var val_str: String; var val_opts: TValidateOptions);
begin
{Sweep
Kill Shadows
Mend
Validate}
case fnc_idx of
0:begin
val_opts := [SweepDB];
val_str := 'Sweep';
if chk_sums then
begin
val_str := val_str + ', Include Checksums';
end
else
begin
val_opts := val_opts + [IgnoreChecksum];
val_str := val_str + ', Ignore Checksums';
end;
end;
1:begin
val_opts := [KillShadows];
val_str := 'Kill Shadow Files';
end;
2:begin
val_opts := [MendDB];
val_str := 'Mend';
end;
3:begin
val_str := 'Validate';
if val_scope = 0 then
begin
val_opts := [ValidateDB];
val_str := val_str + ', (Pages only)';
end;
if val_scope = 1 then
begin
val_opts := [ValidateFull];
val_str := val_str + ', Full scope (Records and Pages)';
end;
if chk_sums then
begin
val_str := val_str + ', Include Checksums';
end
else
begin
val_opts := val_opts + [IgnoreChecksum];
val_str := val_str + ', Ignore Checksums';
end;
if chk_only then
begin
val_opts := val_opts + [CheckDB];
val_str := val_str + ', Check only (No fixes)';
end
else
begin
val_str := val_str + ', Check and Fix';
end;
end;
else
ShowMessage('Unknown Index for Validation Option');
end;
end;