Skip to content

Prepared statement can't use MySqlDbType.JSON #659

Closed
@bgrainger

Description

@bgrainger

Reported for Connector/NET: https://bugs.mysql.com/bug.php?id=95984

MySQL Server disallows MYSQL_TYPE_JSON as a prepared statement column type: https://github.com/mysql/mysql-server/blob/124c7ab1d6f914637521fd4463a993aa73403513/sql/sql_prepare.cc#L636-L639

However, MySqlDbType.VarChar or MySqlDbType.Binary will be accepted (and parsed/validated as JSON). This code needs to be fixed to send JSON as String:

case MySqlDbType.JSON:
columnType = ColumnType.Json; // TODO: test

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions