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

ResultSetMetaData::getColumnTypeName() returns incorrect type name for LONGTEXT

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 2.7.1
    • metadata
    • None

    Description

      https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSetMetaData.html#getColumnTypeName-int- says that getColumnTypeName "Returns: type name used by the database.", but for LONGTEXT type it will return VARCHAR.
      Also apparently MEDIUMTEXT and TEXT are affected. For TINYTEXT VARCHAR is probably ok

      The solution could be to change the branch in the switch in the method to look like
      case VARSTRING:
      case VARCHAR:
      if (binary)

      { return "VARBINARY"; }

      if (len < 0)

      { return "LONGTEXT"; }

      else if (len <= 255)

      { return "VARCHAR"; }

      else if (len <= 65535)

      { return "TEXT"; }

      else if (len <= 16777215)

      { return "MEDIUMTEXT"; }

      else

      { return "LONGTEXT"; }

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            Lawrin Lawrin Novitsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.