简体   繁体   English

mysqli 是否有限制使其不适合与 AMP 或 ReactPHP 一起使用?

[英]Are there limitations in mysqli that make it unsuitable for use with AMP or ReactPHP?

I've seen that libraries such as amphp/mysql and friends-of-reactphp/mysql implement the low-level MySQL protocol, and do not rely on any built-in extension.我已经看到诸如amphp/mysqlfriends-of-reactphp/mysql 之类的库实现了低级 MySQL 协议,并且不依赖任何内置扩展。

Given that mysqli supports async queries , is there any reason why these async libraries cannot be based on mysqli ?鉴于mysqli 支持异步查询,这些异步库不能基于mysqli有什么理由吗?

Originally asked as Why isn't amphp/mysql based on mysqli?最初问为为什么 amphp/mysql 不是基于 mysqli? (closed). (关闭)。

Hey ReactPHP core team member here.嘿 ReactPHP 核心团队成员。 In short you shouldn't use them (you always can but we strongly advise against it) because their I/O isn't hooked into our event loop.简而言之,您不应该使用它们(您总是可以,但我们强烈建议您不要使用),因为它们的 I/O 未连接到我们的事件循环中。 Meaning it can block the entire loop and everything hooked into it until it's done with what ever it does.这意味着它可以阻塞整个循环和所有挂钩到它的东西,直到它完成它所做的一切。

Courtesy @bwoebi on amphp/mysql 's GitHub :amphp/mysql的 GitHub 上@bwoebi提供:

mysqli_poll() is just polling... mysql . mysqli_poll()只是轮询... mysql It does not provide you any possibility to poll any other streams together with the mysql data.它不会为您提供将任何其他流与 mysql 数据一起轮询的任何可能性。 There's no underlying file descriptors exposed by mysqli which the event loop could use. mysqli 没有公开事件循环可以使用的底层文件描述符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM