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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.1
    • Component/s: metadata
    • Labels:
      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

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            Lawrin Lawrin Novitsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: