integer trimming bug

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

integer trimming bug

Post by ben » Sun 20 Aug 2006 12:10

hello,

select discount FROM members

works fine and displays

0
20
0
0
20

but

select concat(discount) FROM members shows


2


2

the last 0 is trimmed. why? it works fine with MySQL I tested in Navicat and command prompt (pure mysql.exe).

Thanks

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Sun 20 Aug 2006 12:12

problem occurs in UTF8 and UseUnicode = true
If I set UseUnicode = false
I can see "20" instead of 2 but I cant see text :(

myslq 4.1.20

So, obviously is a bug.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 21 Aug 2006 10:17

We could not reproduce the problem.
Please send us (evgeniyD*crlab*com) a complete small sample to demonstrate it, including script to create and fill table.

Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Mon 21 Aug 2006 12:26

mail sent.

Delphi 7

and its obvious that I use the latest version 4.30.1.17

before reporting a bug we always try the latest version. At least, me!

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 22 Aug 2006 13:20

Thank you for sample. This is bug of CONCAT function of MySQL Server. The query you have provided returns wrong field length, so one char is trimmed. As we noticed this problem appears for TINYINT fields but not for INTEGER fields. Unfortunately there is no suitable way to avoid this MySQL server bug. All we can do is reporting about it to MySQL AB.
As temporary solutions we can suggest you:
1) to use
concat(discount, ' ')
instead of
concat(discount)
2) change field type from TINYINT to INT

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Tue 22 Aug 2006 14:31

I think you are wrong.
why? here's why

mysql> select concat(discount) from members limit 0,100;
+------------------+
| concat(discount) |
+------------------+
| 0 |
| 0 |
| 20 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |


mysql itself returns 20 not 2.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 23 Aug 2006 12:48

The same problem was discussed with you in this topic. As we told before:
Antaeus wrote:MyDAC allocates for data as much memory as MySQL server reports. This helps our components work quickly. But when Unicode is used, MySQL server returns wrong field length for the fields that are the result of conversion functions. For example, DATE_FORMAT.
This situation is similar. But CONCAT function returns wrong field length only in some cases.
So, we will try suggest an avoidance to this MySQL Server bug in the nearest future. To reproduce this bug you can try the native API.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Thu 24 Aug 2006 08:04

as long as MySQL itself (mysql.exe) and other softwares (such as Navicat) return the correct result in the same query that MyDAC fails - this is OBVIOUSLY a MyDAC BUG !!!

thank you for depreciating my intelligence.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 28 Aug 2006 12:08

We have managed to avoid the bug till it will be fixed in the server. The build will be available this week.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Mon 28 Aug 2006 20:00

at last a good new.

thanks!

Post Reply