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

Binding parameter as SQL_C_TIME does not work correctly in some cases

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.7
    • Fix Version/s: 3.1.9
    • Component/s: General
    • Labels:
      None

      Description

      Going about SQL_TYPE_TIME sql type in first turn, but again - not all cases. The test:

      ODBC_TEST(timestruct_param)
      {
      SQL_TIMESTAMP_STRUCT ts=

      { 2020/*year*/, 4, 7, 1/*hour*/, 28, 56, 0/*fractional*/ }

      ;
      SQL_TIME_STRUCT tp=

      {15, 58, 33}

      , tr;

      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 1, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TYPE_TIME, 8, 0, &tp, 0, NULL));
      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 2, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TYPE_TIME, 8, 0, &tp, 0, NULL));
      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 3, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TYPE_TIME, 8, 0, &tp, 0, NULL));
      OK_SIMPLE_STMT(Stmt, "SELECT ?, CAST('15:58:33' AS TIME) = ?,

      {t '15:58:33'}

      = ?");
      CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
      CHECK_STMT_RC(Stmt, SQLGetData(Stmt, 1, SQL_C_TIME, &tr, sizeof(SQL_TIME_STRUCT), NULL));
      is_num(tr.hour, 15);
      is_num(tr.minute, 58);
      is_num(tr.second, 33);
      is_num(my_fetch_int(Stmt, 2), 1);
      is_num(my_fetch_int(Stmt, 3), 1);
      CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
      CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_RESET_PARAMS));

      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 1, SQL_PARAM_INPUT, SQL_C_TIMESTAMP, SQL_TYPE_TIMESTAMP, 20, 0, &ts, 0, NULL));
      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 2, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TYPE_TIME, 8, 0, &tp, 0, NULL));

      OK_SIMPLE_STMT(Stmt, "SELECT 1 FROM DUAL WHERE '2020-04-07 01:28:56'=? AND CAST('15:58:33' AS TIME) = ?");
      CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
      is_num(my_fetch_int(Stmt, 1), 1);
      CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));

      return OK;
      }

        Attachments

          Activity

            People

            Assignee:
            Lawrin Lawrin Novitsky
            Reporter:
            Lawrin Lawrin Novitsky
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: