Bug #10644 Cannot call a stored function directly from Connector/Net
Submitted: 15 May 2005 11:45 Modified: 8 Jun 2005 21:57
Reporter: Guy Harrison Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.4 OS:Windows (XP SP2)
Assigned to: Reggie Burnett CPU Architecture:Any

[15 May 2005 11:45] Guy Harrison
Description:
I want to call a function from C# and get the return value.  This seems to be supported since you can set the ParameterDirection=ReturnValue, but Connector/Net doesn't seem to recognize the function as a stored routine.

How to repeat:
Create a simple function:
create function simple_func()
 RETURNS INT
BEGIN
	RETURN 1;
END;

Try and call it from C# and get the return value:

           MySqlCommand FCmd = new MySqlCommand("simple_func", myConnection);
            FCmd.CommandType = CommandType.StoredProcedure;
            MySqlParameter rv = FCmd.Parameters.Add("rv", MySqlDbType.Int32);
            rv.Direction = ParameterDirection.ReturnValue;
            FCmd.ExecuteNonQuery();
            Console.WriteLine("return value=" + rv.Value);
 
Get error:
42000PROCEDURE prod.simple_func does not exist

Suggested fix:
Possibly allow MySqlCommand.CommandType.StoredFunction or simply allow functions to be called like procedures.

Otherwise, don't allow Direction=ReturnValue (but this means, unlike JDBC, you cannot call the function directly).
[18 May 2005 10:42] Vasily Kishkin
Tested on Win 2000 Sp4, Microsoft Visual C# .NET , Connector .NET 1.0.4 Test case is attached.
[18 May 2005 10:43] Vasily Kishkin
Test case

Attachment: 10644.zip (application/x-zip-compressed, text), 3.92 KiB.

[7 Jun 2005 16:34] 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
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Fixed in 1.0.5
[8 Jun 2005 21:57] Mike Hillyer
Documented change in Connector/Net changelog.