异步c++ mysql 连接器
谷歌搜索关于mysql的异步/非阻塞连接器我基本上去了这篇文章
然而,已经过去了两年了,现在追踪细雨中发生的事情有点令人困惑。 libdrizzle 在某些时候是一个单独的依赖项,但他们决定将其与项目的其余部分合并。 C++ 异步数据库访问还有其他选项吗?
googling about asynchronous /non-blocking connectors for mysql i went basically to this post
However, it's been 2 years and following whats happening on drizzle is a bit confusing at the moment. libdrizzle was a separate dependency at some point but they decided to merge it with the rest of the project. Are there other options for asynchronous database access from c++?
I've been looking at OTL, ODB and OpenDBX, but they all seem to be synchronous (require a separate thread for non-blocking operation)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有同样的愿望,但得出的结论是不支持。即使使用 MySQL C API,您也可以使用低级函数来异步发出查询并等待响应,但您永远无法获得完整的异步结果收集——从结果的第一部分开始,您总是会处于阻塞状态。直到最后才回来。
我没有直接的经验,但我读到 Postgres 确实支持完全异步(至少在 C API 中)。
I had the same desire and came to the conclusion that it's not supported. Even with the MySQL C API you can use the low-level functions to issue queries and wait for a response asynchronously, but you cannot ever get full asynchronous result collection--you always end up blocking from the time the first piece of the result is returned until the last.
I don't have direct experience with it, but I've read that Postgres does support full asynchrony (at least in the C API).
我曾经在自己的项目中使用 MySAC 。虽然有点过时,但效果很好。我只是引用他们网站上的描述:
如果您使用 libuv,也许您会对 https://github.com/huxingyi/myc 感兴趣。这是我编写的纯 C mysql 连接器,您可以实现自己的网络层,或者仅在示例文件夹中使用基于
libuv
实现的uvmyc
。I used to used MySAC in my own project. It works well though is a little outdated. I just quote the description from their website:
And maybe you will interested in https://github.com/huxingyi/myc if you use libuv. It's a pure c mysql connector wrote by me, you can implement your own network layer or just use the implemented
libuv
baseduvmyc
inside the example folder.