Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-421

ODBC truncates data for LONGTEXT and BLOB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Help Wanted
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 19.1.1
    • Fix Version/s: None
    • Component/s: odbc
    • Labels:
      None

      Description

      Tested with MySQL 5.6.36 on CentOS 6.9 64-bit and rpm esl-erlang-19.3-1.x86_64.

      If you have either a LONGTEXT or BLOB column, content exceeding 8001 bytes will be truncated when reading from the database.

      To reproduce:
      Create a table customerField in a database named tull and write content of e.g. 10000 characters in a LONGTEXT column. Then, from the erlang shell:

      odbc:start().
      Connect="DSN=sqlconnection;UID=root;PWD=;MULTI_STATEMENTS=1;BIG_PACKETS=1;charset=utf8mb4;database=tull".

      {ok,Ref}

      = odbc:connect(Connect,[]).
      odbc:sql_query(Ref,"select value from sessionField ").

      Reason for problem:
      Looking at ../lib/odbc/c_src/odbcserver.c and odbcserver.h:

      In function encode_column_name_list() there is an if clause:
      if(sql_type == SQL_LONGVARCHAR || sql_type == SQL_LONGVARBINARY || sql_type == SQL_WLONGVARCHAR)
      size = MAXCOLSIZE;

      where MAXCLOSIZE is defined to 8001.

      Suggested solution:
      Some kind of dynamic reading using SQLGetData.

        Attachments

          Activity

            People

            Assignee:
            otp_team_ps Team PS
            Reporter:
            lea Leif Einar Aune
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: