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

发现这里应该是有问题的,这里判断sql语句有?就标识为参数,但是有一种情况,假如插入的值本身就有?的情况下,就会出现问题 #63

Open
wenj91 opened this issue Dec 1, 2021 · 8 comments
Assignees

Comments

@wenj91
Copy link

wenj91 commented Dec 1, 2021

stmt.paramCount = strings.Count(query, "?")

例如:
create table if not exists MD5_fa0f7ac06608830346a51c03de15eaf2 using http_client_requests_seconds_sum tags("339ac2bfa5fd9d673a96f112ea0e738d","false","xxx","xx.com","xxxx","dev","127.0.0.1","xx-service","GET","APP","xxx","200","xxx","xxx","/uu/get?corpid={1}&corpsecret={2}")

这种情况是不是就会出现问题了

@sangshuduo
Copy link
Contributor

通用问题还是直接提到 TDengine 仓库可以比较快的有人响应

@wenj91
Copy link
Author

wenj91 commented Dec 1, 2021

通用问题还是直接提到 TDengine 仓库可以比较快的有人响应

这个并不是通用问题,这个是驱动问题

@huskar-t
Copy link
Collaborator

huskar-t commented Dec 2, 2021

@wenj91
Copy link
Author

wenj91 commented Dec 2, 2021

@wenj91 参照 mysql 实现 https://github.com/go-sql-driver/mysql/blob/6cf3092b0e12f6e197de3ed6aa2acfeac322a9bb/connection.go#L198-L295

不,这只是其中一部分实现,它后续还有处理的,不单单是用strings.Count(query, "?")来简单判断参数个数的,这样必然会出现bug

@huskar-t
Copy link
Collaborator

huskar-t commented Dec 2, 2021

@wenj91 欢迎提交pr

@wenj91
Copy link
Author

wenj91 commented Dec 4, 2021

@wenj91 欢迎提交pr

https://github.com/wenj91/taos-driver/blob/320f402a7c3e3bf52028c88ba0d0274d3f3d4cdd/util_sql.go#L123-L235
这是我实现部分,不过还经过大量测试,等我测试完全再提一个pr吧

@huskar-t
Copy link
Collaborator

huskar-t commented Dec 5, 2021

@wenj91 欢迎提交pr

https://github.com/wenj91/taos-driver/blob/320f402a7c3e3bf52028c88ba0d0274d3f3d4cdd/util_sql.go#L123-L235 这是我实现部分,不过还经过大量测试,等我测试完全再提一个pr吧

我看着这部分实现,情况考虑的还是不够,我觉得这个应该由C接口来负责语法解析并返回参数数量
@sangshuduo @hjxilinx @dapan1121

@wenj91
Copy link
Author

wenj91 commented Dec 6, 2021

@wenj91 欢迎提交pr

https://github.com/wenj91/taos-driver/blob/320f402a7c3e3bf52028c88ba0d0274d3f3d4cdd/util_sql.go#L123-L235 这是我实现部分,不过还经过大量测试,等我测试完全再提一个pr吧

我看着这部分实现,情况考虑的还是不够,我觉得这个应该由C接口来负责语法解析并返回参数数量 @sangshuduo @hjxilinx @dapan1121

如果能由C接口返回更好,因为MySQL就这么做的

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

5 participants