Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-214

Mediumint(INT24) is always empty

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.0.8
    • 3.1.9
    • General
    • None
    • Windows 10, Microsoft Visual FoxPro 9, MariaDB ODBC 3.0 Driver 32-Bit

    Description

      Brief description

      When I try to fetch records from tables that contain mediumint columns, I get empty values. The problem doesn’t occur when I use the odbc driver 5.3 from oracle/mysql.

      Long description

      I am using Microsoft Visual FoxPro 9.0 to access the data. It is a quite old development environment from Microsoft. I was not able to trigger this bug in other ways than using Microsoft Visual FoxPro. However, I figured some things out:

      When I apply the following patch to the odbc driver, everything works fine:

      diff --git a/ma_helper.c b/ma_helper.c
      index a1ca7a580a9e9f64b9cda149367644f56d022409..259a6ea25d80c9cefd94717a30a2c961d4846792 100644
      --- a/ma_helper.c
      +++ b/ma_helper.c
      @@ -544,7 +544,6 @@ size_t MADB_GetOctetLength(MYSQL_FIELD *Field, unsigned short MaxCharLen)
         case MYSQL_TYPE_SHORT:
           return 2;
         case MYSQL_TYPE_INT24:
      -    return 3;
         case MYSQL_TYPE_LONG:
           return 4;
         case MYSQL_TYPE_LONGLONG:
      

      But I am not sure whether this is the right solution because in the module ma_statement.c I found another snipped of code that could be related to this issue:

      /* We do this for catalog functions and MS Access in first turn. The thing is that for some columns in catalog functions result,
                 we fix column type manually, since we can't make field of desired type in the query to I_S. Mostly that is for SQLSMALLINT
                 fields, and we can cast only to int, not to short. MSAccess in its turn like to to get length for fixed length types, and
                 throws error if the length is not what it expected (ODBC-131)
                 Probably it makes sense to do this only for SQL_C_DEFAULT type, which MS Access uses. But atm it looks like this should
                 not hurt if done for other types, too */{color}
              if (*StrLen_or_IndPtr == 0 || (Bind.length_value > (unsigned long)IrdRec->OctetLength && *StrLen_or_IndPtr > IrdRec->OctetLength))
              {
                *StrLen_or_IndPtr= IrdRec->OctetLength;
              }
      

      The comment says at some point: „Probably it makes sense to do this only for SQL_C_DEFAULT type, which MS Access uses. But atm it looks like this should not hurt if done for other types, too“.

      If I remove this line of code, everything works fine too:

      *StrLen_or_IndPtr= IrdRec->OctetLength;

      Maybe FoxPro doesn’t like this behavior and it should actually be done only for SQL_C_DEFAULT type.

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            matzehh Matthias Schröder
            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.