You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by Weixin-Xu <gi...@git.apache.org> on 2017/11/24 09:50:25 UTC

[GitHub] incubator-trafodion pull request #1310: [TRAFODION-2816] ODBC data convert f...

GitHub user Weixin-Xu opened a pull request:

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

    [TRAFODION-2816] ODBC data convert function split

    Now, the data convert function in ODBC is very long , and very hard to maintenance, we need to refactor it with some short function.
    1. split one long function to little functions to make it more easy to maintain.
    2. support convert very long CHAR/VARCHAR to others struct like timestamp.
    3. Don't modify SQLDataType for SQL_NUMERIC any more. Use FSDataType to decide the real data format.

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

    $ git pull https://github.com/Weixin-Xu/incubator-trafodion NewConvert

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

    https://github.com/apache/incubator-trafodion/pull/1310.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 #1310
    
----
commit 61525d77c2f2107c89f17f236680ea473dcae400
Author: Weixin-Xu <xw...@weixin-1.novalocal>
Date:   2017-11-07T10:23:22Z

    New ODBC Convert Code

----


---

[GitHub] incubator-trafodion pull request #1310: [TRAFODION-2816] ODBC data convert f...

Posted by selvaganesang <gi...@git.apache.org>.
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1310#discussion_r153831339
  
    --- Diff: core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp ---
    @@ -1092,6 +1092,106 @@ bool ctoi64(char* string, __int64& out, bool* truncation)
     	free (buff);
     	return true;
     }
    +unsigned __int64 _atoui64( const char *s )
    +{
    +	unsigned __int64 n = 0;
    +	char* t = (char*)s;
    +	char c;
    +
    +	while(*t != 0)
    +	{
    +		c = *t++;
    +		if (c < '0' || c > '9') continue;
    --- End diff --
    
    Does this mean the junk characters are tolerated when the string is converted to numeric column? If so, this can lead to unexpected behavior.


---

[GitHub] incubator-trafodion pull request #1310: [TRAFODION-2816] ODBC data convert f...

Posted by Weixin-Xu <gi...@git.apache.org>.
Github user Weixin-Xu commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1310#discussion_r153973241
  
    --- Diff: core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp ---
    @@ -1092,6 +1092,106 @@ bool ctoi64(char* string, __int64& out, bool* truncation)
     	free (buff);
     	return true;
     }
    +unsigned __int64 _atoui64( const char *s )
    +{
    +	unsigned __int64 n = 0;
    +	char* t = (char*)s;
    +	char c;
    +
    +	while(*t != 0)
    +	{
    +		c = *t++;
    +		if (c < '0' || c > '9') continue;
    --- End diff --
    
    The function ctoui64() and _atoui64() is imitative written with function ctoi64() and _atoi64().
    The junk characters have been truncated in function ctoui64() which uses _atoui64().
    And I have run an extensive private test suite for this change.


---