英文:
how to get the finally sql string in the beg orm
问题
我想要获取beego的orm中最终的SQL语句字符串,但是我找不到可以获取SQL字符串的接口。我想要为数据库操作添加日志记录,但是我想找到其他不需要打开orm.Debug的方法。
英文:
I want to get the finally sql string in the beego's orm.
but I can not find the interface that can get sql string.
I want to make a Logging for database Operating.
I want to find other ways that do not need to turn on the orm.Debug.
orm.Debug = false
答案1
得分: 1
我认为你想使用orm.Debug
模式:
>将orm.Debug
设置为true将打印出SQL查询语句
>
>这可能会导致性能问题。不建议在生产环境中使用。
>....
>默认情况下打印到os.Stderr
。
>
>你可以将其更改为你自己的io.Writer
英文:
I think you want to use orm.Debug
mode:
>Setting orm.Debug
to true will print out SQL queries
>
>It may cause performance issues. It's not recommend to be used in production env.
>....
>Prints to os.Stderr
by default.
>
>You can change it to your own io.Writer
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论