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

            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.
            georg Georg Richter added a comment -

            fixed in rev. 493

            georg Georg Richter added a comment - fixed in rev. 493

            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.

            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.