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

SQLGetData does not return SQL_NULL_DATA for date(time) types in some cases

    XMLWordPrintable

Details

    Description

      Connector would not return NULL for 0000-00-00 datetime values in case
      of SQLGetData call, while doing that in SQLFetch.

      If empty string fetched as SQL_C_TIMESTAMP with SQLGetData, the result is not NULL.
      Also for 0000-00-00 date(time) indicator value is not set to SQL_NULL_DATA
      And today's date is returned. That is not important though.
      If the same column is bound with SQL_C_TIMESTAMP buffer using SQLBindCol, the value is NULL. And that makes sense - select cast('' as datetime) will return you NULL.

      To repeat is easy
      OK_SIMPLE_STMT(Stmt, "SELECT ''");
      CHECK_STMT_RC(Stmt, SQLBindCol(Stmt, 1, SQL_C_TIMESTAMP, &Datetime, sizeof(SQL_TIMESTAMP_STRUCT), &sInd));
      CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
      is_num(sInd, SQL_NULL_DATA);

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            Lawrin Lawrin Novitsky
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.