Bug #14502 aggregate function not working for int field
Submitted: 31 Oct 2005 7:37 Modified: 28 May 2013 13:01
Reporter: Fan Wai Fan Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.11 OS:Windows (window xp - sp1, mysql 5.0)
Assigned to: CPU Architecture:Any

[31 Oct 2005 7:37] Fan Wai Fan
Description:
aggregate function not working for int field when execute the sql statment through myodbc. The same statement works on mysql 4.x but not in mysql 5.0.

How to repeat:
create the following table

create table test (
      sdate date,
      field1 int
) engine = myisam;

put some data into the table,
execute the sql statement,
       rs.open "select sdate, sum(field1) from test group by sdate", cn, 3, 3

the opened recordset contain no result.

after I change the field type of field1 to float, the statement works as expected.

Suggested fix:
change the field type of field1 to float.
[31 Oct 2005 8:50] Vasily Kishkin
Sorry....I was not able to reproduce the bug. My test case works fine. COuld you please create and attach your test case for reproducing the bug ?
[31 Oct 2005 11:38] Fan Wai Fan
Step 1:

/**** database initialization **********/

create table test (
      sdate date,
      field1 int
) engine = myisam;
insert into test values ('2005/10/11',1);
insert into test values ('2005/10/11',2);
insert into test values ('2005/10/12',3);

/****************************************/

Step2:
Create a DSN named "test" connected to the database created in Step 1

Step3:
Execute the following code in VB

Public Sub test()
    Dim cn As Object
    Dim rs As Object
    
    Set cn = CreateObject("adodb.connection")
    Set rs = CreateObject("adodb.recordset")
    
    cn.Open "test"
    rs.Open "select sdate, sum(field1) from test group by sdate", cn, 3, 3
    Do While Not rs.EOF
        Debug.Print rs(1)
        rs.movenext
    Loop
    rs.Close
    cn.Close
End Sub

the code will not enter the DO While .... loop since rs.eof is true after execute the rs.open command
[31 Oct 2005 11:40] Fan Wai Fan
my setup:
MySQL version: 5.0.15
MyODBC version: 5.51.11
OS: WinXP sp1
[8 Nov 2005 9:47] Vasily Kishkin
I tested on 3.51.12. Your test case works fine:

11.10.2005 3
12.10.2005 3

Could you please upgrade your myodbc ? I guess the bug was fixed.
[9 Dec 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[28 May 2013 13:01] Bogdan Degtyariov
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/