Bug #14847 SUM function doesn't work using MYOBDC 3.51.12
Submitted: 10 Nov 2005 18:47 Modified: 10 Nov 2005 21:53
Reporter: Gerson Alvarez Email Updates:
Status: Duplicate Impact on me:
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.0.15 OS:W2000 SP4
Assigned to: CPU Architecture:Any

[10 Nov 2005 18:47] Gerson Alvarez
When i try to execute a query wich contains agrgate function SUM it crashes, it occurs using ADO / VB with MYODBC.
A few time before some people have reported this bug as bug #10527, but mysql said that it would be solved on MYODBC release 3.51.12. I waited patiently the day it was released an installed it, but, the preoblem persists, what can i do?

How to repeat:
1. Create a test table and populate it 

mysql> use test;
mysql> create table T_Prueba ( PruebaID INT AUTO_INCREMENT, data INT, CONSTRAINT
PK_T_Prueba PRIMARY KEY (PruebaID));
mysql> INSERT INTO T_Prueba (data) VALUES (100); 
mysql> INSERT INTO T_Prueba (data) VALUES (120);
mysql> INSERT INTO T_Prueba (data) VALUES (180);

2. Check the query works
mysql> SELECT SUM(data) FROM T_Prueba;
Query OK, returns 400.

3. Create a VB6.0 (SP6) Proyect and add a reference to Microsoft ActiveX Data
Objects 2.8 Library

4. Put this code into Proyect

Option Explicit

Private Sub Form_Load()
    Dim oCn As New ADODB.Connection
    Dim oRs As New ADODB.Recordset
    Dim strSQL As String
    oCn.ConnectionString = "DRIVER={MySQL ODBC 3.51
    strSQL = "SELECT SUM(data) FROM t_Prueba"
    oRs.CursorLocation = adUseClient
    oRs.Open strSQL, oCn, adOpenForwardOnly, adLockReadOnly
    MsgBox oRs.Fields(0)
    Set oRs = Nothing
    Set oCn = Nothing
End Sub

5. Run the program and watch it crash: "Multiple-step operation generated
errors. check each status value"

It does work if you just use 'SELECT data FROM T_Prueba' instead of using SUM.
[10 Nov 2005 21:53] Miguel Solorzano
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

Duplicate of bug:


Please wait until the above bug report it is in closed status
which means the fix will be introduced in the next release.