Bug #10128 Error in evaluating simple mathematical expression
Submitted: 24 Apr 2005 16:28 Modified: 10 Jan 2008 9:25
Reporter: Nikos Sarris Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.1 OS:Windows (Win XP Pro SP2)
Assigned to: Jess Balint CPU Architecture:Any
Tags: SQL_NUMERIC_STRUCT

[24 Apr 2005 16:28] Nikos Sarris
Description:
Only for MySQL 5.0.4-beta

This simple select fails to open/execute through an ADO recordest and MyODBC in a VB6 App

"SELECT (12.4767-6)*1000/7.2659"

The above SQL returns the correct result in query browser (JDBC?)

How to repeat:
Try to open an ADO recordset connected to a MySQL 5.0.4-beta server through MyODBC with the following source SQL

"SELECT (12.4767-6)*1000/7.2659"

The data provider returns:

"Multiple-step operation generated errors. Check each status value."
[24 Apr 2005 18:20] Jorge del Conde
I was unable to reproduce this bug using 3.51.11-2 connecting to 5.0.3:

C:\my\mysql\bin>imyodbc mysql
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> SELECT (12.4767-6)*1000/7.2659;
+------------------------+
| (12.4767-6)*1000/7.2659|
+------------------------+
| 891.3830358248806      |
+------------------------+
SQLRowCount returns 1
1 rows fetched
SQL>
[24 Apr 2005 20:05] Nikos Sarris
This VB6 app displays the bug. It needs a System ODBC datasource named "MySQL"

Attachment: MySQL-Bug1.zip (application/x-zip-compressed, text), 1.37 KiB.

[24 Apr 2005 20:07] Nikos Sarris
The bug only appears when using the Microsoft OLEDB for ODBC provider along with ADO. I've attached a VB6 app that reproduces the error. I'll try VC6 as well when I get the time
[24 Apr 2005 20:21] Nikos Sarris
I've been trying to upload a VC6 app (500KB) that displays the bug but I can't for some reason.

The thing is the problem appears on any division even SELECT 1/2 causes it.
[24 Apr 2005 20:23] Nikos Sarris
The VC6 app (not by me, needs to be compiled). Connect through the ODBC driver and query "SELECT 1/2"

Attachment: ISQLADO_src.zip (application/x-zip-compressed, text), 97.32 KiB.

[16 Oct 2007 12:37] Susanne Ebrecht
Hi,

I can't repeat this bug with MyODBC 3.51.21 and MySQL 5.1.21.

Please, try again with newer version of MyODBC. We recommend to use MyODBC 3.51 or MyODBC 5.1.

Susanne
[17 Oct 2007 6:45] Georg Richter
Verified.

ODBC trace file snippet:

    9600-277c	EXIT  SQLBindCol  with return code -1 (SQL_ERROR)

		HSTMT               03FD1F78

		UWORD                        1 

		SWORD                        2 <SQL_C_NUMERIC>

		PTR                0x00000050

		SQLLEN                    19

		SQLLEN *            0x0000004C

		DIAG [07006] [MySQL][ODBC 5.1 Driver][mysqld-5.0.46-enterprise-nt]Restricted data type attribute violation(SQL_C_NUMERIC) (508)
[18 Oct 2007 10:40] Susanne Ebrecht
This is a duplicate of bug #3028
[29 Oct 2007 8:29] Susanne Ebrecht
re-open, because it is no duplicate
[2 Jan 2008 22:06] Jess Balint
fix + test

Attachment: x11.txt (text/plain), 1.80 KiB.

[2 Jan 2008 22:08] Jess Balint
changed test slightly

Attachment: x11.txt (text/plain), 1.74 KiB.

[3 Jan 2008 5:02] Jess Balint
Fix committed into svn r983, will be released in Connector/ODBC 5.1.2.
[10 Jan 2008 9:25] MC Brown
A note has been added to the 5.1.2 changelog: 

Evaluating a simple numeric expression when using the OLEDB for ODBC provider and ADO would return an error, instead of the result.