Bug #31720 MyODBC 5.1 / ADO can't open a recordset that has a Decimal field

Submitted: 19 Oct 2007 16:21 Modified: 3 Dec 2007 7:24
Reporter: Erica Moss Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1.0 OS:Windows (xp sp 2)
Assigned to: Jess Balint CPU Architecture:Any
Tags: SQL_NUMERIC_STRUCT

[19 Oct 2007 16:21] Erica Moss
Description:
The following error is received when a record set containing two fields INT, and DECIMAL (10,2) is opened and rs.MoveFirst() is called.

Error: Source: Microsoft OLE DB Provider for ODBC Drivers  Line 78  Column 4
[MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt]Restricted data type attribute violation(SQL_C_NUMERIC)

A test case for this bug is found in /odbc-testing/ado-conformance/trunk/bugs/bug#.vbs

How to repeat:
Sub Test()	
    Dim strSQL, strConn, oConn, oRs, fld

    Set oConn = CreateObject("ADODB.Connection")
    Set oRs = CreateObject("ADODB.RecordSet")
    strSQL = "select * from test.26110"

    oConn.ConnectionString = connstr
	
    oConn.CursorLocation = CInt(adUseClient)
    oConn.Open
	
    Err.Clear
    oRs.Open strSQL, oConn, adOpenStatic
    If Err.Number <> 0 Then
	Assert.Failure "failed to open record set"
    End If
    oRs.MoveFirst    <------ FAILS HERE

    ' VERIFY
    For Each fld In oRs.Fields
	assert.Trace fld.Name & ":" & fld.Value
    Next

    oConn.Close
    oRs.Close
    Set oConn = Nothing
    Set oRs = Nothing
End Sub
[22 Oct 2007 11:08] Susanne Ebrecht
This is a duplicate of bug #3028
[21 Nov 2007 0:49] Jess Balint
problem:

ScriptUnit      350-450	EXIT  SQLSetDescField  with return code -1 (SQL_ERROR)
		SQLHDESC            009F1BDC
		SQLSMALLINT                  1 
		SQLSMALLINT               1004 <SQL_DESC_OCTET_LENGTH_PTR>
		SQLPOINTER          0012E0F0
		SQLINTEGER                   0 

		DIAG [HY015] [MySQL][ODBC 5.1 Driver][mysqld-5.0.41-community-nt-log]Invalid parameter type (28) 

Fix:
Index: driver/desc.c
===================================================================
--- driver/desc.c       (revision 885)
+++ driver/desc.c       (working copy)
@@ -672,6 +672,10 @@

   dest= ((char *)dest_struct) + fld->offset;

+  /* some applications and even MSDN examples don't give a correct constant */
+  if (buflen == 0)
+    buflen= fld->data_type;
+
   /* TODO checks when strings? */
   if ((fld->data_type == SQL_IS_POINTER && buflen != SQL_IS_POINTER) ||
       (fld->data_type != SQL_IS_POINTER && buflen == SQL_IS_POINTER))
[29 Nov 2007 20:43] Jess Balint
Fix committed and will be release in 5.1.1.
[3 Dec 2007 7:24] MC Brown
A note has been added to the 5.1.1 changelog: 

ADO applications would not open a RecordSet that contained a DECIMAL field.

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

Page generated in 0.056 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.