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

php laravel6.x 使用PDO插入数据,debug 打印,字段读取为null #758

Closed
nanjishidu opened this issue Sep 20, 2022 · 8 comments
Closed

Comments

@nanjishidu
Copy link

nanjishidu commented Sep 20, 2022

配置:
server=native
useServerPrepStmts=false

代码
日志

疑问:

这里len长度是507 ,直接return null。注释return null 可以正常读取。

可以描述下这里的判断逻辑吗?规避下这类问题

@nanjishidu nanjishidu changed the title php php laravel6.x 使用PDO插入数据,debug 打印,字段读取为null Sep 20, 2022
@zwyqz
Copy link
Collaborator

zwyqz commented Sep 20, 2022

字段类型,字段的值是什么?

@nanjishidu
Copy link
Author

nanjishidu commented Sep 20, 2022

字段类型,字段的值是什么?

数据库字段类型 text ,改为varchar,问题同样存在。

测试字段值

{"file_name":"项目一:3进行产品分析并确定矩阵平台(1).wmv","size":"322735","file_format":"wmv","type":"1","name":"进行产品分析并确定矩阵平台(1)","category_id":"16","level":"1","local_path":"\/uploads\/tmp\/2022\/09\/19\/2022-09-19_1663576589_8893.png","tencent_vod_file_id":"387702306181337466","tencent_vod_file_url":"http:\/\/1500004322.vod2.myqcloud.com\/6c99a6d1vodcq1500004322\/09ff000d387702306181337463\/M3L5UzRo56IB.wmv","remark":"","status":"2","format":"json"}

@zwyqz
Copy link
Collaborator

zwyqz commented Sep 20, 2022

本地测试是正常的,字段值为varchar;进行查询:
image

@nanjishidu
Copy link
Author

本地测试是正常的,字段值为varchar;进行查询: image

麻烦看下一开始的截图。不是查询报错,是写入报错。执行insert mycat读取不到值。这里为什么读取长度507 就直接return null。

@nanjishidu
Copy link
Author

nanjishidu commented Sep 20, 2022

1019 0000001111111011
507 0000000111111011
255 0000000011111111
251 0000000011111011
测试了几个字段值 只要长度是 &0xff == 0xfb 都无法读取

@zwyqz
Copy link
Collaborator

zwyqz commented Sep 20, 2022

这边的这个逻辑应该是可以不用的,我记得协议中是aLong如果为251,则为null;这个判断再readLenencInt中已经有了,具体我还需要查下mysql协议的文档;

@nanjishidu
Copy link
Author

这边的这个逻辑应该是可以不用的,我记得协议中是aLong如果为251,则为null;这个判断再readLenencInt中已经有了,具体我还需要查下mysql协议的文档;

readLenencInt 有针对251 的判断,这个理解。readLenencBytes中的判断是 readFixInt处理后的返回值进行校验。readLenencInt中的len 252 经过 readFixInt处理后 返回的是251 这里再二次判断触发问题了。

@zwyqz
Copy link
Collaborator

zwyqz commented Sep 21, 2022

联系我QQ1019100252 获取测试包

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