简体   繁体   中英

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.

Given that mysqli supports async queries , is there any reason why these async libraries cannot be based on mysqli ?

Originally asked as Why isn't amphp/mysql based on mysqli? (closed).

Hey ReactPHP core team member here. 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. 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 :

mysqli_poll() is just polling... mysql . It does not provide you any possibility to poll any other streams together with the mysql data. There's no underlying file descriptors exposed by mysqli which the event loop could use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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