Bug #34699 Calling a stored procedure with allow user variables set to false fails
Submitted: 20 Feb 2008 19:17 Modified: 1 Mar 2008 11:19
Reporter: Reggie Burnett
Status: Closed
Category:Connector/Net Severity:S3 (Non-critical)
Version:5.2 OS:Any
Assigned to: Target Version:

[20 Feb 2008 19:17] Reggie Burnett
Description:
I have recently installed the MySql .NET Connector v.5.2.0 and I have unexpectedly
encountered this error: 

MySqlException 
error message: "Parameter '@3475465099pVideoID' must be defined." 

I have created a stored proc with the following signature: 

AddVideo(pTitle, out pVideoID); 

As you can see, the "pVideoID" is an output for the stored proc. I double checked my C#
code and it properly added the "pVideoID" output parameter to the MySqlCommand object. 

When i execute the method: MySqlCommand.ExecuteNonQuery(), the exception occurs... What
could be the problem here? I have never encountered this exception in the previous
versions of the .NET Connector. Weird thing is that my code worked in the .NET Connector
versions earlier than 5.2. Help!

How to repeat:
Create a procedure that takes an output parameter and attempt to call it on a connection
that has allow user variables set to false.
[21 Feb 2008 18:07] Stefan Gottschalk
Hello,

i have a similar exception with the Connector.NET v5.2.

I insert a row to a Table with a Trigger "after insert". In this Trigger I set a variable
@new_id.
When I execute the Query "insert into `table` ...; Select @new_id;" i get the same
exception.
In the earlier versions of Connector.Net it works fine.
[21 Feb 2008 22:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/42789
[21 Feb 2008 22:38] Reggie Burnett
Fixed in 5.2.1
[1 Mar 2008 11:19] MC Brown
A note has been added to the 5.2.1 changelog: 

When executing statements that used stored procedures and functions, the new parameter
code could fail to identify the correct parameter format.
[17 Oct 2008 17:21] Stefan Gottschalk
Hello,

i just installed the Connector.net 5.2.3 and the Problem is still the same.

I insert a row to a Table with a Trigger "after insert". In this Trigger I set a variable
@new_id like this:

CREATE TRIGGER tr_TestTable_after_insert AFTER INSERT ON TestTable
    FOR EACH ROW BEGIN
        SET @new_id = NEW.id;
    END IF;
END

When I execute the Query "insert into `TestTable` ...; Select @new_id;" i get the same
exception:

"Parameter '@new_id' must be defined."

In the earlier versions of Connector.Net it works fine.