Bug #59989 MysqlDataReader.GetSchemaTable returns incorrect Values an types
Submitted: 7 Feb 2011 16:21 Modified: 15 Feb 2011 21:13
Reporter: Flavio Oliveira Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.3.6.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Incorrect Types, Incorrect Values, MySqlDataReader, SchemaTable

[7 Feb 2011 16:21] Flavio Oliveira
Description:
I'm using the "GetSchemaTable" method for the "MySqlDataReader" class to get the columns info for a specific table.

(programming on c#/vb.net)

After this method return a Datatable, i've found a couple of differences comparing with the columns of the same table.

For exmaple if i've a decimal(20,6) column, the correspondent info in datatable returns me the following values for:
 - ColumnSize="22"
 - NumericPrecision="16"
 - NumericScale="6"

are correct this values? or this ones:
 - ColumnSize="20"
 - NumericPrecision="20"
 - NumericScale="6"

The second issue that i've found is located on the same code scope, when i've a bit Column, i expect to find on the "DataType" info a value like "Boolean" not "UINT64"

How to repeat:

DataTable oSchema; //dataTable that stores the Columns info

oComm.CommandText = "SELECT * FROM `TableXpto`";
oConn.Open();
using (MySqlDataReader oRea = oComm.ExecuteReader())
{
    oSchema = oRea.GetSchemaTable();
}
oConn.Close();

/*
    the values that i've refered on the description are contained on this datatable
*/

Suggested fix:
In my suggestion this method should be corrected reviewed, not only to correct my examples but to check too a possible other bugs.

For demimal error i suggest that the values returned on the datatable looks like (for a decimal(20,6)):
 - ColumnSize="20"
 - NumericPrecision="20"
 - NumericScale="6"

For Second bug when we have a bit type column the correct "mapping" is Boolean
[15 Feb 2011 21:13] Reggie Burnett
Fixed in 6.0.8, 6.1.6, 6.2.5, 6.3.7+
[1 Apr 2011 19:01] karl christ
Hello I have found the same problem 
connector is 6.3.6 plattform windows xp net 3.5 aspx C#

the columnsize property returns the wrong value. 
In the resultset.fields array the length is correct, but I found no way to get the value from this point.

for example I have a varchar field with length 3 and it gives me back 6.

it is NOT fixed as I red. in the bug report. I installed the connector today.
[1 Apr 2011 19:44] karl christ
Hello I have to correct my report.

the columnsize property of varchar fields have the correct length!

the problem happens with Char-fields.
the length is always multiplied by 3.  for example a char 7 becomes length 21 

maybe i misunderstand the fixed version list. 6.3.6.0 is not fixed?