diff --git a/CHANGELOG.md b/CHANGELOG.md index f2b6c4a..cfd7b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.0.3 (20224-04-25) + +- Downgraded react-mysql to 0.6.x stable version + ## v1.0.2 (2024-04-23) - QueryBuilder::quoteIdentifier() diff --git a/composer.json b/composer.json index 85aa4c7..bf8c11c 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php": ">=8.1.0", - "react/mysql": "^0.7@dev" + "react/mysql": "^0.6" }, "autoload": { "psr-4": { diff --git a/src/Driver/Mysql/Connection.php b/src/Driver/Mysql/Connection.php index b1800aa..51f6e1a 100644 --- a/src/Driver/Mysql/Connection.php +++ b/src/Driver/Mysql/Connection.php @@ -8,8 +8,11 @@ use Blrf\Dbal\Result; use Blrf\Dbal\ResultStream; use Blrf\Dbal\Driver\Connection as DriverConnection; +/* react/mysql:0.7.x use React\Mysql\MysqlClient; use React\Mysql\MysqlResult; +*/ +use React\MySQL\Factory; use React\Promise\PromiseInterface; use function React\Promise\resolve; @@ -23,7 +26,10 @@ class Connection extends DriverConnection { public function connect(): PromiseInterface { + /* react/mysql:0.7.x return resolve($this->setNativeConnection(new MysqlClient($this->config->getUri()))); + */ + return resolve($this->setNativeConnection((new Factory())->createLazyConnection($this->config->getUri()))); } public function query(): QueryBuilder @@ -41,7 +47,7 @@ public function execute(string $sql, array $params = []): PromiseInterface { // @phpstan-ignore-next-line return $this->getNativeConnection()->query($sql, $params)->then( - function (MysqlResult $res) { + function (/*MysqlResult */$res) { return new Result( $res->resultRows ?? [], $res->insertId, diff --git a/tests/Driver/Mysql/ConnectionTest.php b/tests/Driver/Mysql/ConnectionTest.php index bc3347a..4c87b0b 100644 --- a/tests/Driver/Mysql/ConnectionTest.php +++ b/tests/Driver/Mysql/ConnectionTest.php @@ -9,8 +9,10 @@ use Blrf\Dbal\Driver\Mysql\QueryBuilder; use Blrf\Tests\Dbal\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use React\Mysql\Io\Connection as MysqlConnection; -use React\Mysql\MysqlResult; +//use React\Mysql\Io\Connection as MysqlConnection; // react/mysql:0.7.x +use React\MySQL\ConnectionInterface as MysqlConnection; // react/mysql:0.6.x +//use React\Mysql\MysqlResult; // react/mysql:0.7.x +use React\MySQL\QueryResult as MysqlResult; // react/mysql:0.6.x use function React\Async\await; use function React\Promise\resolve; @@ -41,7 +43,6 @@ public function testExecute(): void $params = ['param']; $config = new Config(); - $mysqlConnection = $this->createMock(MysqlConnection::class); $mysqlConnection->expects($this->once())->method('query')->with($sql, $params)->willReturn(resolve($result)); $connection = $this->getMockBuilder(Connection::class)