Is there any third-party tool for validate SQL query before I execute it with the database/sql pacakge or any way to check the SQL query is right without getting a panic from database/sql that the query is invalid?
1条回答 默认 最新
- dongzhi4239 2017-02-27 12:55关注
Finally, I found this SQL parser package. I colud use it for validate it.
func isSQLValid(sql string) (bool, error) { _, err := sqlparser.Parse(sql) if err != nil { return false, err } return true, nil }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 关于#java#的问题,请各位专家解答!(相关搜索:java程序)
- ¥15 linux tsi721的驱动编译后 insmod 提示 报错
- ¥20 multisim测数据
- ¥15 求无向连通网的所有不同构的最小生成树
- ¥15 模拟器的framebuffer问题
- ¥15 opencv检测轮廓问题
- ¥15 单点式登录SSO怎么爬虫获取动态SSO_AUTH_ACCESS_Token
- ¥30 哈夫曼编码译码器打印树形项目
- ¥20 求完整顺利登陆QQ邮箱的python代码
- ¥15 怎么下载MySQL,怎么卸干净原来的MySQL