How to find out what are valid RESTRICTIONS for MetaData

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
gman
Posts: 10
Joined: Tue 13 Sep 2011 14:36

How to find out what are valid RESTRICTIONS for MetaData

Post by gman » Sun 18 Sep 2011 03:08

New user here....
Looking at UniDAC for multiple DBs....
Am playing with the UniMetaData component.
I understand the concept of putting in the proper restriction to get a list of metadata attributes.... How do I find out what restrictions are valid?

For example, if I am looking at Constraints, what are valid RESTRICTIONS? What about for TABLES, etc.

For example...
OraMetaData1.MetaDataKind := 'Tables';
OraMetaData1.Restrictions.Values['TABLE_SCHEMA'] := '"schemaname"';
OraMetaData1.Open;

How do I list all possible options instead of 'TABLE_SCHEMA'?

Thanks
GS

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 19 Sep 2011 13:13

Hello,

To get all the possible values of the Restrictions in UniDAC, you may use the following code:

Code: Select all

var
  lstMetaDataKinds, lstRestrictions: TStringList;
  i, j: integer;
begin
  lstMetaDataKinds:= TStringList.Create;
  lstRestrictions := TStringList.Create;
  try
    UniMetaData1.GetMetaDataKinds(lstMetaDataKinds);
    for i := 0 to lstMetaDataKinds.Count - 1 do
    begin
      UniMetaData1.GetRestrictions(lstRestrictions,lstMetaDataKinds);
      for j := 0 to lstRestrictions.Count - 1 do
        ShowMessage(Format('MetaDataKind : %s - Restriction : %s',[lstMetaDataKinds,lstRestrictions[j]]));
    end;
  finally
    lstRestrictions.Free;
    lstMetaDataKinds.Free;
  end;

gman
Posts: 10
Joined: Tue 13 Sep 2011 14:36

Minor Tweaks

Post by gman » Mon 19 Sep 2011 14:01

The code did need some minor changing....

Code: Select all

var
  lstMetaDataKinds, lstRestrictions: TStringList;
  i, j: integer;
begin
  lstMetaDataKinds:= TStringList.Create;
  lstRestrictions := TStringList.Create;
  try
    UniMetaData1.GetMetaDataKinds(lstMetaDataKinds);
    for i := 0 to lstMetaDataKinds.Count - 1 do
    begin
      UniMetaData1.GetRestrictions(lstRestrictions,lstMetaDataKinds.Strings[i]);
      for j := 0 to lstRestrictions.Count - 1 do
        Memo2.Lines.Add(Format('MetaDataKind : %s - Restriction : %s',[lstMetaDataKinds[i],lstRestrictions[j]]));
    end;
  finally
    lstRestrictions.Free;
    lstMetaDataKinds.Free;
  end;
end

Thanks!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 19 Sep 2011 14:21

Hello,

Yes, you are right, sorry for the misprint.

Post Reply