Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql : 修复读写负数导致溢出处错误 (#1182) #1183

Merged
merged 4 commits into from Apr 25, 2020
Merged

mysql : 修复读写负数导致溢出处错误 (#1182) #1183

merged 4 commits into from Apr 25, 2020

Conversation

DisillusionYzy
Copy link
Contributor

@DisillusionYzy DisillusionYzy commented Apr 25, 2020

客户端其实是没法直接通过数据类型判断服务器发来的数据是否有无符号的.需要通过列定义包中的标志位来判断.
https://mariadb.com/kb/en/resultset
整型数据也不能统一按符号型(I<n>)处理,不然会导致错误.比如服务器存储了一个unsigned tinyint,其值为0xFF,都按照有符号整型处理,客户端是取不到255(<I1)这个值的,只能取到-1(<i1).

@cloudwu
Copy link
Owner

cloudwu commented Apr 25, 2020

我觉得把支持符号的 _get_byte1 等系列函数和之前的版本分离比较好。因为这几个函数只在 _parse_row_data_binary 里用到,但之前的无符号版本却在其它地方使用。

它们是两种不同的用途,分成两个版本更好。例如保留原有的无符号版本 _get_byte1 ,新增加一个 _get_int1 ,后者可以支持有符号及无符号。

@cloudwu cloudwu merged commit b68b27f into cloudwu:master Apr 25, 2020
wangyi0226 added a commit to wangyi0226/skynet that referenced this pull request Apr 26, 2020
mysql : 修复读写负数导致溢出处错误 (cloudwu#1182) (cloudwu#1183)
fanlix pushed a commit to fanlix/skynet that referenced this pull request Jul 22, 2020
* mysql : 修复读写负数导致溢出处错误 cloudwu#1182

* modify mysql test cases

* 对于db内部整型值的处理使用独立函数
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants