You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2018/06/19 17:45:00 UTC

[jira] [Assigned] (IMPALA-1792) ImpalaODBC: Can not get the value in the SQLGetData(m-x th column) after the SQLBindCol(m th column)

     [ https://issues.apache.org/jira/browse/IMPALA-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Armstrong reassigned IMPALA-1792:
-------------------------------------

    Assignee:     (was: Justin Erickson)

> ImpalaODBC: Can not get the value in the SQLGetData(m-x th column) after the SQLBindCol(m th column)
> ----------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-1792
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1792
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Clients
>    Affects Versions: Impala 2.1
>         Environment: OS: CentOS release 6.4 (Final)
> Impala: 2.1.0
> ImpalaODBC: 2.5.23
>            Reporter: Mitsuhiro Koga
>            Priority: Critical
>              Labels: correctness, downgraded, impala, odbc
>
> Steps to reproduce
> # Create table and insert data in impala.
> {code:sql}
> create table t (c1 string, c2 string, c3 string);
> insert into t (c1, c2, c3) values ('AAA', 'BBB', 'CCC');
> {code}
> # Query the t table with the following code.
> {code}
> #include <stdio.h>
> #include <string.h>
> #include <sql.h>
> #include <sqlext.h>
> int main() {
>     SQLHENV env;
>     SQLHDBC dbc;
>     SQLHSTMT stmt;
>     SQLRETURN ret;
>     SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
>     SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); 
>     SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
>     SQLDriverConnect(dbc, (SQLCHAR*)NULL, (SQLCHAR*)"DSN=Impala", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
>     SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);
>     SQLExecDirect(stmt, (SQLCHAR*)"select c1, c2, c3 from t", SQL_NTS);
>     char szCol1[11];
>     char szCol2[11];
>     char szCol3[11];
>     SQLLEN nColLen1;
>     SQLLEN nColLen2;
>     SQLLEN nColLen3;
>     /*************************/
>     /**** Bind 2nd column ****/
>     /*************************/
>     SQLBindCol(stmt, 2, SQL_C_CHAR, szCol2, sizeof(szCol2), &nColLen2);
>     ret = SQLFetch(stmt);
>     if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) {
>         /************************/
>         /**** Get 1st column ****/
>         /************************/
>         ret = SQLGetData(stmt, 1, SQL_C_CHAR, szCol1, sizeof(szCol1), &nColLen1);
>         if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) {
>             printf("c1: %s\n", szCol1);
>         } else {
>             printf("no data\n");
>         }
>         printf("c2: %s\n", szCol2);
>         /************************/
>         /**** Get 3rd column ****/
>         /************************/
>         ret = SQLGetData(stmt, 3, SQL_C_CHAR, szCol3, sizeof(szCol3), &nColLen3);
>         if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) {
>             printf("c3: %s\n", szCol3);
>         } else {
>             printf("no data\n");
>         }
>     } else {
>         printf("no row\n");
>     }
>     return 0;
> }
> {code}
> Expected result
> {code}
> c1: AAA
> c2: BBB
> c3: CCC
> {code}
> Actual result
> {code}
> no data
> c2: BBB
> c3: CCC
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org