TUniLoader: how to set decimal separator

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

TUniLoader: how to set decimal separator

Post by martin.trummer » Wed 16 Jul 2014 08:07

I use TUniLoader to insert data into a MySQL database.
on a customer PC the insert fails with this error: "data truncated for column xxx"

the column is of type double and by looking at the executed sql statements I found out that the query uses a comma as decimal separator - but the database expects a dot.

how/where can I set the decimal separator that TUniLoader will use?

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: TUniLoader: how to set decimal separator

Post by PavloP » Wed 16 Jul 2014 15:10

We can't reproduce the problem. Please try to compose a small sample to demonstrate the problem and send it to pavelp*devart*com. In addition, specify the exact versions of UniDAC and Delphi you are using.

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

Re: TUniLoader: how to set decimal separator

Post by martin.trummer » Wed 16 Jul 2014 15:13

The problem occurs only one one customer PC.
In the meanwhile I have changed the regional settings of that PC to English and now it works (was German before).

but this is NOT an acceptable solution for the customer - so I need another way to specify the decimal separator.
it seems that the TUniLoader uses the value from the system's regional settings. But this is not a good idea, because actually it must use the separator that the database server expects.

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: TUniLoader: how to set decimal separator

Post by PavloP » Thu 17 Jul 2014 13:15

Not at all, we replace regional decimal separator in SQL queries with a separator used by the server. Please provide your table structure and data loading code example for problem investigation.

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

Re: TUniLoader: how to set decimal separator

Post by martin.trummer » Mon 28 Jul 2014 15:56

I found the problem now.
in my program, the datatype of the column (for the TUniLoader) had not been set: default is ftString. Thus the float was converted to a string before sending to the database. this conversion uses the system settings.

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: TUniLoader: how to set decimal separator

Post by PavloP » Tue 29 Jul 2014 09:46

It is good to see that the problem has been solved.

Post Reply