命名参数为了有意义的MySQL .NET数据提供程序?有意义、参数、程序、数据

2023-09-07 09:38:33 作者:晚街听风

我发现,在命名参数的我的项目才能有感觉。

I found that in my project order of named parameter has sense.

我把这个过程

CREATE PROCEDURE `test`.`TestProc` (
in myText varchar (5),
in myText2 varchar (100)
)
BEGIN

END

如果我添加参数是这样的:

If I add parameters like this:

    command.CommandText = "testProc";
    command.CommandType = System.Data.CommandType.StoredProcedure;
    command.Parameters.AddWithValue("myText2", "aaaaaaaaaaaaaaaaa");
    command.Parameters.AddWithValue("myText", "bbbb");

我收到数据太长的例外。此外,我不能在测试项目重现此。

I get "Data too long" exception. Also I can't reproduce this in test project.

有什么想法?

我找到了原因。貌似在MySQL .Nat数据提供程序错误。 重现bug需要调用这个不属于root用户。

I found the cause. Looks like bug in MySql .Nat Data Provider. To reproduce the bug you need to call this not under the root user.

结论:MySql.Data版本6.2.3.0。 顺序命名的参数都有意义,如果你调用过程与非根数据库帐户

Conclusion: MySql.Data version 6.2.3.0. Order of named parameter has sense If you call procedure with non root db account

推荐答案

答,我从MySQL的错误追踪系统获得:

Answer that I get from MySql bugtracker:

雷吉·伯内特

我不认为这是一个错误。一世   相信你的测试用户没有   所述PRIVS看在proc的主体。   使用登录到MySQL   命令行客户端和测试用户   帐户。做一个秀CREATE PROCEDURE   您PROC。如果身体是空你   需要使用使用功能   机构= FALSE选项,并通过在   以正确的顺序参数。

I don't believe this is a bug. I believe your test user doesn't have the privs to see the body of the proc. Please login to MySQL using the commandline client and the test user account. Do a "show create procedure" on your proc. If the body is null you need to use the "use function bodies=false" option and pass in the parameters in the right order.

 
精彩推荐
图片推荐