didi / gendry

a golang library for sql builder
Apache License 2.0
1.6k stars 191 forks source link

mysql传limit句柄错误 #134

Open wtx-cynthia opened 1 year ago

wtx-cynthia commented 1 year ago

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 commented 1 year ago
  1. Show me your code
  2. your mysql version
wtx-cynthia commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

辛苦有空帮忙看下

wtx-cynthia commented 1 year ago

还请有空看下我最新的回答,谢谢~

@.***

@.*** |

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2022年11月25日 00:55 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [didi/gendry] mysql传limit句柄错误 (Issue #134) |

Show me your code your mysql version

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

caibirdme commented 1 year ago

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

wtx-cynthia commented 1 year ago

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

wtx-cynthia commented 1 year ago

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

twz915 commented 8 months ago

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