Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-643

PreparedStatement::getParameterMetaData always returns VARSTRING as type resulting in downstream libraries interpreting values wrongly

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.6
    • Fix Version/s: 2.3.0, 1.8.0
    • Component/s: metadata
    • Labels:
      None
    • Environment:
      MySQL 5.7.14

      Description

      When `PreparedStatement::getParameterMetaData` is performed for a query (for example, an insert query), the sql type for the parameters reports a wrong type, in fact, it is always VARSTRING.

      From https://jira.mariadb.org/browse/CONJ-568, I understand it's because the MariaDB server doesn't return the parameter types, and I have a feeling in my case, the MySQL server isn't returning parameter types as well.

      However, I personally feel this is wrong. Instead of returning a wrong type, it should throw an exception instead. See how MySql connector does it. Returning wrong types will lead downstream libraries to act on these wrong types and produce wrong results. If an exception is thrown, downstream libraries can act on the exception and perform other/fallback actions.

      Because of MariaDB connector returning wrong values, I have to write code to specifically ignore parameter metadata if the jdbc connector is of MariaDB type.

        Attachments

          Activity

            People

            • Assignee:
              diego dupin Diego Dupin
              Reporter:
              isengrim Isen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: