From b68b27f26ba5e538fcac476917348a09738ba834 Mon Sep 17 00:00:00 2001 From: Zhongyue Yue <490023337@163.com> Date: Sat, 25 Apr 2020 19:26:27 +0800 Subject: [PATCH] =?UTF-8?q?mysql=20:=20=E4=BF=AE=E5=A4=8D=E8=AF=BB?= =?UTF-8?q?=E5=86=99=E8=B4=9F=E6=95=B0=E5=AF=BC=E8=87=B4=E6=BA=A2=E5=87=BA?= =?UTF-8?q?=E5=A4=84=E9=94=99=E8=AF=AF=20(#1182)=20(#1183)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * mysql : 修复读写负数导致溢出处错误 #1182 * modify mysql test cases * 对于db内部整型值的处理使用独立函数 --- lualib/skynet/db/mysql.lua | 39 +++++++++++++++++++++++++++++++------- test/testmysql.lua | 17 +++++++++++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/lualib/skynet/db/mysql.lua b/lualib/skynet/db/mysql.lua index fc8ffcfd..711ba39d 100644 --- a/lualib/skynet/db/mysql.lua +++ b/lualib/skynet/db/mysql.lua @@ -4,6 +4,8 @@ -- The license is under the BSD license. -- Modified by Cloud Wu (remove bit32 for lua 5.3) +-- protocol detail: https://mariadb.com/kb/en/clientserver-protocol/ + local socketchannel = require "skynet.socketchannel" local crypt = require "skynet.crypt" @@ -100,7 +102,10 @@ local function _get_byte1(data, i) return strbyte(data, i), i + 1 end -local function _get_int1(data, i) +local function _get_int1(data, i, is_signed) + if not is_signed then + return strunpack("