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 query查询数据表内容不能超出250列 #712

Closed
vicjay007 opened this issue Aug 13, 2017 · 2 comments
Closed

mysql query查询数据表内容不能超出250列 #712

vicjay007 opened this issue Aug 13, 2017 · 2 comments

Comments

@vicjay007
Copy link

用mysql query查询一个有255列的数据表,返回以下错误

[:0000000b] lua call [0 to :b : 0 msgsz = 24] error : ./skynet/lualib/skynet.lua:533: ./skynet/lualib/skynet.lua:156: ./skynet/lualib/skynet/socketchannel.lua:366: ./skynet/lualib/skynet/db/mysql.lua:523: attempt to concatenate a nil value (local 'typ')
stack traceback:
[C]: in function 'error'
./skynet/lualib/skynet/socketchannel.lua:366: in function <./skynet/lualib/skynet/socketchannel.lua:354>
(...tail calls...)
./service/mysql_mgr/main.lua:96: in local 'f'
./service/mysql_mgr/main.lua:246: in upvalue 'f'
./skynet/lualib/skynet.lua:111: in function <./skynet/lualib/skynet.lua:105>
stack traceback:
[C]: in function 'assert'
./skynet/lualib/skynet.lua:533: in function 'skynet.manager.dispatch_message'

@cloudwu
Copy link
Owner

cloudwu commented Aug 14, 2017

@vicjay007 麻烦看一下这个 patch 是否能修复这个问题。

mysql 这个库修改来源于 https://github.com/openresty/lua-resty-mysql , 我认为 openresty 的实现很可能是参考 http://hutaow.com/blog/2013/11/06/mysql-protocol-analysis/ 实现的。

我没有找到英文的 mysql wire protocol 的文档(或者已经废弃了),从 https://dev.mysql.com/downloads/connector/c/ 可以下载到官方 driver /connector 的源码(没有仓库)。

根据 sql-common/client.c 中 cli_safe_read_with_ok 函数的实现,包头第一字节不是 255 和 254 就可以判定为 data 段了。但在上面的中文协议分析文章的 4.3 服务器响应报文(服务器 -> 客户端)这一节,认为应该是 0x01 - 0xfa ,和 openresty 的实现一致,我认为是不对的。在 Result Set 报文 中,如果超过 250 ,需要用 2/3 字节表示数量。

wangyi0226 added a commit to wangyi0226/skynet that referenced this issue Aug 14, 2017
fix invalid type of generic response packets, see cloudwu#712
@vicjay007
Copy link
Author

问题已解决,谢谢

@cloudwu cloudwu closed this as completed Oct 11, 2018
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

No branches or pull requests

2 participants