Page 1 of 1

How to use UniMetadata

Posted: Thu 29 Jul 2021 19:44
by fgodecke
Hello,

I want a list of indexes from a certain table in MySQL.

What is wrong in this code?

IndexListBox.Clear;
UniMetaData1.Filter:=MyTablename;
UniMetaData1.MetaDataKind:='Indexes';
UniMetaData1.Open;
UniMetaData1.First;
While not UniMetaData1.Eof do
begin
IndexListBox.Items.add(UniMetaData1.FieldValues['COLUMN_NAME']);
UniMetaData1.Next;
end;

Re: How to use UniMetadata

Posted: Fri 30 Jul 2021 13:47
by ViktorV
Hi there,
In order to get the list of index names, you may use the following code:

Code: Select all

  IndexListBox.Clear;
  UniMetaData1.Restrictions.Values['TABLE_NAME'] := MyTablename;
  UniMetaData1.MetaDataKind:='Indexes';
  UniMetaData1.Open;
  UniMetaData1.First;
  While not UniMetaData1.Eof do begin
    IndexListBox.Items.add(UniMetaData1.FieldValues['INDEX_NAME']);
    UniMetaData1.Next;
  end;
In order to get the list of index columns, you may use the following code:

Code: Select all

  IndexListBox.Clear;
  UniMetaData1.Restrictions.Values['TABLE_NAME'] := MyTablename;
  UniMetaData1.MetaDataKind:='IndexColumns';
  UniMetaData1.Open;
  UniMetaData1.First;
  While not UniMetaData1.Eof do begin
    IndexListBox.Items.add(UniMetaData1.FieldValues['COLUMN_NAME']);
    UniMetaData1.Next;
  end;
You may also find more information about TUniMetaData component on our site:
https://www.devart.com/unidac/docs/Deva ... aData.htm

Regards,
Viktor

Re: How to use UniMetadata

Posted: Fri 30 Jul 2021 17:44
by fgodecke
Thank you, Victor.
It's works now.

Re: How to use UniMetadata

Posted: Tue 03 Aug 2021 16:18
by ViktorV
Hi there!

I’m glad that your issue is fully resolved now and you can use all the features of our product.
In case you will get any additional questions simply submit a new request or reply in this topic.

Regards,
Viktor