Bug #7243 calling prepare causing exception
Submitted: 13 Dec 2004 19:41 Modified: 14 Dec 2004 4:33
Reporter: Reggie Burnett Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:
Assigned to: Reggie Burnett CPU Architecture:Any

[13 Dec 2004 19:41] Reggie Burnett
Calling .Prepare on certain commands cause a problem

How to repeat:
Step to reproduce the problem:

1. Create the table and insert one record:

   create table twocolumns (one integer, two integer);
   insert into twocolumns values (1, 2);

2. Execute the following C# code:

   // Open the connection
   IDbConnection cnn = new MySqlConnection();
   cnn.ConnectionString = "Database=test;Data Source=DBSRVTEST;User Id=root;Password=123456";
   // create the command and prepare the statement
   IDbCommand cmd = cnn.CreateCommand();
   cmd.CommandText = "SELECT * FROM twocolumns where one = ?p1";
   // create the parameter
   IDbDataParameter p1 = cmd.CreateParameter();
   p1.ParameterName = "@p1";
   p1.DbType = DbType.Int32;
   p1.Precision = (byte)10;
   p1.Scale = (byte)0;
   p1.Size = 4;
   p1.Value = 1;
   // Execute the reader
   IDataReader reader = cmd.ExecuteReader();
   // Fetch the first record
   // Close the connection

3. Exception generated by the Prepare method:

   MySql.Data.MySqlClient.MySqlException: Expected end of data packet
      at MySql.Data.MySqlClient.NativeDriver.ReadEOF(Boolean readPacket)
      at MySql.Data.MySqlClient.NativeDriver.Prepare(String sql, String[] parmNames)
      at MySql.Data.MySqlClient.MySqlCommand.Prepare()
      at Test.Class1.Main(String[] args) in d:\test\class1.cs:line 39
[14 Dec 2004 4:33] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at