List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:November 9 1999 1:00pm
Subject:MyODBC bug report (ADODB)
View as plain text  
>>>>> "Bob" == Bob Kline <bkline@stripped> writes:

Bob> Following up on several inqueries made by some of the list members about
Bob> problems with VB6 I have attempted to put together a small testbed which
Bob> I could use to verify problems which were reported and (where possible)
Bob> try to help find solutions.  In doing so, I discovered that the MySQL
Bob> ODBC driver and ADODB do not interact correctly when a new record is
Bob> added to a table (the insert fails because, presumably based on
Bob> information ADODB has extracted from the ODBC driver about the table and
Bob> column information, ADODB tries to construct INSERT statements which
Bob> have the form "INSERT INTO name (name) VALUES (?)".  This results, of
Bob> course, in an error message complaining that the 'colname' table doesn't
Bob> exist.  The same app works properly (formulating the correct INSERT
Bob> statements) when the ADODB control is connected to an ODBC driver for
Bob> another DBMS.

<cut>

Bob> Please let me know if I have omitted any information that would be
Bob> helpful.

Hi!

I don't have VB here on my machine, which makes it a bit

Anyway, the problem is probably that I have forgot to implement the
SQL_COLUMN_TABLE_NAME option in SQLColumnAttributes() in MyODBC

Here is a patch for it:

*** /tmp/results.c	Tue Nov  9 14:57:04 1999
--- ./results.c	Tue Nov  9 14:57:11 1999
***************
*** 237,249 ****
    case SQL_COLUMN_TYPE_NAME:
    {
      char buff[40];
!     (void)
unireg_to_sql_datatype(stmt,field,buff,&transfer_length,&precision,&display_size);
      DBUG_RETURN(copy_result(stmt->dbc,(uchar*) rgbDesc,cbDescMax,pcbDesc,
  			    buff));
    }
    case SQL_COLUMN_OWNER_NAME:
    case SQL_COLUMN_QUALIFIER_NAME:
      DBUG_RETURN(copy_result(stmt->dbc,(uchar*) rgbDesc,cbDescMax,pcbDesc,""));
    }
    DBUG_RETURN(SQL_SUCCESS);
  }
--- 239,257 ----
    case SQL_COLUMN_TYPE_NAME:
    {
      char buff[40];
!     (void) unireg_to_sql_datatype(stmt,field,buff,&transfer_length,
! 				  &precision,&display_size);
      DBUG_RETURN(copy_result(stmt->dbc,(uchar*) rgbDesc,cbDescMax,pcbDesc,
  			    buff));
    }
    case SQL_COLUMN_OWNER_NAME:
    case SQL_COLUMN_QUALIFIER_NAME:
      DBUG_RETURN(copy_result(stmt->dbc,(uchar*) rgbDesc,cbDescMax,pcbDesc,""));
+   case SQL_COLUMN_TABLE_NAME:
+     DBUG_RETURN(copy_result(stmt->dbc,(uchar*) rgbDesc,cbDescMax,pcbDesc,
+ 			    field->table ? field->table ? ""));
+   case default:
+     DBUG_PRINT("warning",("Type: %d is not supported by MyODBC"));
    }
    DBUG_RETURN(SQL_SUCCESS);
  }

I will try to make a new MyODBC version distribution later this week
that you can test!

Regards,
Monty
Thread
MyODBC bug report (ADODB)Bob Kline22 Oct
  • MyODBC bug report (ADODB)Michael Widenius9 Nov
    • Re: MyODBC bug report (ADODB)Bob Kline9 Nov
      • Re: MyODBC bug report (ADODB)Michael Widenius10 Nov