friends-of-reactphp / mysql

Async MySQL database client for ReactPHP.
MIT License
334 stars 66 forks source link

Refactor to move command queue to `MysqlClient` and connection logic to `Connection` class #190

Closed clue closed 10 months ago

clue commented 10 months ago

This changeset includes a major refactoring to move the command queue to the MysqlClient and the connection logic to the Connection class. This is specifically done to prepare the underlying classes and APIs to add support for multiple connections (connection pooling as discussed in #175) in a follow-up PR.

This changeset includes a large number of additional test cases to ensure this works as expected and should not otherwise affect any of our public APIs in any way, as confirmed by the existing functional tests. The affected code now has 100% test coverage through additional unit tests, most of which was only covered in functional tests previously. I've tried hard to avoid introducing any unneeded changes and keep as much as possible of the given structure, considering this changeset affects a substantial part of our APIs already. A follow-up PR should clean up the test suite, reorder some of the tests and update the functional test suite to omit the functional tests when no MYSQL_URI is given.

I think this might very well be one of the largest refactorings in ReactPHP recently. Just for the code changes alone you're already looking at several full days of work, plus countless sessions to discuss various approaches (thanks to @SimonFrings and @yadaiio!), enjoy! Special thanks to our sponsors for making this possible! If you'd like to support this development, consider sponsoring ReactPHP! ❤️

Refs #175 and #147 Builds on top of #189 and #186