| Bug #12285 | incorrect result type when using aggregate functions like count... | ||
|---|---|---|---|
| Submitted: | 30 Jul 2005 12:37 | Modified: | 31 Jul 2005 5:51 |
| Reporter: | Antonin Blatny | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / ODBC | Severity: | S1 (Critical) |
| Version: | MySQL 5.0.6-10, MyODBC 3.51.11 | OS: | Windows (Windows XP, 2000) |
| Assigned to: | CPU Architecture: | Any | |
[31 Jul 2005 5:51]
Vasily Kishkin
I was not able to reproduce the bug. I created test case and query returned SQL_BIGINT. Connect.... Test.... ColName = POCET,bColName = 5,SqlType = -5,ColDef = 19,Scale = 0,Nullable = 0 Disconnect.... I guess VFP7 can't convert the value right. My test case is attached.
[31 Jul 2005 5:51]
Vasily Kishkin
Test case of ODBC
Attachment: test.c (text/plain), 3.98 KiB.
[1 Aug 2005 18:27]
Antonin Blatny
And what about SUM? In myODBC manager is a checkbox 'Change BIGINT columns to int'. If this checkbox is checked, the result of COUNT is correct in VFP. If it is unchecked, the result is in incorrect type. I guess, count result is actually SQL_BIGINT. But result type of aggregate functions like SUM is probably SQL_NUMERIC. This type is maped as SQL_C_CHAR! (see MySQL reference manual - 25.1.17). Then in VFP this is translated to string instead of numeric type. Is it true?

Description: When the select statement which includes aggregate function is used (for example select count(*) as cn from users), it returns correct result, but with incorrect type. The query result type is returned as CHAR instead of NUMERIC (or other numeric type) This is tested on MySQL 5.0.6(9,10) with MyODBC 3.51.11 Klient program is Delphi5, VFP7 or VFP9 Windows XP, 2000 It seems, this bug is probably in MyODBC. How to repeat: in VFP7: a=SQLCONNECT() SQLEXEC(a,[use test]) ?SQLEXEC(a,[create TABLE pokus (id char(10), logicka bit)]) ?SQLEXEC(a,[insert into pokus (id,logicka) values ('a',1)]) ?SQLEXEC(a,[insert into pokus (id,logicka) values ('b',0)]) ?SQLEXEC(a,[select count(*) as pocet from pokus]) ?TYPE([pocet]) last function returns 'C' instead of 'N' Suggested fix: N/A