Bug #27881 MyODBC 5/ ADO Decimal data type (adNumeric) is missing decimal digits
Submitted: 17 Apr 2007 14:18 Modified: 22 Oct 2007 13:37
Reporter: Erica Moss Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.0.12 OS:Windows (XP sp 2)
Assigned to: Assigned Account CPU Architecture:Any

[17 Apr 2007 14:18] Erica Moss
Description:
Digits to the right of the radix that are stored in the server are not found in the fld.Value.  Although the fld.NumericScale property does properly indicate the number of decimal digits. 
This problem is not seen in MyODBC 3.51.14

How to repeat:
SETUP:
mysql> CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 DECIMAL(10));
mysql> INSERT INTO ado_test VALUES (1, 101.25), (2, 202.49);

VB code:
Private Sub Test()
    On Error GoTo EH
    Dim strSQL, strConn As String
    Dim connection1 As ADODB.Connection
    Dim recset1 As ADODB.Recordset
    Dim fld As Field
    Set connection1 = New ADODB.Connection
    Set recset1 = New ADODB.Recordset

    strSQL = "SELECT * FROM ado_test"
    strConn = "DRIVER={MySQL Connector/ODBC v5};" & _
            "SERVER=localhost;DATABASE=ado" & _
            ";UID=root;PWD=mypass;OPTION=3;"

    'open connection
    connection1.ConnectionString = strConn
    connection1.CursorLocation = adUseServer
    connection1.Open

    recset1.Open strSQL, connection1, adOpenForwardOnly, _
                 adLockOptimistic, adCmdText
             
    recset1.MoveFirst
    While Not recset1.EOF
       For Each fld In recset1.Fields
           If fld.Type = adNumeric Then
               Debug.Print fld.Value
               Debug.Print fld.NumericScale
           End If
       Next
       recset1.MoveNext
    Wend
    Exit Sub

EH:
    Debug.Print Err.Description & " " & Err.Number & vbNewLine

End Sub
[18 Apr 2007 20:00] Erica Moss
I messed up the table definition, should be...
mysql> CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 DECIMAL(10,2));
[22 Oct 2007 13:37] Susanne Ebrecht
I think, this is a duplicate of bug #3018.
[29 Oct 2007 8:38] Susanne Ebrecht
This is a duplicate of bug #10128