Bug #72735 prepared statement id incorrect in the Statement executed trace data
Submitted: 24 May 2014 6:06 Modified: 26 Jun 2014 12:59
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Analyzing Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.8.3 OS:Microsoft Windows
Assigned to: Roberto Ezequiel Garcia Ballesteros CPU Architecture:Any

[24 May 2014 6:06] Shane Bester
Description:
mysql Information: 7 : 1: Statement prepared: sql='select ?', statement id=1
mysql Information: 8 : 1: Statement executed: statement id = 385875968

How to repeat:
enable verbose trace info and check the output.

http://dev.mysql.com/doc/connector-net/en/connector-net-programming-tracing-mysql.html

e.g.
string connstring = "server=192.168.1.4;uid=root;database=test;Charset=utf8;IgnorePrepare=false;logging=True";
            try
            {
                MySql.Data.MySqlClient.MySqlConnection conn = new MySqlConnection(connstring);
                conn.Open();
                System.Console.WriteLine("connected to: " + conn.ServerVersion);
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = conn;
                string longq = "select @a1";
                cmd.CommandText = longq;
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("@a1",1);
                cmd.Prepare();
                MySqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Console.WriteLine(dr[0]);
                }
                dr.Close();
                conn.Close();
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                System.Console.WriteLine("errno: " + ex.Number + " error: " + ex.Message);
            }

Suggested fix:
I guess the bug is in function ExecuteStatement(MySqlPacket packetToExecute) in TracingDriver.cs.
[24 May 2014 6:07] Shane Bester
385875968 happens to be 0x17000000 and 0x17 happens to be the enum for COM_STMT_EXECUTE.