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

tinyInt1isBit is not applied by MySQLDatabaseMetaData when retrieving columns

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 1.1.6
    • None
    • None
    • MariaDB Java Client 1.1.5

    Description

      When MySQLDatabaseMetaData.getColumns(String, String, String, String) is used (by Hibernate in my particular case), it does not apply the tinyInt1isBit setting from the JDBC URL. That means it returns "tinyint" where it should be returning "bit", which causes Hibernate to fail to validate the schema.

      It looks like a bug in MySQLDatabaseMetaData.dataTypeClause(String), line 99 (in the 1.1.5 source):

              " WHEN 'tinyint' THEN "     + Types.TINYINT +
              " WHEN 'year' THEN "  + (((connection.getProtocol().datatypeMappingFlags &  MySQLValueObject.YEAR_IS_DATE_TYPE)== 0)? Types.SMALLINT :Types.DATE) +

      Based on the "year" line, it seems like the "tinyint" code should be:

              " WHEN 'tinyint' THEN "     + (((connection.getProtocol().datatypeMappingFlags &  MySQLValueObject.TINYINT1_IS_BIT) == 0) ? Types.TINYINT : Types.BIT) +
              " WHEN 'year' THEN "  + (((connection.getProtocol().datatypeMappingFlags &  MySQLValueObject.YEAR_IS_DATE_TYPE) == 0) ? Types.SMALLINT : Types.DATE) +

      Attachments

        Issue Links

          Activity

            bturner Bryan Turner (Inactive) created issue -

            The standard MySQL Connector/J implementation correctly translates the column types in its equivalent version of this method.

            bturner Bryan Turner (Inactive) added a comment - The standard MySQL Connector/J implementation correctly translates the column types in its equivalent version of this method.
            bturner Bryan Turner (Inactive) made changes -
            Field Original Value New Value
            Summary tinyInt1isBit is not applied by tinyInt1isBit is not applied by MySQLDatabaseMetaData
            bturner Bryan Turner (Inactive) made changes -
            Summary tinyInt1isBit is not applied by MySQLDatabaseMetaData tinyInt1isBit is not applied by MySQLDatabaseMetaData when retrieving columns
            elenst Elena Stepanova made changes -
            Assignee Rasmus Johansson [ ratzpo ] Georg Richter [ georg ]
            georg Georg Richter added a comment -

            fixed in rev. 493

            georg Georg Richter added a comment - fixed in rev. 493
            georg Georg Richter made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

            Unfortunately it appears this is only half a fix. The next problem is that the TYPE_NAME value is still wrong, and shows TINYINT rather than BIT. As a result, things like Hibernate validation still fail. It appears the SQL returned by columnTypeClause(String) needs something done to it as well.

            bturner Bryan Turner (Inactive) added a comment - Unfortunately it appears this is only half a fix. The next problem is that the TYPE_NAME value is still wrong, and shows TINYINT rather than BIT . As a result, things like Hibernate validation still fail. It appears the SQL returned by columnTypeClause(String) needs something done to it as well.
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow defaullt [ 29520 ] MariaDB v2 [ 47834 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Fix Version/s 1.1.6 [ 13801 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 47834 ] MariaDB connectors [ 54926 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB connectors [ 54926 ] MariaDB v3 [ 70222 ]
            mikec Mike Celis made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 70222 ] MariaDB v4 [ 134704 ]

            People

              georg Georg Richter
              bturner Bryan Turner (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.