GitHub user CoderSong2015 opened a pull request:
https://github.com/apache/trafodion/pull/1387
[TRAFODION-2900] Fix bug could insert more than the maximum number ofâ¦
When insert 40 Chinese char to char(30) , of which the character is utf8 ,
it gets success while it should return fail.
SQL return the max length of the column which is calculated by bytes . The
returned length of 30 chars of utf8 character is 120 bytes. However the length
of Chinese chars in utf8 maybe is 3 bytes or 4 bytes. So 40 Chinese chars could
be inserted into the database. But the char(30) represent that 30 chars
regardless of how many bytes a char costs. So I modify the T4 to judge char
numbers of the string instead of bytes of the string.
@kevinxu021 @Weixin-Xu @selvaganesang please review the code.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/CoderSong2015/Apache-Trafodion master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafodion/pull/1387.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 #1387
----
commit e4b0203c41aecf111198431e31c5106e384f4143
Author: Haolin.song <403438485@...>
Date: 2018-01-10T18:02:37Z
[TRAFODION-2900] Fix bug could insert more than the maximum number of
characters with utf-8
----
---