Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug that connection->select() cannot work for database-pgsql. #5016

Merged
merged 5 commits into from Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG-3.0.md
Expand Up @@ -54,7 +54,7 @@ composer analyse
- [#4908](https://github.com/hyperf/hyperf/pull/4908) Added `Db::beforeExecuting()` to register a hook which to be run just before a database query is executed.
- [#4909](https://github.com/hyperf/hyperf/pull/4909) Added `ConsumerMessageInterface::getNums()` to change the number of amqp consumer by dynamically.
- [#4918](https://github.com/hyperf/hyperf/pull/4918) Added `LoadBalancerInterface::afterRefreshed()` to register a hook which to be run after refresh nodes.
- [#4994](https://github.com/hyperf/hyperf/pull/4994) Added component `hyperf/database-pgsql` which you can be used to connect pgsql server.
- [#4994](https://github.com/hyperf/hyperf/pull/4994) [#5016](https://github.com/hyperf/hyperf/pull/5016) Added component `hyperf/database-pgsql` which you can be used to connect pgsql server.

## Optimized

Expand Down
4 changes: 3 additions & 1 deletion src/database-pgsql/src/PostgreSqlSwooleExtConnection.php
Expand Up @@ -31,6 +31,8 @@ class PostgreSqlSwooleExtConnection extends Connection
*/
protected mixed $pdo;

protected int $fetchMode = SW_PGSQL_ASSOC;

/**
* Get a schema builder instance for the connection.
*/
Expand Down Expand Up @@ -108,7 +110,7 @@ public function select(string $query, array $bindings = [], bool $useReadPdo = t
throw new QueryException($query, [], new \Exception($this->pdo->error));
}

return $this->pdo->fetchAll($result) ?: [];
return $statement->fetchAll($this->fetchMode) ?: [];
});
}

Expand Down