10000 Function call raise exception with set datatype · Issue #1491 · mysql-net/MySqlConnector · GitHub
[go: up one dir, main page]

Skip to content

Function call raise exception with set datatype #1491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
daikoz opened this issue Jul 9, 2024 · 1 comment
Closed

Function call raise exception wit AE60 h set datatype #1491

daikoz opened this issue Jul 9, 2024 · 1 comment

Comments

@daikoz
Copy link
daikoz commented Jul 9, 2024

Software versions
MySqlConnector version: 2.3.7
Server: MariaDB [10.5.23-MariaDB-0+deb11u1-log]
.NET version: .NET SDK Version 8.0.300

Describe the bug

Create function:

CREATE FUNCTION TestFunction2(ColSet set('set1','set2','set3'))
RETURNS smallint
BEGIN
	RETURN 0;
END

Call this function

            using MySqlConnector.MySqlConnection conn = new("XXXXXXXXXX");
            conn.Open();

            using DbCommand sqlCmd = conn.CreateCommand();
            sqlCmd.Connection = conn;
            sqlCmd.CommandText = @"TestFunction2";
            sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;

            DbParameter param23 = sqlCmd.CreateParameter();
            param23.ParameterName = "@ColSet";
            param23.Value = "set1";
            sqlCmd.Parameters.Add(param23);

            DbParameter paramXXX = sqlCmd.CreateParameter();
            paramXXX.ParameterName = "@ReturnValue";
            paramXXX.Direction = System.Data.ParameterDirection.ReturnValue;
            sqlCmd.Parameters.Add(paramXXX);

            var result = sqlCmd.ExecuteScalar();

Exception on ExecuteScalar

  Name Value Type
$exception {"Object reference not set to an instance of an object."} System.NullReferenceException
  ▶ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
  HResult -2147467261 int
  HelpLink null string
  ▶ InnerException null System.Exception
  Message "Object reference not set to an instance of an object." string
  Source "MySqlConnector" string
  StackTrace " at MySqlConnector.Core.TypeMapper.GetMySqlDbType(String typeName, Boolean unsigned, Int32 length)\r\n at MySqlConnector.Core.CachedParameter..ctor(Int32 ordinalPosition, String mode, String name, String dataType, Boolean unsigned, Int32 length)\r\n at MySqlConnector.Core.CachedProcedure.d__0.MoveNext()\r\n at MySqlConnector.MySqlConnection.d__90.MoveNext()\r\n at MySqlConnector.Core.CommandExecutor.d__0.MoveNext()\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at MySqlConnector.MySqlCommand.<ExecuteScalarAsync>d__80.MoveNext()\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at MySqlConnector.MySqlCommand.ExecuteScalar()\r\n at ConsoleApp12.Program.Main(String[] args) in C:\XXXX\source\repos\ConsoleApp12\ConsoleApp12\Program.cs:line 30" string
  ▶ TargetSite {MySqlConnector.MySqlDbType GetMySqlDbType(System.String, Boolean, Int32)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
@bgrainger
Copy link
Member

Added in 2.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants
0