Page 1 of 1

How to find out what are valid RESTRICTIONS for MetaData

Posted: Sun 18 Sep 2011 03:08
by gman
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

Posted: Mon 19 Sep 2011 13:13
by AlexP
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;

Minor Tweaks

Posted: Mon 19 Sep 2011 14:01
by gman
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!

Posted: Mon 19 Sep 2011 14:21
by AlexP
Hello,

Yes, you are right, sorry for the misprint.