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

Binding of SQL_C_TIMESTAMP to SQL_TIME does not work(correctly)

    XMLWordPrintable

    Details

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

      Description

      This affects work with MS Access, if the table contains `time` field.

      The testcase would be smth like following

      rc = SQLExecDirect(Stmt,"create table t_tstotime(col1 date, col2 time, col3 timestamp)", SQL_NTS);
      CHECK_STMT_RC(Stmt,rc);

      rc = SQLTransact(NULL,Connection,SQL_COMMIT);
      CHECK_DBC_RC(Connection,rc);

      rc = SQLFreeStmt(Stmt,SQL_CLOSE);
      CHECK_STMT_RC(Stmt,rc);

      /* TIMESTAMP TO DATE, TIME and TS CONVERSION */
      rc = SQLPrepare(Stmt, (SQLCHAR *)"insert into t_tstotime(col1, col2, col3) values(?,?,?)",SQL_NTS);
      CHECK_STMT_RC(Stmt,rc);

      rc = SQLBindParameter(Stmt,1,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
      SQL_DATE,0,0,&ts2,sizeof(ts2),NULL);

      CHECK_STMT_RC(Stmt,rc);

      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt,2,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
      SQL_TIME,0,0,&ts1,sizeof(ts1),NULL));

      rc = SQLBindParameter(Stmt,3,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
      SQL_TIMESTAMP,0,0,&ts,sizeof(ts),NULL);
      CHECK_STMT_RC(Stmt,rc);

      rc = SQLExecute(Stmt);
      CHECK_STMT_RC(Stmt,rc);

      rc = SQLFreeStmt(Stmt, SQL_UNBIND);
      CHECK_STMT_RC(Stmt,rc);

      CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));

      CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 1, SQL_PARAM_INPUT, SQL_C_TIMESTAMP,
      SQL_TIME, 0, 0, &ts1, sizeof(ts1), NULL));

      OK_SIMPLE_STMT(Stmt, "SELECT * FROM t_tstotime WHERE col2= ?");

      IS(1 == myrowcount(Stmt));

        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:

                Git Integration