⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlmergxlib_tlb.pas

📁 如何自由访问局域网中的所有 SQL Server 服务器的数据
💻 PAS
📖 第 1 页 / 共 4 页
字号:
  begin
    FIntf := nil;
  end;
end;

function TAlternateSyncPartner.GetDefaultInterface: IAlternateSyncPartner;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TAlternateSyncPartner.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TAlternateSyncPartnerProperties.Create(Self);
{$ENDIF}
end;

destructor TAlternateSyncPartner.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TAlternateSyncPartner.GetServerProperties: TAlternateSyncPartnerProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function  TAlternateSyncPartner.Get_FriendlyName: WideString;
begin
  Result := DefaultInterface.FriendlyName;
end;

procedure TAlternateSyncPartner.Set_FriendlyName(const pVal: WideString);
  { Warning: The property FriendlyName has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.FriendlyName := pVal;
end;

function  TAlternateSyncPartner.Get_Distributor: WideString;
begin
  Result := DefaultInterface.Distributor;
end;

procedure TAlternateSyncPartner.Set_Distributor(const pVal: WideString);
  { Warning: The property Distributor has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.Distributor := pVal;
end;

function  TAlternateSyncPartner.Get_Publication: WideString;
begin
  Result := DefaultInterface.Publication;
end;

procedure TAlternateSyncPartner.Set_Publication(const pVal: WideString);
  { Warning: The property Publication has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.Publication := pVal;
end;

function  TAlternateSyncPartner.Get_PublisherDatabase: WideString;
begin
  Result := DefaultInterface.PublisherDatabase;
end;

procedure TAlternateSyncPartner.Set_PublisherDatabase(const pVal: WideString);
  { Warning: The property PublisherDatabase has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.PublisherDatabase := pVal;
end;

function  TAlternateSyncPartner.Get_Publisher: WideString;
begin
  Result := DefaultInterface.Publisher;
end;

procedure TAlternateSyncPartner.Set_Publisher(const pVal: WideString);
  { Warning: The property Publisher has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.Publisher := pVal;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TAlternateSyncPartnerProperties.Create(AServer: TAlternateSyncPartner);
begin
  inherited Create;
  FServer := AServer;
end;

function TAlternateSyncPartnerProperties.GetDefaultInterface: IAlternateSyncPartner;
begin
  Result := FServer.DefaultInterface;
end;

function  TAlternateSyncPartnerProperties.Get_FriendlyName: WideString;
begin
  Result := DefaultInterface.FriendlyName;
end;

procedure TAlternateSyncPartnerProperties.Set_FriendlyName(const pVal: WideString);
  { Warning: The property FriendlyName has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.FriendlyName := pVal;
end;

function  TAlternateSyncPartnerProperties.Get_Distributor: WideString;
begin
  Result := DefaultInterface.Distributor;
end;

procedure TAlternateSyncPartnerProperties.Set_Distributor(const pVal: WideString);
  { Warning: The property Distributor has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.Distributor := pVal;
end;

function  TAlternateSyncPartnerProperties.Get_Publication: WideString;
begin
  Result := DefaultInterface.Publication;
end;

procedure TAlternateSyncPartnerProperties.Set_Publication(const pVal: WideString);
  { Warning: The property Publication has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.Publication := pVal;
end;

function  TAlternateSyncPartnerProperties.Get_PublisherDatabase: WideString;
begin
  Result := DefaultInterface.PublisherDatabase;
end;

procedure TAlternateSyncPartnerProperties.Set_PublisherDatabase(const pVal: WideString);
  { Warning: The property PublisherDatabase has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.PublisherDatabase := pVal;
end;

function  TAlternateSyncPartnerProperties.Get_Publisher: WideString;
begin
  Result := DefaultInterface.Publisher;
end;

procedure TAlternateSyncPartnerProperties.Set_Publisher(const pVal: WideString);
  { Warning: The property Publisher has a setter and a getter whose
  types do not match. Delphi was unable to generate a property of
  this sort and so is using a Variant to set the property instead. }
var
  InterfaceVariant: OleVariant;
begin
  InterfaceVariant := DefaultInterface;
  InterfaceVariant.Publisher := pVal;
end;

{$ENDIF}

class function CoAlternateSyncPartners.Create: IAlternateSyncPartners;
begin
  Result := CreateComObject(CLASS_AlternateSyncPartners) as IAlternateSyncPartners;
end;

class function CoAlternateSyncPartners.CreateRemote(const MachineName: string): IAlternateSyncPartners;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_AlternateSyncPartners) as IAlternateSyncPartners;
end;

procedure TAlternateSyncPartners.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{0A984510-04A9-11D3-A8FB-00C04F9FC436}';
    IntfIID:   '{0A98450F-04A9-11D3-A8FB-00C04F9FC436}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TAlternateSyncPartners.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as IAlternateSyncPartners;
  end;
end;

procedure TAlternateSyncPartners.ConnectTo(svrIntf: IAlternateSyncPartners);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TAlternateSyncPartners.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TAlternateSyncPartners.GetDefaultInterface: IAlternateSyncPartners;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TAlternateSyncPartners.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TAlternateSyncPartnersProperties.Create(Self);
{$ENDIF}
end;

destructor TAlternateSyncPartners.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TAlternateSyncPartners.GetServerProperties: TAlternateSyncPartnersProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function  TAlternateSyncPartners.Get_Item(varIndex: OleVariant): IAlternateSyncPartner;
begin
  Result := DefaultInterface.Item[varIndex];
end;

function  TAlternateSyncPartners.Get_Count: Integer;
begin
  Result := DefaultInterface.Count;
end;

procedure TAlternateSyncPartners.Add(const pPartner: IAlternateSyncPartner);
begin
  DefaultInterface.Add(pPartner);
end;

procedure TAlternateSyncPartners.Clear;
begin
  DefaultInterface.Clear;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TAlternateSyncPartnersProperties.Create(AServer: TAlternateSyncPartners);
begin
  inherited Create;
  FServer := AServer;
end;

function TAlternateSyncPartnersProperties.GetDefaultInterface: IAlternateSyncPartners;
begin
  Result := FServer.DefaultInterface;
end;

function  TAlternateSyncPartnersProperties.Get_Item(varIndex: OleVariant): IAlternateSyncPartner;
begin
  Result := DefaultInterface.Item[varIndex];
end;

function  TAlternateSyncPartnersProperties.Get_Count: Integer;
begin
  Result := DefaultInterface.Count;
end;

{$ENDIF}

procedure Register;
begin
  RegisterComponents('ActiveX',[TSQLMerge]);
  RegisterComponents(dtlServerPage, [TAlternateSyncPartner, TAlternateSyncPartners]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -