File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,20 @@ public function createConnection(array $config): PostgreSQL
4848 {
4949 $ connection = new PostgreSQL ();
5050
51- $ result = $ connection -> connect ( sprintf (
51+ $ conn = sprintf (
5252 'host=%s port=%s dbname=%s user=%s password=%s ' ,
5353 $ config ['host ' ],
5454 $ config ['port ' ],
5555 $ config ['database ' ],
5656 $ config ['username ' ],
5757 $ config ['password ' ]
58- ));
58+ );
59+
60+ if (isset ($ config ['pool ' ]['connect_timeout ' ])) {
61+ $ result = $ connection ->connect ($ conn , $ config ['pool ' ]['connect_timeout ' ]);
62+ } else {
63+ $ result = $ connection ->connect ($ conn );
64+ }
5965
6066 if ($ result === false ) {
6167 throw new Exception ($ connection ->error ?? 'Create connection failed, Please check the database configuration. ' );
You can’t perform that action at this time.
0 commit comments