TUniMetaData: MySql - precision of DateTime

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
martin.trummer
Posts: 19
Joined: Mon 12 May 2014 14:16

TUniMetaData: MySql - precision of DateTime

Post by martin.trummer » Fri 24 Oct 2014 15:59

when I use TUniMetaData to read the metadata of a MySQL table, I have a problem with DateTime fields. The precision is not correct - it is always 0.

i.e. when you create this table:

Code: Select all

CREATE TABLE `Test` 
(
`Id` datetime(3) NOT NULL 
)
I'd expect that TUniMetaData returns 3 for the Precision of the Id field, but it returns 0.

Is this a bug? Does anyone know a simple workaround?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TUniMetaData: MySql - precision of DateTime

Post by ViktorV » Tue 28 Oct 2014 10:17

UniDAC doesn't support retrieving of datetime precision for the new MySQL server versions. We will investigate the possibility of adding this functionality in the future.
As soon as we solve this question we will let you know.

martin.trummer
Posts: 19
Joined: Mon 12 May 2014 14:16

Re: TUniMetaData: MySql - precision of DateTime

Post by martin.trummer » Mon 03 Nov 2014 14:13

workaround is to read the required data directly from the database info schema with a TUniQuery. e.g.

Code: Select all

select TABLE_NAME
 , COLUMN_NAME
 , DATA_TYPE
 , IF(DATA_TYPE = 'datetime', DATETIME_PRECISION, NUMERIC_PRECISION) as DATA_PRECISION 
 , NUMERIC_SCALE as DATA_SCALE
 , IS_NULLABLE as NULLABLE
from INFORMATION_SCHEMA.COLUMNS
#where TABLE_SCHEMA = 'xxx'
# and TABLE_NAME = 'xxx'
order by TABLE_NAME, ORDINAL_POSITION;

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TUniMetaData: MySql - precision of DateTime

Post by ViktorV » Tue 04 Nov 2014 08:39

Thank you for the information and the provided solution. We will add this functionality in one of the next builds.

Post Reply