Page 1 of 1
integer trimming bug
Posted: Sun 20 Aug 2006 12:10
by ben
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
Posted: Sun 20 Aug 2006 12:12
by ben
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.
Posted: Mon 21 Aug 2006 10:17
by Antaeus
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
Posted: Mon 21 Aug 2006 12:26
by ben
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!
Posted: Tue 22 Aug 2006 13:20
by Antaeus
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
Posted: Tue 22 Aug 2006 14:31
by ben
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.
Posted: Wed 23 Aug 2006 12:48
by Antaeus
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.
Posted: Thu 24 Aug 2006 08:04
by ben
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.
Posted: Mon 28 Aug 2006 12:08
by Ikar
We have managed to avoid the bug till it will be fixed in the server. The build will be available this week.
Posted: Mon 28 Aug 2006 20:00
by ben
at last a good new.
thanks!