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

Problem with SQLColumns / SQLFetchScroll

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.0.5
    • 3.0.7, 2.0.19
    • General
    • None
    • Linux/64bit

    Description

      With one of our tables at work we had problems with SQLColumns. If we executed a SQLColumns-Call of another before the call of this particular table, it was working.

      I found out that the Result-Set-Column SQL_DATA_TYPE was reporting different data-types (mediumtext vs. smallint).

      After some research, I managed to CAST this column explicitly to SIGNED (SMALLINT) so that our particular problem was getting solved. But I am sure that there is a better solution.

      Here is out table definition:

      CREATE TABLE IF NOT EXISTS `Putback_Source` (
      `Revision` bigint(20) unsigned NOT NULL DEFAULT '0',
      `Datum` date NOT NULL DEFAULT '0000-00-00',
      `Uhrzeit` time NOT NULL DEFAULT '00:00:00',
      `User_ID` int(10) unsigned NOT NULL DEFAULT '0',
      `Projekt_ID` bigint(20) unsigned NOT NULL,
      `Beschreibung` longtext CHARACTER SET latin1,
      `Kunde_ID` int(10) unsigned DEFAULT NULL,
      `Handbuch` smallint(5) unsigned NOT NULL,
      `FehlerNr` bigint(20) unsigned DEFAULT NULL,
      `TextChecked` tinyint(3) unsigned DEFAULT '0',
      `Prio` smallint(1) unsigned DEFAULT '0'
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

      ALTER TABLE `Putback_Source`
      ADD PRIMARY KEY (`Revision`),
      ADD UNIQUE KEY `Revision` (`Revision`);

      —

      And here my diff:

      1. diff -C 3 ma_statement.h ma_statement.h.mod
          • ma_statement.h 2018-06-07 20:06:47.000000000 +0200
          • ma_statement.h.mod 2018-06-27 17:23:50.507488424 +0200
            ***************
          • 212,224 ****
            #define MADB_DEFAULT_COLUMN_NEW "COLUMN_DEFAULT"
            #define MADB_DEFAULT_COLUMN(DbcHndl) (MADB_ServerSupports(DbcHndl,MADB_ENCLOSES_COLUMN_DEF_WITH_QUOTES) ? MADB_DEFAULT_COLUMN_NEW : MADB_DEFAULT_COLUMN_OLD)
            #define MADB_CATALOG_COLUMNSp4 " AS COLUMN_DEF,"\
            ! "CASE"\
            " WHEN DATA_TYPE = 'date' THEN " XSTR(SQL_DATETIME)\
            " WHEN DATA_TYPE = 'time' THEN " XSTR(SQL_DATETIME)\
            " WHEN DATA_TYPE = 'datetime' THEN " XSTR(SQL_DATETIME)\
            " WHEN DATA_TYPE = 'timestamp' THEN " XSTR(SQL_DATETIME)\
            " ELSE @dt "\
            ! "END AS SQL_DATA_TYPE,"\
            "CASE"\
            " WHEN DATA_TYPE = 'date' THEN " XSTR(SQL_TYPE_DATE)\
            " WHEN DATA_TYPE = 'time' THEN " XSTR(SQL_TYPE_TIME)\
          • 212,224 ----
            #define MADB_DEFAULT_COLUMN_NEW "COLUMN_DEFAULT"
            #define MADB_DEFAULT_COLUMN(DbcHndl) (MADB_ServerSupports(DbcHndl,MADB_ENCLOSES_COLUMN_DEF_WITH_QUOTES) ? MADB_DEFAULT_COLUMN_NEW : MADB_DEFAULT_COLUMN_OLD)
            #define MADB_CATALOG_COLUMNSp4 " AS COLUMN_DEF,"\
            ! "CAST(CASE"\
            " WHEN DATA_TYPE = 'date' THEN " XSTR(SQL_DATETIME)\
            " WHEN DATA_TYPE = 'time' THEN " XSTR(SQL_DATETIME)\
            " WHEN DATA_TYPE = 'datetime' THEN " XSTR(SQL_DATETIME)\
            " WHEN DATA_TYPE = 'timestamp' THEN " XSTR(SQL_DATETIME)\
            " ELSE @dt "\
            ! "END AS SIGNED) AS SQL_DATA_TYPE,"\
            "CASE"\
            " WHEN DATA_TYPE = 'date' THEN " XSTR(SQL_TYPE_DATE)\
            " WHEN DATA_TYPE = 'time' THEN " XSTR(SQL_TYPE_TIME)\

      Attachments

        1. catalog3.c
          10 kB
          Alexander Roskamp

        Activity

          People

            Lawrin Lawrin Novitsky
            roskamp Alexander Roskamp
            Votes:
            0 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.