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

Using same pointer as StrLen_Or_IndPtr for several coulmns, may cause errors if one of columns bound as SQL_C_WCHAR

    XMLWordPrintable

    Details

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

      Description

      The testcase. In this case strings get truncated.
      ODBC_TEST(same_len_ptr_binding)
      {
      SQLLEN lenPtr;
      SQLWCHAR a[10], b[10], c[10];
      SQLWCHAR a_ref[]=

      {'M', 'a', 'r', 'i', 'a', 'D', 'B', 0}

      , c_ref[]=

      {'S', 'k', 'y', 0}

      ;

      a[0]= b[0]= c[0]= 0;

      OK_SIMPLE_STMT(Stmt, "DROP table IF EXISTS t_odbc19");

      OK_SIMPLE_STMT(Stmt, "CREATE table t_odbc19(a varchar(10), b varchar(10), c varchar(10))");

      OK_SIMPLE_STMT(Stmt, "insert into t_odbc19(a, c) values( 'MariaDB', 'Sky')");

      OK_SIMPLE_STMTW(Stmt, L"select a, b, c from t_odbc19");

      CHECK_STMT_RC(Stmt, SQLBindCol(Stmt, 1, SQL_C_WCHAR, a, sizeof(a), &lenPtr));
      CHECK_STMT_RC(Stmt, SQLBindCol(Stmt, 2, SQL_C_WCHAR, b, sizeof(b), &lenPtr));
      CHECK_STMT_RC(Stmt, SQLBindCol(Stmt, 3, SQL_C_WCHAR, c, sizeof(c), &lenPtr));

      CHECK_STMT_RC(Stmt, SQLFetch(Stmt));

      IS_WSTR(a, a_ref, sizeof(a_ref)/sizeof(SQLWCHAR));
      IS_WSTR(c, c_ref, sizeof(a_ref)/sizeof(SQLWCHAR));

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

      OK_SIMPLE_STMT(Stmt, "DROP table t_odbc19");

      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:

                Git Integration