Using TUniMetadata to get field names and types

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JensFudge
Posts: 55
Joined: Mon 12 Jan 2009 08:37

Using TUniMetadata to get field names and types

Post by JensFudge » Wed 14 Jan 2009 10:44

Hi,

I want to get the fieldnames and datatypes from a table using the TUniMetaData component.
The datatypes are apparently stored as an integer.
Where can I see what the integervalue corresponds to?
I have for example got datatypes 7, 8 and 27 in a specific table..

Is there some built-in way to get the names in stead?
For example:
Smallint, Integer, double..

Thanks for your help

Regards
Jens Fudge

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 15 Jan 2009 08:51

Please specify the provider that you are using: Oracle, InterBase, etc.

JensFudge
Posts: 55
Joined: Mon 12 Jan 2009 08:37

Post by JensFudge » Thu 15 Jan 2009 09:02

At the moment I am using Interbase provider on a Firebird database, but the reason for using UniDac components is, that we will be supporting Oracle, MS-SQL, MySQL and Firebird...
So, if it could be generic, that would be great.
Thanks

/Jens Fudge

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 16 Jan 2009 11:59

We will investigate possibility to support data type names in the TUniMetaData component, but that is hardly to happen in the nearest future.

JensFudge
Posts: 55
Joined: Mon 12 Jan 2009 08:37

Post by JensFudge » Fri 16 Jan 2009 12:15

For which I will eagerly await.
In the meantime, do you have any documentation of which datatypes get which numbers?
Do they differ depending on the provider?
I know that 27 for interbase is double :) But I would like it if you could point me to a map or something, I can easily implement a map with a TDictionary or something..
But I don't know the values.

/Jens

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 19 Jan 2009 08:55

Unfortunately the meaning of the DATA_TYPE field differs depending on the provider. In the Oracle provider there are already string data type names.
For the InterBase provider you can get corresponding data type names using the following query:

Code: Select all

SELECT * FROM RDB$TYPES
WHERE RDB$FIELD_NAME = 'RDB$FIELD_TYPE'

Post Reply