Bug #72735 prepared statement id incorrect in the Statement executed trace data

Submitted: 24 May 2014 6:06 Modified: 23 Jan 2021 17:01
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.8.3 OS:Windows
Assigned to: Assigned Account 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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.