Page 1 of 1

Retrieving properties of tables and views

Posted: Sat 20 Apr 2019 13:56
by Andrea Raimondi
Hello!

UniDac allows me to get a list of tables and views like so:
SrcConnection.GetTableNames( FSourceNames );

Now I want to fill a list but differentiating between tables and views.
How do I get the properties of a single object?

Please note that the table component does not seem to have anything to distinguish between the two (I did check).

Thanks!

Re: Retrieving properties of tables and views

Posted: Thu 25 Apr 2019 12:43
by Stellar
Unfortunately, the GetTableNames method cannot return the View list. To get the metainfo of the database objects from the server, you can use the TUniMetaData component.
The following is an example of how you can get the View list:

Code: Select all

UniMetaData1.MetaDataKind := 'Tables';
UniMetaData1.Restrictions.Values['TABLE_TYPE']:= 'VIEW';
UniMetaData1.Open;

while not UniMetaData1.Eof do
begin
  Memo1.Lines.Add(UniMetaData1.FieldByName('TABLE_NAME').AsString);
  UniMetaData1.Next;
end;