Retrieving properties of tables and views

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Andrea Raimondi
Posts: 4
Joined: Sat 20 Apr 2019 13:52

Retrieving properties of tables and views

Post by Andrea Raimondi » Sat 20 Apr 2019 13:56

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!

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Retrieving properties of tables and views

Post by Stellar » Thu 25 Apr 2019 12:43

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;

Post Reply