You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Suresh Subbiah (JIRA)" <ji...@apache.org> on 2015/10/08 06:25:27 UTC

[jira] [Assigned] (TRAFODION-691) LP Bug: 1380720 - ODBC Linux driver SQLBindCol returns only 32-bit values instead of 64-bit

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

Suresh Subbiah reassigned TRAFODION-691:
----------------------------------------

    Assignee: Rao Kakarlamudi

> LP Bug: 1380720 - ODBC Linux driver SQLBindCol returns only 32-bit values instead of 64-bit
> -------------------------------------------------------------------------------------------
>
>                 Key: TRAFODION-691
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-691
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: client-odbc-linux
>            Reporter: Marvin Anderson
>            Assignee: Rao Kakarlamudi
>
> SQLBindCol is only returning a 32-bit integer when I asked for a 64-bit.  In the example below a zero value is being fetched.
> =======================
>    long zerosum;
>    zerosum=-1;  //< zerosum (hex) = 0xffff ffff ffff ffff >  (displayed while stepping through the code in a debugger)
>    /* build SELECT statement for SQL */
>    sprintf(command,"SELECT SUM(%s) FROM %s ",
>            zerosum_column_name,table_ptr->pTable->TableName);
>    rc=SQLPrepare(hstmt,command,SQL_NTS);
>    if(!CHECKRC(SQL_SUCCESS,rc,"SQLPrepare")){
>       LogAllErrors(henv,hdbc,hstmt);
>       return(FAILURE);
>       }
>    // bind all result columns
>    rc=SQLBindCol(hstmt,1,SQL_C_LONG,&zerosum,0,&zerosumNullIndicator);
>    if(!CHECKRC(SQL_SUCCESS,rc,"SQLBindCol")){
>       LogAllErrors(henv,hdbc,hstmt);
>       return(FAILURE);
>       }
>    rc=SQLExecute(hstmt);
>    rc=SQLFetch(hstmt);
> < zerosum (hex) = 0xffffffff00000000 >  <- it’s supposed to be all zeroes
> ========================
> Not sure it this matters but it’s the sum of an integer column.  You will only notice the problem if you first set the variable you are binding and fetching into to -1 (or some larger than 32-bit value)
> zerosum= -1;   <0xffff ffff ffff ffff>
> SQLBindCol and Fetch into zerosum the SUM of an INTEGER column
> zerosum = 0xffff ffff 0000 0000  (displays as -4294967296 in decimal)
> If the upper 32-bits were already zeroes, then you wouldn’t notice if SQLBindCol & Fetch were only getting the lower 32-bits.
> zerosum= 0;   <0x0000 0000 0000 0000>
> SQLBindCol and Fetch into zerosum the SUM of an INTEGER column
> zerosum = 0x0000 0000 0000 0000



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)