Skip to content

Commit

Permalink
Fixed bug that connection->select() cannot work for `database-pgsql…
Browse files Browse the repository at this point in the history
…`. (#5016)



Co-authored-by: 李铭昕 <715557344@qq.com>
  • Loading branch information
kingIZZZY and limingxinleo committed Aug 15, 2022
1 parent 15155bc commit 733e4e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 733e4e5

Please sign in to comment.