integer trimming bug
integer trimming bug
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
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
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
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
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
As temporary solutions we can suggest you:
1) to use
concat(discount, ' ')
instead of
concat(discount)
2) change field type from TINYINT to INT
The same problem was discussed with you in this topic. As we told before:
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.
This situation is similar. But CONCAT function returns wrong field length only in some cases.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.
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.