gogf / gf

GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
https://goframe.org
MIT License
11.79k stars 1.61k forks source link

The SQL actually executed does not match the one printed by the program #2903

Open greenhat616 opened 1 year ago

greenhat616 commented 1 year ago

1. What version of Go and system type/arch are you using?

go version go1.21.0 windows/amd64

2. What version of GoFrame are you using?

GoFrame CLI Tool v2.5.1, https://goframe.org GoFrame Version: v2.5.2 in current go.mod CLI Installed At: D:\Programs\Go\bin\gf.exe CLI Built Detail: Go Version: go1.20.4 GF Version: v2.5.1 Git Commit: 2023-07-26 21:27:58 e0e00434cc87d6edf64fc3df40ce7d3f40758794 Build Time: 2023-07-26 21:32:56

3. Can this issue be re-produced with the latest release?

Yes

4. What did you do?

尝试过两种情况 之前用的 image

后一种 image

然后程序的 SQL 打印出执行的: image 这个是对的,就应该这个执行!

但是,实际上执行的(打开了 MySQL 的查询日记记录): image

可以看到原生方法上自动给我加了个引号:包裹成了字符串

5. What did you expect to see?

按程序打印出来的 SQL 执行

6. What did you see instead?

程序没有按打印出来的 SQL 执行,造成了逻辑错误

gqcn commented 1 year ago

@greenhat616 这里是SQL日志打印有问题,我后续修复一下。这里建议使用gdb.Raw来实现你的需求,具体可以参考文档:https://goframe.org/pages/viewpage.action?pageId=111911590