GitHub user rwbzx opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/853

    [TRAFODION-1262]ODBC:Varchar col operation fails

    Issue Causes:
    1. Dealing with Varchar-oriented data input, if length of input string(end 
with '\0') is larger than 32767, then there will be 4-byte memory assigned to 
indicate data length, otherwise, 2-byte space will do the job. While odbc 
driver only allocates varchar-col-length+2 bytes to store input data as well as 
its length, and when length of input string equals 199999, the insert will 
return SQL_SUCCESS but input data will be truncated.
    2. Say that input data type is Char, and db column type is Varchar, while 
odbc driver decides how many bytes in memory to indicate length of input data 
by length of input string, mxosrvr decides how many bytes to retrieve the 
length of input data by length of column type. Thus, when length of input 
string is smaller than 32768, odbc assigns 2 bytes for the length but mxosrvr 
retrieves 4 bytes including first two bytes of input data, and this causes 
error 8402-string overflow.
    Code Modification:
    1. Calculate memory space according to varchar-col-length: if 
varchar-col-length is bigger than 32767, then varchar-col-length+4 bytes of 
space will be allocated when building value list.
    2. Odbc driver decides how many bytes in memory to indicate length of input 
data by length of column type, thus the assign&retrieve principal will be 
identical.
    3. Modify sqltocconvert files to acommendate sql-c conversion with c-sql 
conversion in case of select failures.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rwbzx/incubator-trafodion TRAFODION-1262

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/853.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #853
    
----
commit c4a39d4d2c5c8d952e9c4b4b87d962332183d34f
Author: rwbzx <xiang.zh...@esgyn.cn>
Date:   2016-11-28T06:21:51Z

    [TRAFODION-1262]ODBC:Varchar col operation fails
    fix bugs on varchar col(>32k) insert/select failure

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to