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传limit句柄错误 #134

Open
wtx-cynthia opened this issue Nov 24, 2022 · 9 comments
Open

mysql传limit句柄错误 #134

wtx-cynthia opened this issue Nov 24, 2022 · 9 comments

Comments

@wtx-cynthia
Copy link

errmsg[Error 5007: prepare handle error] dnslookup[0] reuse[0] sql[/* {"log_id":"3230830605","xdb_comment":"1"} */ SELECT * FROM file_meta WHERE (isdelete=? AND server_filename=? AND user_id=?) LIMIT ?,?] sql_args[[0,"relay_expect",122050,0,100]]

@caibirdme
Copy link
Contributor

  1. Show me your code
  2. your mysql version

@wtx-cynthia
Copy link
Author

where := map[string]interface{}{
"user_id": User_id,
"server_filename": Server_Filename,
"isdelete": 0,
}
where["_limit"] = []uint{3}
// where["_orderby"] = "fs_id desc"
fields := []string{"*"}
err := dao.BaseSelectConvert(ctx, where, fields, &tabRes)
_orderby是可用的,_limit传入后就会报错。mysql是5.6的

@wtx-cynthia
Copy link
Author

mysql版本
| innodb_version | 5.6.23 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.23-baidu-trunk-2.2.4.3-log |
| version_comment | Source distribution |
| version_compile_machine | x86_64 |
| version_compile_os | Linux

@wtx-cynthia
Copy link
Author

辛苦有空帮忙看下

@wtx-cynthia
Copy link
Author

wtx-cynthia commented Nov 25, 2022 via email

@caibirdme
Copy link
Contributor

这样直接看不出问题,你可以开启mysql driver的interpolateParams试试看,打印下最后的结果

@wtx-cynthia
Copy link
Author

还得辛苦帮忙看下 sql中unhex该怎么传

@wtx-cynthia
Copy link
Author

SELECT * FROM file_meta WHERE (isdelete=? AND server_filename=? AND user_id=?)] sql_args[[0,"unhex(e69da5e887aaefbc9a7669766f2058706c617936)",3941040758 这样报错

@twz915
Copy link

twz915 commented Oct 23, 2023

现在这个也已经支持,可以使用 builder.Raw("unhex(e69da5e887aaefbc9a7669766f2058706c617936)")

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

3 participants