List:MySQL ODBC« Previous MessageNext Message »
From:Michael Widenius Date:April 27 1999 12:09pm
Subject:MySQL ODBC WNT 2.50.2100: BUG in SQLDescribeCol and SQL_CHAR types
View as plain text  
>>>>> "Ocke" == Ocke Janssen <oj@stripped> writes:

Ocke> Hello,
Ocke> I have a problem with the SQLDescribeCol function call. When I try
Ocke> following statement via ODBC to MySQL: select * from table1
Ocke> and I have several text (SQL_CHAR) rows in this table, I recieve for the

Ocke> pcbColDef value the max value of all rows of this column (select
Ocke> max(length(columnX)) from table1 "or something like this").

Ocke> I think this could be a bug, because column descriptions should not
Ocke> depend on the value inside.

Hi!


Acutally, the column description may depend on the value inside.

SQLDescribeCol returns a description of a result column, not a table column.

For example in:

SELECT concat(col_a,col_b) FROM ...

the description of the first column will differ between most SQL
servers.

You can think of it as if the SQL server did a a temporary table of
the set you are using and in the process optimize the some results.

If you want to know the exact type of a column, you have to use the
SQLColumns() call.

You can force MyODBC to not optimize table widths by setting
the 'Don't optimize column width' option in the MyODBC connect screen, 
but to have you application portable, you should instead use SQLColumns()
if you can't handle column widths that increases/decreases in size.

Regards,
Monty
Thread
MySQL ODBC WNT 2.50.2100: BUG in SQLDescribeCol and SQL_CHAR typesOcke Janssen27 Apr
  • MySQL ODBC WNT 2.50.2100: BUG in SQLDescribeCol and SQL_CHAR typesMichael Widenius27 Apr