BCS Delphi XE3 Retrieve Metadata


There are those occasions when metadata is required to facilitate successful completion of another assigned task.
The BCS Delphi XE3 Retrieve Metadata component relies on component BCS XE3 Get Alias, DSN, User Id and Password.  The source code for this component may be located at http://cc.embarcadero.com/Item/29412.
The driver program for the component identifies all the associated properties handled by this component.

unit BCSGenDEdp;
interface
uses
  Forms, System.SysUtils, System.Classes, BCSGenDEU, Windows;
type
  TBCSGenDECmp = class(TComponent)
  private
    { Private declarations }
    FPwd : String;
    FUsr : String;
    FDsn : String;
    FTab : String;
    FDbn : String;
    FCnt : Integer;
    Fmn : TStringList;
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
    function Execute : BooLean;
    property pwd : String read FPwd write FPwd;
    property usr : String read FUsr write FUsr;
    property dsn : String read FDsn write FDsn;
    property tab : String read FTab write FTab;
    property dbn : String read FDbn write FDbn;
    property mcnt : Integer read FCnt write FCnt;
    property mna : TStringList read Fmn write Fmn;
  end;
procedure Register;
implementation
function TBCSGenDECmp.Execute : Boolean;
begin
  result := false;
  fmn := TStringList.Create;
  Application.CreateForm(TBCSGenDEC, BCSGenDEC);
  if BCSGenDEC.ShowModal = id_OK then
  begin
    result := true;
    pwd := BCSGenDEC.BCSAiliasCmp1.pwd;
    usr := BCSGenDEC.BCSAiliasCmp1.usr;
    dsn := BCSGenDEC.BCSAiliasCmp1.dsn;
    tab := BCSGenDEC.BCSAiliasCmp1.tab;
    dbn := BCSGenDEC.ADOConnection1.DefaultDatabase;
    fmn.Assign(BCSGenDEC.ListBox1.Items);
    mcnt := BCSGenDEC.ListBox1.Items.Count;
  end;
  BCSGenDEC.Free;
end;
procedure Register;
begin
  RegisterComponents('AB Comps', [TBCSGenDECmp]);
end;
end.

In the driver program description it is easy to determine which properties are populated by the component BCSAiliasCmp1.
The other properties are initialized by the host component.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *