unit UIBConfigService;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IBServices;
type
TFIBConfigService = class(TForm)
IBConfigService1: TIBConfigService;
Button1: TButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
CheckBox4: TCheckBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FIBConfigService: TFIBConfigService;
implementation
{$R *.dfm}
procedure TFIBConfigService.Button1Click(Sender: TObject);
var
destSQL,destInterval,result:Integer;
begin
//检验SQL方言是否为整数
Val( Edit1.Text,destSQL,result);
if (result<>0) or( (destSQL<>1) and (destSQL<>3)) then
begin
ShowMessage('SQL方言必须为1或3,请重新输入!');
exit;
end;
//检验SQL方言的有效性
Val( Edit2.Text,destInterval,result);
if result<>0 then
begin
ShowMessage('扫描间隔必须为整数,请重新输入!');
exit;
end;
with IBConfigService1 do
begin
ServerName := 'Employee';
LoginPrompt := False;
//根据实际情况设置数据库的名称
DatabaseName := 'G:/malin/employee.gdb';
Params.Add('user_name=sysdba');
Params.Add('password=masterkey');
Active := True;
try
//使应用程序可以对数据库的属性进行修改
SetReadOnly(False);
//调用Sleep以确保在进行下一项服务之前,上一项服务已经完成
//确定是否激活映象
while IsServiceRunning do Sleep(5);
if CheckBox1.Checked then
ActivateShadow;
//确认是否将设置数据库写模式为异步模式
while IsServiceRunning do Sleep(5);
if CheckBox2.Checked then
SetAsyncMode(True);
while IsServiceRunning do Sleep(5);
if CheckBox3.Checked then
SetReserveSpace(True);
while IsServiceRunning do Sleep(5);
SetDBSqlDialect(destSQL);
while IsServiceRunning do Sleep(5);
SetSweepInterval(destInterval);
//确认是否将数据库设置为只读
while IsServiceRunning do Sleep(5);
if CheckBox4.Checked then
SetReadonly(True);
finally
Active := False;//关闭数据库
end;
end;
end;
end.
数据库设置
最新推荐文章于 2024-12-16 11:52:30 发布
本文介绍了一个使用Delphi实现的InterBase数据库配置服务界面程序。该程序允许用户配置数据库属性,如SQL方言、扫描间隔等,并能启用或禁用如影子激活、异步模式等功能。
573

被折叠的 条评论
为什么被折叠?



