Bug #13005 Unable to fetch records when the table contains decimal columns
Submitted: 6 Sep 2005 9:44 Modified: 30 May 2013 7:33
Reporter: Sunil K Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version: OS:Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[6 Sep 2005 9:44] Sunil K
Description:
I am using VB Script(ASP) with ODBC.

Version Info is as follows.
MySql Server Version : 5.0.11
MyOdbc Ver : 3.51.11

When i tried to open a recordset for the table which contain decimal columns the resultset is not returned.

How to repeat:
create table temp (empno int, empno1 decimal(25,4));

insert into temp values (1, 123456789012345678901.1234);

insert into temp values (2, 123456789012345678901.1234);

ASP Code:
'File Name = test.asp
'--------------------
<%@ language=vbscript%>
<%

dim cn, rs
set cn = server.CreateObject("adodb.connection")

cn.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=xxxx;PORT=3306;DATABASE=xx;USER=xx;PASSWORD=xx;option=3"

set rs = cn.Execute("select empno, empno1 from temp")
Response.Write "BOF=" & rs.bof

do while not rs.eof
	Response.Write "Value=>" & rs(0).value & "<br>"
	rs.movenext
loop
cn.Close
%>
[6 Sep 2005 18:36] Jorge del Conde
I was able to reproduce this using Internet Services installed by XP Pro/SP2 & MyODBC  3.51.11-2
[30 Sep 2005 12:31] Klaus Keller
I was able to reproduce this using with ASP and Visual Basic.
With PHP and ASP.NET (on same OS): no eof!
Change the type to float or another: no eof!

MySQL 5.0.13, Windows 2000 SP4

Solution?
[25 Oct 2005 15:18] Peter Harvey
Please try c/odbc v3.51.12 as there are some fixs having to do with numeric types. Please report success/failure.
[28 Oct 2005 8:36] Tom Bruyneel
Hi, using MyODBC 3.51.12 i have the same error:

query = "SELECT IFNULL(OP, '0000-00-00') AS OP, OCHTEND, KAS FROM vp_fdc WHERE WID='" & wid & "' AND OP>='" & vanDat & "' AND OP<='" & totDat & "'"
        If Not requestDatabase(query, rsFDC, DATAONLINE) Then
            RaiseError 204, query & vbNewLine & Err.Description
        Else
            avondKas = 0#
            ochtendKas = 0#
    
            
            If Not rsFDC.EOF Then
                While Not rsFDC.EOF And rsFDC.Fields("OP") < Format(datumKassa.value, "yyyy-mm-dd 00:00:00")
                    If rsFDC.Fields("OCHTEND") = "nee" Then
                        avondKas = cDbl2(rsFDC.Fields("KAS"))
                    End If
                    rsFDC.MoveNext
                Wend

In the above code example the table KAS is decimal (5,2). As soon as i use it i get a BOF or EOF is true error from ado. However the strange thing is, the error will occure when testing the while condition. So the code will pass the if condition but not the while condition. Which means that after calling the eof property once (returning false) the EOF property will change to true.
[26 Nov 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".
[16 Jan 2006 15:48] Alex Kerschkamp
I ran into this as well using MySQL server 5.0.11 with ODBCConnector 3.51.10 for ASP web apps. There's no way to display any decimals. Using CAST, ROUND or math (((field.value*100)/100) for instance) didn't help. Upgrading the Connector to version 3.51.12 resolved the issue. However, since 3.51.12 has connection problems (in our case) that other apps suffer from we'd like to continue using an older driver untill a new version resolves these. Is there some way to patch the decimal issue?

Best regards,
- Alex.
[30 May 2013 7:33] 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/