Bug #29776 "MySqlConnectionStringBuilder.UseUsageAdvisor = false" does not work
Submitted: 12 Jul 2007 21:40 Modified: 13 Jul 2007 9:54
Reporter: M Beetz Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.0.7 OS:Windows
Assigned to: CPU Architecture:Any

[12 Jul 2007 21:40] M Beetz
Description:
After Upgrading from 5.0.6 to 5.0.7 I get many messages like the following:

<snip>
Reason: Performing unnecessary conversion on field id.
    [12.07.2007 23:11:42] - From: INT to Int32
    [12.07.2007 23:11:42] - -----------------------------------
    [12.07.2007 23:11:42] - USAGE ADVISOR WARNING -------------
</snip>

Every message is usefull but performance is terrible. And switching off the UsageAdvisor does not work.

How to repeat:

- define the connectionstring with the MySqlConnectionStringBuilder
- define MySqlConnectionStringBuilder.UseUsageAdvisor = false

- define a data table with an unsigned integer
- select the data from the column with a data reader
- read the value with "GetInt32" not with "GetUInt32"
[13 Jul 2007 9:52] Tonci Grgin
Hi Manuel and thanks for your report.

I was unable to verify the problem using 
 - MySQL server 5.0.44BK on WinXP Pro SP2 localhost
 - c/NET 5.0 latest sources in branch on NET fw 2.0

mysql> describe test;
+-------+------------------+------+-----+-------------------+----------------+
| Field | Type             | Null | Key | Default           | Extra          |
+-------+------------------+------+-----+-------------------+----------------+
| id    | int(10) unsigned | NO   | PRI | NULL              | auto_increment |
| date  | timestamp        | NO   |     | CURRENT_TIMESTAMP |                |
+-------+------------------+------+-----+-------------------+----------------+
2 rows in set (0.01 sec)

Shortened test case:
        //Bug#29776
        MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
	builder.Server = host_tbx.Text;
	builder.UserID = user_tbx.Text;
	builder.Password = pass_tbx.Text;
	builder.Database = schema_tbx.Text;
        builder.Logging = true;
        builder.AllowZeroDateTime = true;
        builder.UseUsageAdvisor = false;
--cut--

        MySqlDataReader dataReader;
        dataReader = cmd.ExecuteReader();
        Console.WriteLine("Actual results:");
        while (dataReader.Read())
        {
            Console.WriteLine(dataReader.GetDataTypeName(0));
            Console.WriteLine(dataReader.GetFieldType(0));
            Console.WriteLine(dataReader.GetValue(0).GetType().FullName);
            Console.WriteLine(dataReader.GetInt32(0));
        }
        dataReader.Close();

Output:
[13.07.2007 11:42:36] - Executing command QUERY with text ='SHOW VARIABLES'
[13.07.2007 11:42:36] - Executing command QUERY with text ='SHOW COLLATION'
[13.07.2007 11:42:36] - Executing command QUERY with text ='SET NAMES utf8;SET character_set_results=NULL'
'MySQLTimeStampTest.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Actual results:
INT
System.UInt32
System.UInt32
1
INT
System.UInt32
System.UInt32
2
INT
System.UInt32
System.UInt32
3
[13.07.2007 11:42:38] - Executing command QUERY with text ='SELECT Id FROM `test`'
[13.07.2007 11:42:38] - Executing command QUERY with text ='SELECT Id FROM `test`'
The thread '<No Name>' (0x450) has exited with code 0 (0x0).
The thread 0x15ec has exited with code 0 (0x0).
The program '[4616] MySQLTimeStampTest.vshost.exe: Managed' has exited with code 0 (0x0).
[13 Jul 2007 9:54] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation: My fault, this is actually duplicate of Bug#29124
Version 5.0.8:
  - Fixed problem where usage advisor warnings for unnecessary field conversions
    and not reading all rows of a resultset would output even if you
    did not request usage advisor warnings. (Bug #29124)