Bug #26097 Only first aggregate function gets processed

Submitted: 5 Feb 2007 20:00 Modified: 2 Jan 2008 22:23
Reporter: Tonci Grgin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.01.02 OS:Windows (Win XP Pro (SP2))
Assigned to: Jess Balint CPU Architecture:Any
Tags: ODBC5-RC

[5 Feb 2007 20:00] Tonci Grgin
Description:
Only first aggregate function gets processed. This is side-effect of tests done for Bug#18157

How to repeat:
    Private Sub bnBug18157_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnBug18157.Click
        Dim p_conn As New ADODB.Connection
        'p_conn.Open("DSN=myodbc1") '("Provider=MSDASQL.1;Extended Properties=;SERVER=localhost;DRIVER=MySQL Connector/ODBC v5;OPTION=1+2+32;PWD=;DATABASE=test;UID=root") '16387
        'p_conn.Open("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;OPTION=3;PWD=;DATABASE=solusd;UID=root") '16387, 1+2+32
        p_conn.Open("DRIVER={MySQL Connector/ODBC v5};SERVER=localhost;OPTION=3;PWD=;DATABASE=solusd;UID=root") '16387, 1+2+32
        Dim p_cmd As New ADODB.Command
        Dim RowIDTxt1 As Integer

        Dim p_rs As New ADODB.Recordset

        p_rs.ActiveConnection = p_conn

        p_rs.LockType = LockTypeEnum.adLockOptimistic
        p_rs.CursorType = CursorTypeEnum.adOpenKeyset
        p_rs.CursorLocation = CursorLocationEnum.adUseClient

        p_rs.Open("SELECT SUM(KolVS) AS c, AVG(PC) AS d, COUNT(Artikl) AS e FROM dobra", p_conn, CursorTypeEnum.adOpenKeyset, LockTypeEnum.adLockOptimistic)
        'p_rs.Fields.Refresh()

        p_rs.MoveFirst()

        'RowIDTxt1 = 1
        RowIDTxt1 = p_rs(2).Value + 1 'RowIDTxt1 +
        MsgBox(RowIDTxt1)

        Dim oField As ADODB.Field
        Dim oStr As String
        oStr = ""
        Do Until p_rs.EOF
            For Each oField In p_rs.Fields
                oStr = oStr & (oField.Value) & ","
            Next
            MsgBox(oStr)
            oStr = ""
            p_rs.MoveNext()
        Loop

    End Sub

---

Interesting part in log is:
Bug25110.vshost 3554-804    EXIT  SQLGetInfoW  with return code -1 (SQL_ERROR)
        HDBC                041E1690
        UWORD                       16 <SQL_DATABASE_NAME>
        PTR                 0x00000000
        SWORD                        0
        SWORD *             0x03C4D91C

        DIAG [S1000] [MySQL][MyODBC 5.00.12] buffer, to return value, must be provided (0)

Suggested fix:
-
[5 Feb 2007 20:02] Tonci Grgin
Relevant logs

Attachment: Desktop.7z (application/octet-stream, text), 21.44 KiB.

[19 Dec 2007 12:57] Tonci Grgin
Bug still present in latest 5.1, works in 3.51.
[2 Jan 2008 22:23] Jess Balint
I tested with,
create table bug_26097 ( x int, y double );
insert into bug_26097 values (1,1),(2,2),(3,3),(4,4),(5,5);
SELECT SUM(x) AS c, AVG(y) AS d, COUNT(x) AS e FROM bug_26097

I received the expected 15,3,5, result.

Tonci - please test with your dobro table to make sure this is correct.
[3 Jan 2008 9:59] Tonci Grgin
I confirm c/ODBC 5.1.2 2007-12-18 works as expected having the same result as 3.51.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.061 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.